<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 &#39;reinit&#39;, 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&#39;s why I don&#39;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">&lt;<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a>&gt;</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&#39;t see any &#39;close&#39; statements in your script, so you may want to consider the ramifications of never closing files if you&#39;re opening a large number of them. <br></div>-Are you running out of memory? Usually Grads just crashes entirely when there&#39;s a memory error, but perhaps it&#39;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&#39;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&#39;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">&lt;<a href="mailto:jhicks2014@gmail.com" target="_blank">jhicks2014@gmail.com</a>&gt;</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"> &#39;reinit&#39;<div>&#39;open /data2/control/Region00_WLD_ma<wbr>sk_GLDAS.nc&#39;</div><div>&#39;set t 1 756&#39;</div><div>&#39;set dfile 1&#39;</div><div>&#39;set lon -179.5 179.5&#39;</div><div>&#39;set lat -89.5 89.5&#39;</div><div>&#39;sdfopen /data2/control/GLDAS_NOAH10_M.<wbr>020.ctl_1Deg_RainfallRateSfc.n<wbr>c&#39;</div><div>&#39;set dfile 2&#39;</div><div>&#39;set lon -179.5 179.5&#39;</div><div>&#39;set lat -89.5 89.5&#39;</div><div>&#39;set time 00Z01JAN1948&#39;</div><div>&#39;set dfile 1&#39;</div><div> nmonths=756</div><div> i=1</div><div> while (i&lt;=nmonths)</div><div> &#39;set t &#39;i</div><div>&#39;q file 1&#39;</div><div>region = sublin(result,2)</div><div>region = subwrd(region,2)</div><div>&#39;q file 2&#39;</div><div>dataset = sublin(result,2)</div><div>dataset = subwrd(dataset,2)</div><div> &#39;q dims&#39;</div><div> rectime = sublin(result,5)</div><div> recdate = subwrd(rectime,6) </div><div>&#39;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)&#39; </div><div>  say &#39;t=&#39;i  </div><div> say result</div><div> rainfsfc = sublin(result,1)</div><div> rainfsfc = subwrd(rainfsfc,4)</div><div> string = dataset&#39; &#39;region&#39; &#39;rectime&#39; &#39;rainfsfc</div><div> rc=write(&#39;GLDAS_MASK_DATA.txt<wbr>&#39; ,  string ,&#39;append&#39;)</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 &#39;open /data2/control/Region01_ART_ma<wbr>sk_GLDAS.nc&#39;). 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&#39;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&#39;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:&quot;times new roman&quot;,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:&quot;times new roman&quot;,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:&quot;times new roman&quot;,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:&quot;Times New Roman&quot;,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:&quot;Times New Roman&quot;,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:&quot;Times New Roman&quot;,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>