[gradsusr] Checking for valid times in grib file

Dan Leins theedge981 at gmail.com
Sun Jul 14 12:13:05 EDT 2013


All,

I've got several WRF model runs that I would like to open at the same time
using GrADS. This is easy enough, as I simply create and open control files
for each model. While most of these models run out to 36hrs, I have one
that runs out to 24 hrs. This causes me a problem when I start making plots
for hours 27 and beyond, as I start getting the "Entire Grid Undefined"
error for that shorter model run.

Is there any way that I can check to see if the data exist BEFORE I attempt
to plot it? I thought I could accomplish this by using q defval on a
variable (precipitable water in this case) for each forecast hour, check to
see if the value is above 0, and include the data if that's the case.
 Here's what I've come up with:

'define test=pwatclm'
'q defval test 100 100'
rec=sublin(result,1)
value=subwrd(rec,3)
say 'the value at this point is 'value

if (value >=0.0)
say 'Looks like there is data in this file - we can include it'
else
say 'Looks like this file is missing data - skip it'
endif

I'm capturing the output of q defval properly, as I routinely get values of
precipitable water for hours 00-24. Also, when I get into a time period
where data are missing (hours 27 and beyond), I get a result that states
"The value at this point is missing". However, I've obviously got a problem
with my if statement. It still says there is data in this file.

Any idea what I might have done wrong, or if there's a better way to
perform this check?

Thanks!
Dan Leins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130714/d70e930c/attachment-0003.html 


More information about the gradsusr mailing list