[gradsusr] Using subsetting on a grads data server
James T. Potemra
jimp at hawaii.edu
Wed Aug 10 14:15:04 EDT 2011
Hi Shaun:
Great question. I think you are on the right track, but the syntax is
a little off. First, you need a '?' between the DODS URL and the variable
of interest. Second, I think square brackets, instead of '{}' are used.
Third, I'm not sure you can give the time as a string, but rather you
need to use index number (e.g., if t=10 corresponds to 00Z08AUG2011,
you need to use 10). I could be wrong on this one. And, finally, I think
your expression to create the URL is a little off.
So, to match your second script to the first:
baseurl = 'http://nomads.ncep.noaa.gov:9090/dods/nam/'
datasets = 'nam20110808/nam_crb_00z'
expression = 'apcpsfc'
dimensions = '[269:273,12:15,1000:1000,1:12]'
'sdfopen '%baseurl%datasets'?'%expression%dimensions
Note that I just made up the time dimension 1:12; also note the '?'
between %datasets and %expression in the last line. I think this should
work.
As for the speed issue, I'm not sure, but presumably the server will be
faster than the network. It will also depend on how often you do this
whether you want to download into memory several variables or just
one. Anyway, might be worth experimenting a bit.
Jim
On 8/10/11 4:28 AM, Shaun Carney wrote:
> Hello,
> I have what hopefully is a simple question. I'm trying to do a clip of
> a precip grid to a small area on a grads server rather than opening
> the entire dataset and then doing the clip. The following works:
>
> 'sdfopen http://nomads.ncep.noaa.gov:9090/dods/nam/nam20110808/nam_crb_00z'
> 'set lon 269 273'
> 'set lat 12 15'
> 'set t 1 29'
> 'define namprecip = apcpsfc'
>
> However, when I try to give an expression so that I only get the
> subset from the server, it will not work:
>
> baseurl = 'http://nomads.ncep.noaa.gov:9090/dods/nam/_expr_'
> datasets = '{nam20110808/nam_crb_00z}'
> expression = '{apcpsfc}'
> dimensions = '{269:273,12:15,1000:1000,00Z08AUG2011:12Z11AUG2011}'
> 'sdfopen '%baseurl%datasets%expression%dimensions
> 'set t 1 29'
> 'define namprecip = result'
>
> Grads gives the following error:
> gadsdf: Couldn't ingest SDF metadata
>
> Any ideas why this will not read? On a more basic level, will there be
> any speed improvement using the second method rather than the first,
> or does setting the coord box before defining namprecip reduce the
> data transfer?
>
> This will be implemented on a computer with slow connection speed so I
> want to minimize data transfer.
>
> Thanks!
> Shaun
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
More information about the gradsusr
mailing list