[gradsusr] Mask/Scripting error

Jeff Duda jeffduda319 at gmail.com
Thu Jan 5 12:51:20 EST 2017


Justin,
Can you just start your looping right at the seventh iteration, or do later
iterations depend on previous ones?

Jefff

On Thu, Jan 5, 2017 at 11:46 AM, Justin Hicks <jhicks2014 at gmail.com> wrote:

> Jeff,
>
> The seventh file exists; this is an issue that pertains to any combination
> of seven masks. Also, I begin each new block of commands with 'reinit',
> which should close any previously open mask files. If I run all 56 masks
> (one at a time, each closing before the next mask is opened), some of the
> masks still output data, and others just output that error statement.
> That's why I don't believe it is a memory issue. Each mask file runs
> perfectly fine when run in its own gradscript; I just get this error when
> grouping them all into one script.
>
> -Justin
>
> On Thu, Jan 5, 2017 at 12:32 PM, Jeff Duda <jeffduda319 at gmail.com> wrote:
>
>> -Does the seventh file exist on your system?
>> -Are you opening too many files? I don't see any 'close' statements in
>> your script, so you may want to consider the ramifications of never closing
>> files if you're opening a large number of them.
>> -Are you running out of memory? Usually Grads just crashes entirely when
>> there's a memory error, but perhaps it's not in this instance.
>>
>> Usually when it comes to debugging, the most comprehensive thing you can
>> do is a line-by-line print statement to see what's going on in the script
>> after each and every line. You can simplify by printing out only specific
>> lines that you think are critical, then subdivide sections of code down to
>> the source of the problem so that you don't have to literally issue a print
>> statement after every line.
>>
>> Jeff Duda
>>
>> On Thu, Jan 5, 2017 at 10:19 AM, Justin Hicks <jhicks2014 at gmail.com>
>> wrote:
>>
>>> 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*
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>>
>>
>>
>> --
>> Jeff Duda
>> Post-doctoral research fellow
>> University of Oklahoma School of Meteorology
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
>
> --
> *Justin Hicks*
>
> *UndergraduateAtmospheric Sciences Major*
>
> *GIS MinorUniversity of Maryland-College Park*
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Post-doctoral research fellow
University of Oklahoma School of Meteorology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20170105/d53b81fd/attachment.html 


More information about the gradsusr mailing list