[gradsusr] Current Date in GrADS.
Rick Danielson
onto.limbo at gmail.com
Fri Jul 5 15:34:43 EDT 2013
Hi Marie,
In a grads script try executing a separate script (say, "date.formatted")
that runs an operating-system command (on linux it might work like this):
"!~/bin/date.formatted"
ret = read(grads.print.date)
"!rm grads.print.date"
status = sublin(ret,1)
if (status != 0)
say 'error reading grads.print.date'
endif
today = sublin(ret,2)
where the separate script produces a temporary text file
(grads.print.date) in the current directory that contains the
date of interest. Again on linux, this "date.formatted" command
would be placed with other executables in the $PATH) and might
contain an operating-system command like this:
date +"%y-%m-%d-%H-%M-%S" > grads.print.date
Note that if your operating system provides a command to generate
today's date, you can often tailor it to produce whatever format might
be useful inside a grads script. If you're reading between the lines
here, the message is use the right operating system...;)
Cheers,
Rick
On 07/05/2013 03:12 PM, Marie Staerk wrote:
> Hello,
>
> I wonder if there is any simple way to automatically get the current
> date in GrADS?
> I want to create a script which uses the latest gfs data whithout
> having to specify the time i.e. automatically uses the current date.
>
> For example I want to write something like this: @ sdfopen
> http:\\nomads.ncep.noaa.gov:9090/dods/gfs$YYYYMMDD/gfs_00z, where
> $YYYYMMDD represents the current date.
>
> Kind Regards
> Marie
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130705/633a1c1b/attachment-0003.html
More information about the gradsusr
mailing list