[gradsusr] g2ctl/gribmap and 6hr/12hr GFS

Charles Seman - NOAA Federal charles.seman at noaa.gov
Tue Nov 10 15:45:51 EST 2015


Christopher,

Just thought of a possibly better way.  One loop for the regularly 
spaced time levels, and another loop for the time levels beyond using 
the "tindex" idea.  Please give attached script "test2.gs" a try.

Hope this helps,
Chuck

On 11/10/2015 03:23 PM, Charles Seman - NOAA Federal wrote:
> Christopher,
>
> A way to do this is with indexing into a pre-defined "tindex" variable
> to define the trecord variable using the loop index.
>
> As an example:
>
> tindex = '1 2 3 5 7 10 12 15 18 21'
> i=1
> while( i<=10 )
>   trecord = subwrd(tindex,i)
>   say 'i, trecord = 'i', 'trecord
>   i=i+1
> endwhile
>
> Another way, where you don't have to know the length of "tindex" (number
> of time levels):
>
> i=1
> trecord = subwrd(tindex,i)
> while( trecord != '' )
>   say 'i, trecord = 'i', 'trecord
>   i=i+1
>   trecord = subwrd(tindex,i)
> endwhile
>
> Try out the above code in GrADS using test.gs (attached).
>
> Hope this helps,
> Chuck
>
> On 11/07/2015 09:52 AM, Christopher Gilroy wrote:
>> I've always been curious for those who run their plots using scripting
>> approaches and download in 3 or 6-hour increments, how do you handle
>> past hour 240?
>>
>> For example, downloading 6hr files, starting at hr 0, t41=240 and then
>> t43=252 and I'm curious if there's a way to make t42=252, t43=264, etc.
>> I'm just looking for a way to make every t = a working timestep.
>>
>> So as an example, if you made a looping grads script for all 384 hours,
>> using 6h files the only way I knew of to "get around" the 2 t-step
>> increments after 240 was doing something like:
>>
>> i=1
>> while (i <= 65)
>>
>> if (i <= 41)
>> trecord=i
>> endif
>> if (i=42)
>> trecord = 43
>> endif
>> if (i=43)
>> trecord = 45
>> endif
>>
>> 'd tmp2m'
>>
>> The only reason I cared to do that even was because otherwise every
>> other image past hr240 would be blank since there is no t=42, t=44, etc.
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>

-- 

Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.

********************************************************************
  Charles Seman                                Charles.Seman at noaa.gov
  U.S. Department of Commerce / NOAA / OAR
  Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
  201 Forrestal Road                              fax: (609) 987-5063
  Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect any
official or unofficial position of the United States Federal Government,
the United States Department of Commerce, or NOAA."
-------------- next part --------------
function test2()

i=1
while( i<=41 )
trecord = i
tt = 6*(i-1)
say 'i, trecord, time = 'i', 'trecord', 'tt
i=i+1
endwhile

say

tindex = '252 264'
ii=i-41
trecord = i
tt = subwrd(tindex,ii)
while( tt != '' )
  say 'i, ii, trecord, time = 'i', 'ii', 'trecord', 'tt
  i=i+1
  ii=i-41
  trecord = i
  tt = subwrd(tindex,ii)
endwhile
return


More information about the gradsusr mailing list