<div dir="ltr">Jeff, <div><br></div><div>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. </div><div><br></div><div>-Justin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 5, 2017 at 12:32 PM, Jeff Duda <span dir="ltr"><<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>-Does the seventh file exist on your system?<br></div>-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. <br></div>-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.<br><br></div>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.<br><br></div>Jeff Duda<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Jan 5, 2017 at 10:19 AM, Justin Hicks <span dir="ltr"><<a href="mailto:jhicks2014@gmail.com" target="_blank">jhicks2014@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><span style="font-size:12.8px">GrADS users,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">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:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> 'reinit'<div>'open /data2/control/Region00_WLD_ma<wbr>sk_GLDAS.nc'</div><div>'set t 1 756'</div><div>'set dfile 1'</div><div>'set lon -179.5 179.5'</div><div>'set lat -89.5 89.5'</div><div>'sdfopen /data2/control/GLDAS_NOAH10_M.<wbr>020.ctl_1Deg_RainfallRateSfc.n<wbr>c'</div><div>'set dfile 2'</div><div>'set lon -179.5 179.5'</div><div>'set lat -89.5 89.5'</div><div>'set time 00Z01JAN1948'</div><div>'set dfile 1'</div><div> nmonths=756</div><div> i=1</div><div> while (i<=nmonths)</div><div> 'set t 'i</div><div>'q file 1'</div><div>region = sublin(result,2)</div><div>region = subwrd(region,2)</div><div>'q file 2'</div><div>dataset = sublin(result,2)</div><div>dataset = subwrd(dataset,2)</div><div> 'q dims'</div><div> rectime = sublin(result,5)</div><div> recdate = subwrd(rectime,6) </div><div>'d aave(maskout(rainfsfc.2*86400,<wbr>lterp(mask.1(time=00Z01JAN1948<wbr>),rainfsfc.2)),lon=-179.5,lon=<wbr>179.5,lat=-89.5,lat=89.5)' </div><div> say 't='i </div><div> say result</div><div> rainfsfc = sublin(result,1)</div><div> rainfsfc = subwrd(rainfsfc,4)</div><div> string = dataset' 'region' 'rectime' 'rainfsfc</div><div> rc=write('GLDAS_MASK_DATA.txt<wbr>' , string ,'append')</div><div> i = i + 1</div><div> endwhile</div><div><br></div><div>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_ma<wbr>sk_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:</div><div><br></div><div><div>QUERY FILE Error: file 2 not open</div><div>Data Request Error: File number out of range </div><div> Variable = rainfsfc.2 </div><div>Operation Error: Error from maskout function</div><div>Operation Error: Error from aave function</div><div> Error ocurred at column 1</div><div>DISPLAY error: Invalid expression </div><div> Expression = aave(maskout(rainfsfc.2*86400,<wbr>lterp(mask.1(time=00z01jan1948<wbr>),rainfsfc.2)),lon=-179.5,lon=<wbr>179.5,lat=-89.5,lat=89.5)</div><div>t=703</div><div>Data Request Error: File number out of range </div><div> Variable = rainfsfc.2 </div><div>Operation Error: Error from maskout function</div><div>Operation Error: Error from aave function</div><div> Error ocurred at column 1</div><div>DISPLAY error: Invalid expression </div><div> Expression = aave(maskout(rainfsfc.2*86400,<wbr>lterp(mask.1(time=00z01jan1948<wbr>),rainfsfc.2)),lon=-179.5,lon=<wbr>179.5,lat=-89.5,lat=89.5)</div><div><br></div><div><br></div><div>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). </div><div><br></div><div>Any help would be appreciated to me solve this issue, as I'm baffled.</div></div><span class="m_735202519539341002HOEnZb"><font color="#888888"><div><br></div><div>-Justin</div></font></span></div><span class="m_735202519539341002HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_735202519539341002m_1561338336932819900gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><span style="font-size:12.8px"><span style="font-size:10pt;font-family:"times new roman",serif;background-image:initial;background-repeat:initial"><font color="#000000"><b>Justin Hicks</b></font></span></span><br></div><div><i style="font-size:12.8px"><span style="font-size:10pt;font-family:"times new roman",serif;background-image:initial;background-repeat:initial"><font color="#000000">Undergraduate<br>Atmospheric Sciences Major</font></span></i></div><div><i style="font-size:12.8px"><span style="font-size:10pt;font-family:"times new roman",serif;background-image:initial;background-repeat:initial"><font color="#000000">GIS Minor<br>University of Maryland-College Park</font></span></i><font size="2" color="#000000" face="arial, helvetica, sans-serif"><b><br></b></font></div></div></div></div></div>
</font></span></div>
<br></div></div><span class="">______________________________<wbr>_________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/li<wbr>stinfo/gradsusr</a><br>
<br></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div class="m_735202519539341002gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Jeff Duda<br>Post-doctoral research fellow<br>University of Oklahoma School of Meteorology<br></div></div></div></div></div>
</font></span></div>
<br>______________________________<wbr>_________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/<wbr>listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><span style="font-size:12.8px"><span style="font-size:10pt;font-family:"Times New Roman",serif;background-image:initial;background-repeat:initial"><font color="#000000"><b>Justin Hicks</b></font></span></span><br></div><div><i style="font-size:12.8px"><span style="font-size:10pt;font-family:"Times New Roman",serif;background-image:initial;background-repeat:initial"><font color="#000000">Undergraduate<br>Atmospheric Sciences Major</font></span></i></div><div><i style="font-size:12.8px"><span style="font-size:10pt;font-family:"Times New Roman",serif;background-image:initial;background-repeat:initial"><font color="#000000">GIS Minor<br>University of Maryland-College Park</font></span></i><font color="#000000" face="arial, helvetica, sans-serif" size="2"><b><br></b></font></div></div></div></div></div>
</div>