<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi James,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">This error message is strange, because as you pointed out, subscript #0 would refer to the leftmost dimension, which is being subsetted with ":". </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm wondering if there's something fundamentally wrong with the "wave" variable on the file, or the SwdelQw_waves variable. It would help to see a printVarSummary of both of those variables:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">printVarSummary(<span style="font-size:12.8px">f->SwdelQw_waves)</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">printVarSummary(f->wave)</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">The other thing I'm curious about is why SwdelQw_waves has attributes called "lat" and "lev". </span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">It looks like this variable was originally subscripted by latitude and level coordinate subscripting in an NCL script, because NCL has an added feature where if you subscript a variable by a coordinate array, then it adds an attribute to your subscripted variable with the same name as the coordinate variable, and assigns the actual value that it ended up selecting.</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">If you can provide me with the other printVarSummary output, then I might be able to tell what's going on.</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">Thanks,</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">--Mary</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 14, 2017 at 10:46 AM, James Russell <span dir="ltr"><<a href="mailto:jorussel@ncsu.edu" target="_blank">jorussel@ncsu.edu</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>Hi all,</div><div><br></div><div>I'm getting the following error message when I run a script to read some netcdf files that I wrote from another script:</div><div><br></div><div>ncl fatal:Subscript out of range, error in subscript #0<br></div><div><br></div><div>The weird thing happening is that after this error message comes up, the script continues running and seems to do the correct things. I'm not sure why this error message is coming up either since it's just referencing everything in the first dimension when the script reads the file (i.e. var(:) ... see below script) so there's no way (I know of) that any subscript can be out of range since there aren't actually any subscripts.</div><div><br></div><div>The error comes up twice after the following two lines in the script:</div><div><div>var1 = f->SwdelQw_waves(:,{lagn:lagp}<wbr>,{preL:preH},{com_lat},{com_<wbr>lon})</div><div>varh1 = f->SwdelQw_waves(:,{lagn:lagp}<wbr>,{com_lev},{latS:latN},{lonE:<wbr>lonW})</div></div><div><br></div><div>Any help on why this error is appearing would be useful. It doesn't seem to be affecting the script but it's worrying since I'm not sure if it's changing anything.</div><div><br></div><div>Thanks in advance,</div><div>James</div><div><br></div><div><br></div><div>See below for the script, an ncl_filedump of the file being read, and a printVarSummary after the error comes up.</div><div><br></div><div>I'm running the script using a shell script:</div><div>ncl clat=\"{$clat}\" clon=\"{$clon}\" clev=\"{$clev}\" tho=\"{$tho}\" plot_panelxs_SwQw.ncl</div><div><br></div><div>Here's the script:</div><div><div><br></div><div>;*****************************<wbr>*****************************</div><div>; Script</div><div>;*****************************<wbr>*****************************</div><div><br></div><div>com_lat = tofloat(clat)</div><div>com_lon = tofloat(clon)</div><div>com_lev = tofloat(clev)</div><div>thold = tofloat(tho)</div><div><br></div><div>; Domain and first and last points on cross-section</div><div>preL = 1000.</div><div>preH = 150.</div><div>lagn = -60</div><div>lagp = 60</div><div>latS = com_lat-15</div><div>latN = com_lat+15</div><div>lonW = com_lon-20</div><div>lonE = com_lon+20</div><div><br></div><div>; Data in</div><div>pathin = "/typhoon/jorussel/pvbud/"</div><div>filein = "SwQw_"+com_lat+com_lon+com_<wbr>lev+thold+".nc"</div><div>pathino = "/typhoon/jorussel/basic_vars/<wbr>"</div><div>fileino = "pvw_"+com_lat+com_lon+com_<wbr>lev+thold+".nc"</div><div><br></div><div>print("Opening file and reading variable data")</div><div>f = addfile(pathin+filein,"r")</div><div>var1 = f->SwdelQw_waves(:,{lagn:lagp}<wbr>,{preL:preH},{com_lat},{com_<wbr>lon})</div><div>varh1 = f->SwdelQw_waves(:,{lagn:lagp}<wbr>,{com_lev},{latS:latN},{lonE:<wbr>lonW})</div><div><br></div><div>var1 = var1*(10^6)*6*60*60</div><div>varh1= varh1*(10^6)*6*60*60</div></div><div><br></div><div><div>;*****************************<wbr>*****************************</div><div>; End Script</div><div>;*****************************<wbr>***************************</div></div><div><br></div><div><div>;*****************************<wbr>*****************************</div><div>; ncl_filedump of file</div><div>;*****************************<wbr>***************************</div></div><div><br></div><div><div class="m_6370178346033827636gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Variable: f</div><div dir="ltr">Type: file</div><div dir="ltr">filename:<span style="white-space:pre-wrap">        </span>SwQw_1133650-1</div><div dir="ltr">path:<span style="white-space:pre-wrap">        </span>/typhoon/jorussel/pvbud/SwQw_<wbr><a href="http://1133650-1.nc">1133650-1.nc</a></div><div dir="ltr"> file global attributes:</div><div dir="ltr"> creation_date : Tue Jun 13 11:36:22 EDT 2017</div><div dir="ltr"> Conventions : None</div><div dir="ltr"> source_file : <a href="http://original-file.nc" target="_blank">original-file.nc</a></div><div dir="ltr"> title : NCL Efficient Approach to netCDF Creation</div><div dir="ltr"> dimensions:</div><div dir="ltr"> wave = 411</div><div dir="ltr"> lag = 21</div><div dir="ltr"> lev = 27</div><div dir="ltr"> lat = 57</div><div dir="ltr"> lon = 85</div><div dir="ltr"> variables:</div><div dir="ltr"> integer wave ( wave )</div><div dir="ltr"> _FillValue :<span style="white-space:pre-wrap">        </span>-<a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">2147483647</a></div><div dir="ltr"> long_name :<span style="white-space:pre-wrap">        </span>time</div><div dir="ltr"> units :<span style="white-space:pre-wrap">        </span>YYYYMMDDHH</div><div dir="ltr"><br></div><div dir="ltr"> integer lag ( lag )</div><div dir="ltr"> units :<span style="white-space:pre-wrap">        </span>Hours</div><div dir="ltr"><br></div><div dir="ltr"> integer lev ( lev )</div><div dir="ltr"> long_name :<span style="white-space:pre-wrap">        </span>isobaric level</div><div dir="ltr"> units :<span style="white-space:pre-wrap">        </span>hPa</div><div dir="ltr"><br></div><div dir="ltr"> float lat ( lat )</div><div dir="ltr"> La1 :<span style="white-space:pre-wrap">        </span>89.463</div><div dir="ltr"> Lo1 :<span style="white-space:pre-wrap">        </span> 0</div><div dir="ltr"> La2 :<span style="white-space:pre-wrap">        </span>-89.463</div><div dir="ltr"> Lo2 :<span style="white-space:pre-wrap">        </span>359.297</div><div dir="ltr"> Di :<span style="white-space:pre-wrap">        </span>0.7031252</div><div dir="ltr"> N :<span style="white-space:pre-wrap">        </span>128</div><div dir="ltr"> units :<span style="white-space:pre-wrap">        </span>degrees_north</div><div dir="ltr"> GridType :<span style="white-space:pre-wrap">        </span>Gaussian Latitude/Longitude Grid</div><div dir="ltr"> long_name :<span style="white-space:pre-wrap">        </span>latitude</div><div dir="ltr"><br></div><div dir="ltr"> float lon ( lon )</div><div dir="ltr"> La1 :<span style="white-space:pre-wrap">        </span>89.463</div><div dir="ltr"> Lo1 :<span style="white-space:pre-wrap">        </span> 0</div><div dir="ltr"> La2 :<span style="white-space:pre-wrap">        </span>-89.463</div><div dir="ltr"> Lo2 :<span style="white-space:pre-wrap">        </span>359.297</div><div dir="ltr"> Di :<span style="white-space:pre-wrap">        </span>0.7031252</div><div dir="ltr"> N :<span style="white-space:pre-wrap">        </span>128</div><div dir="ltr"> units :<span style="white-space:pre-wrap">        </span>degrees_east</div><div dir="ltr"> GridType :<span style="white-space:pre-wrap">        </span>Gaussian Latitude/Longitude Grid</div><div dir="ltr"> long_name :<span style="white-space:pre-wrap">        </span>longitude</div><div dir="ltr"><br></div><div dir="ltr"> float SwdelQw_waves ( wave, lag, lev, lat, lon )</div><div dir="ltr"> waveName :<span style="white-space:pre-wrap">        </span>none</div><div dir="ltr"> depth :<span style="white-space:pre-wrap">        </span><a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">( -2147483647</a>, -<a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">2147483647</a> )</div><div dir="ltr"> period :<span style="white-space:pre-wrap">        </span>( 2, 10 )</div><div dir="ltr"> wavenumber :<span style="white-space:pre-wrap">        </span>( -40, -10 )</div><div dir="ltr"> lat :<span style="white-space:pre-wrap">        </span>44.56129</div><div dir="ltr"> lev :<span style="white-space:pre-wrap">        </span>1000</div><div dir="ltr"> description :<span style="white-space:pre-wrap">        </span>zetax = -dvdp</div><div dir="ltr"> lonFlip :<span style="white-space:pre-wrap">        </span>longitude coordinate variable has been reordered via lonFlip</div><div dir="ltr"> initial_time :<span style="white-space:pre-wrap">        </span>10/31/2015 (18:00)</div><div dir="ltr"> forecast_time_units :<span style="white-space:pre-wrap">        </span>hours</div><div dir="ltr"> forecast_time :<span style="white-space:pre-wrap">        </span>0</div><div dir="ltr"> parameter_number :<span style="white-space:pre-wrap">        </span>132</div><div dir="ltr"> parameter_table_version :<span style="white-space:pre-wrap">        </span>128</div><div dir="ltr"> gds_grid_type :<span style="white-space:pre-wrap">        </span>4</div><div dir="ltr"> level_indicator :<span style="white-space:pre-wrap">        </span>100</div><div dir="ltr"> units :<span style="white-space:pre-wrap">        </span>/s</div><div dir="ltr"> long_name :<span style="white-space:pre-wrap">        </span>-grav*(zetaxw*dqw/dx + zetayw*dqw/dy)</div><div dir="ltr"> center :<span style="white-space:pre-wrap">        </span>European Center for Medium-Range Weather Forecasts (RSMC)</div><div dir="ltr"> _FillValue :<span style="white-space:pre-wrap">        </span>1e+20</div><div dir="ltr"><br></div><div dir="ltr"><div>;*****************************<wbr>*****************************</div><div>; End ncl_filedump</div><div>;*****************************<wbr>***************************</div><div><br></div><div><div>;*****************************<wbr>*****************************</div><div>; printVarSummary of variable after read in and error comes up</div><div>;*****************************<wbr>***************************</div></div><div><br></div><div><div>Variable: var1</div><div>Type: float</div><div>Total Size: 863100 bytes</div><div> 215775 values</div><div>Number of Dimensions: 3</div><div>Dimensions and sizes:<span style="white-space:pre-wrap">        </span>[wave | 411] x [lag | 21] x [lev | 25]</div><div>Coordinates: </div><div> wave: [1..411]</div><div> lag: [-60..60]</div><div> lev: [1000..150]</div><div>Number Of Attributes: 20</div><div> lon :<span style="white-space:pre-wrap">        </span>33.04689</div><div> waveName :<span style="white-space:pre-wrap">        </span>none</div><div> depth :<span style="white-space:pre-wrap">        </span><a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">( -2147483647</a>, -<a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">2147483647</a> )</div><div> period :<span style="white-space:pre-wrap">        </span>( 2, 10 )</div><div> wavenumber :<span style="white-space:pre-wrap">        </span>( -40, -10 )</div><div> lat :<span style="white-space:pre-wrap">        </span>44.56129</div><div> lev :<span style="white-space:pre-wrap">        </span>1000</div><div> description :<span style="white-space:pre-wrap">        </span>zetax = -dvdp</div><div> lonFlip :<span style="white-space:pre-wrap">        </span>longitude coordinate variable has been reordered via lonFlip</div><div> initial_time :<span style="white-space:pre-wrap">        </span>10/31/2015 (18:00)</div><div> forecast_time_units :<span style="white-space:pre-wrap">        </span>hours</div><div> forecast_time :<span style="white-space:pre-wrap">        </span>0</div><div> parameter_number :<span style="white-space:pre-wrap">        </span>132</div><div> parameter_table_version :<span style="white-space:pre-wrap">        </span>128</div><div> gds_grid_type :<span style="white-space:pre-wrap">        </span>4</div><div> level_indicator :<span style="white-space:pre-wrap">        </span>100</div><div> units :<span style="white-space:pre-wrap">        </span>/s</div><div> long_name :<span style="white-space:pre-wrap">        </span>-grav*(zetaxw*dqw/dx + zetayw*dqw/dy)</div><div> center :<span style="white-space:pre-wrap">        </span>European Center for Medium-Range Weather Forecasts (RSMC)</div><div> _FillValue :<span style="white-space:pre-wrap">        </span>1e+20</div></div><div><br></div><div><div>;*****************************<wbr>*****************************</div><div>; end printVarSummary()</div><div>;*****************************<wbr>***************************</div></div></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>