[gradsusr] Mask/Scripting error

Justin Hicks jhicks2014 at gmail.com
Thu Jan 5 11:19:19 EST 2017


GrADS users,

I have come across a strange problem while running a gradscript. I am using
this script to output average monthly data of different regions to a text
file. Each block of commands contains a different mask, but uses the same
datafile. The first block of commands is shown below:

 'reinit'
'open /data2/control/Region00_WLD_mask_GLDAS.nc'
'set t 1 756'
'set dfile 1'
'set lon -179.5 179.5'
'set lat -89.5 89.5'
'sdfopen /data2/control/GLDAS_NOAH10_M.020.ctl_1Deg_RainfallRateSfc.nc'
'set dfile 2'
'set lon -179.5 179.5'
'set lat -89.5 89.5'
'set time 00Z01JAN1948'
'set dfile 1'
 nmonths=756
 i=1
 while (i<=nmonths)
 'set t 'i
'q file 1'
region = sublin(result,2)
region = subwrd(region,2)
'q file 2'
dataset = sublin(result,2)
dataset = subwrd(dataset,2)
 'q dims'
 rectime = sublin(result,5)
 recdate = subwrd(rectime,6)
'd aave(maskout(rainfsfc.2*86400,lterp(mask.1(time=
00Z01JAN1948),rainfsfc.2)),lon=-179.5,lon=179.5,lat=-89.5,lat=89.5)'
  say 't='i
 say result
 rainfsfc = sublin(result,1)
 rainfsfc = subwrd(rainfsfc,4)
 string = dataset' 'region' 'rectime' 'rainfsfc
 rc=write('GLDAS_MASK_DATA.txt' ,  string ,'append')
 i = i + 1
 endwhile

I repeat these commands in the same script over and over, only changing the
second line (ex. the next one would read 'open
/data2/control/Region01_ART_mask_GLDAS.nc').
The data is output perfectly when I have six masks in the script, but when
I include the seventh, the data output from the third mask / block of
commands is altered, and I get the following error:

QUERY FILE Error:  file 2 not open
Data Request Error:  File number out of range
  Variable = rainfsfc.2
Operation Error:  Error from maskout function
Operation Error:  Error from aave function
  Error ocurred at column 1
DISPLAY error:  Invalid expression
  Expression = aave(maskout(rainfsfc.2*86400,lterp(mask.1(time=
00z01jan1948),rainfsfc.2)),lon=-179.5,lon=179.5,lat=-89.5,lat=89.5)
t=703
Data Request Error:  File number out of range
  Variable = rainfsfc.2
Operation Error:  Error from maskout function
Operation Error:  Error from aave function
  Error ocurred at column 1
DISPLAY error:  Invalid expression
  Expression = aave(maskout(rainfsfc.2*86400,lterp(mask.1(time=
00z01jan1948),rainfsfc.2)),lon=-179.5,lon=179.5,lat=-89.5,lat=89.5)


I don't believe the error lies within the third mask file itself because it
plots fine when it is run independently from the other masks. I also get
the same output issue when I run, for example, masks 50-56 (one or two of
these will come up with the error, but running masks 50-55 will yield no
problems).

Any help would be appreciated to me solve this issue, as I'm baffled.

-Justin

-- 
*Justin Hicks*

*UndergraduateAtmospheric Sciences Major*

*GIS MinorUniversity of Maryland-College Park*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20170105/681095de/attachment.html 


More information about the gradsusr mailing list