[gradsusr] Problem Extracting Time Data

L.B. bcbass2989 at gmail.com
Tue Jan 20 12:13:09 EST 2015


Hello,

I am having some issues extracting some time data with my GrADS script. A
little more information below:

I am running a WRF model with 15 minute output. This creates a bit of a
hassle when extracting times and dates from various timesteps. For example,
timestep numbers 1, 5, 9, 13, 17, 21, 25, etc. are all whole numbered hours
(i.e. 12Z, 13Z, 14Z). All other timesteps (2, 3, 4, 6, 7, 8, 10, 11, 12,
etc) are intra-hour values such as 1215Z or 1345Z.

In my sample code below, a random timestep number is chosen and set within
the GrADS environment. When 'q time' is ran, the resulting string differ in
length because some are simply 06Z30OCT2012 (a whole numbered hour), while
others are longer such as 19:45Z28OCT2012. This requires two sets of code
to extract the correct times and dates from each string. My code below
shows my attempt to solve this issue, but if the timestep satisfies the
first condition of the if statement, it still seems to skip over it and use
the second conditions method of extracting the values which screws it all
up. What exactly am I doing wrong here?

Hopefully this makes sense. If you need more clarification, please ask.

Thanks.

'set t 17'
if (t=1 | t=5 | t=9 | t=13 | t=17 | t=21 | t=25 | t=29 | t=33 | t=37 | t=41
| t=45 | t=49)
 'q time'
 res = subwrd(result,3)
 btime = substr(res,1,12)
 bhr = substr(btime,1,2)
 bmonth = substr(btime,6,3)
 bday = substr(btime,4,2)
 byr = substr(btime,9,4)
else
 'q time'
 res = subwrd(result,3)
 btime = substr(res,1,15)
 bhr = substr(btime,1,5)
 bmonth = substr(btime,9,3)
 bday = substr(btime,7,2)
 byr = substr(btime,12,4)
endif

*-------*

*William (L.B.) LaForce*Meteorologist
www.tornadoinsanity.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150120/91f44eee/attachment.html 


More information about the gradsusr mailing list