Time stamping images with day and month

Dave Allured dave.allured at NOAA.GOV
Mon Oct 30 16:47:18 EST 2006


Brian,

Here is some script that does about what you are looking for.  This
handles year, month, day, and hour.

The if statement is for self adapting to certain time formats.  The
string format returned by 'query time' will vary for some kinds of
data files.  For a fixed format application, you can probably drop
the if statement and just hard code 'zptr'.

    'query time'
    datestr = subwrd (result, 3)

    if (substr (datestr, 3, 1) = 'Z')
       zptr = 3
    else
       zptr = 6
    endif

    timestr = substr (datestr, 1, zptr)
    date    = substr (datestr, zptr+1, 99)

    dd   = substr (date, 1, 2)
    mmm  = substr (date, 3, 3)
    yyyy = substr (date, 6, 4)

    date2 = dd ' ' mmm ' ' yyyy

Then use 'draw string' to place the reconstructed time and/or date
strings wherever you want on your plot.

--Dave A.
CU/CIRES Climate Diagnostics Center (CDC)
NOAA/ESRL/PSD, Climate Diagnostics Branch (CDB)
http://www.cdc.noaa.gov/

Brian Gaze wrote:
> Are there any date time functions in GRADS to help with time stamping?
> I'm trying to provide a timestamp for images plotted from GFS GRIB
> files. The format I would like is:
>
> Run    Title    Valid
> (e.g. 0z Mon 30 Oct    2m temp   Sat 04 Nov 12z)
>
> I've got the hour available, but I don't know how to derive the day and
> month from this. Any example or ideas on how to achieve?
>
> Thanks
>
> Brian



More information about the gradsusr mailing list