Data request warning: Request beyond file limits
Eric Altshuler
ela at COLA.IGES.ORG
Tue Jun 30 18:18:31 EDT 2009
Dear Muhammad,
One problem I see is that you are using the 'read' script function incorrectly. In the line:
res = read('timeseries.txt')
the script variable 'res' will consist of two lines. The first line is the return code (indicating whether the read operation was successful or not) and the second line is the record from the file that was actually read. You should have the following sequence of lines:
res = read('timeseries.txt')
rc = sublin(res,1)
record = sublin(res,2)
I don't know how your 'timeseries.txt' file is set up, but you need to parse the script variable 'record', not 'res', to obtain the values of t1 and t2. The way your script is written now, t1 gets set to the return code while t2 is set to the line that was read from the file. This is clearly not what you want.
Best regards,
Eric L. Altshuler
Assistant Research Scientist
Center for Ocean-Land-Atmosphere Studies
4041 Powder Mill Road, Suite 302
Calverton, MD 20705-3106
USA
E-mail: ela at cola.iges.org
Phone: (301) 902-1257
Fax: (301) 595-9793
----- Original Message -----
From: "Muhammad Rahiz" <muhammad.rahiz at OUCE.OX.AC.UK>
To: GRADSUSR at LIST.CINECA.IT
Sent: Friday, June 26, 2009 2:10:05 PM GMT -05:00 US/Canada Eastern
Subject: Data request warning: Request beyond file limits
I'm trying to get monthly averages from daily data (6hr intervals) from a
master file which contains 353 months and 42,985 time steps.
I ran the following script but got the error - Data request warning: Request
beyond file limits.
Can anyone point out where the mistake is?
Muhammad Rahiz
GrADS v1.9b4 @ Fedora 10
---------------------------
'open rf.tmp.ctl'
'set lon 46.25 114.26'
'set lat -5.07 45.6'
'set t 1'
'set gxout fwrite'
* total number of months
mtot = 353
* month index
m = 1
while(m<=mtot)
res = read('timeseries.txt')
say t1' 't2
t1 = sublin(res,1)
t2 = sublin(res,2)
* calculate the four digit year
yyyy = 1960
* calculate the two digit month
mm = 10
fout = 'tmp.'yyyy''mm'.bin'
'set fwrite 'fout
'define tmon = ave(t,t='t1',t='t2')'
'disable fwrite'
m = m + 1
endwhile
-----------------------------
DSET ^rf.tmp
UNDEF -1.e34
XDEF 303 LINEAR 46.25 0.225198675496689
YDEF 226 LINEAR -5.07 0.2252
ZDEF 1 LEVELS 1008.23
TDEF 42985 LINEAR 06Z01OCT1960 360mn
VARS 1
t 0 99 t
ENDVARS
More information about the gradsusr
mailing list