<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},{preL:preH},{com_lat},{com_lon})</div><div>varh1 = f->SwdelQw_waves(:,{lagn:lagp},{com_lev},{latS:latN},{lonE: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>;**********************************************************</div><div>; Script</div><div>;**********************************************************</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_lev+thold+".nc"</div><div>pathino = "/typhoon/jorussel/basic_vars/"</div><div>fileino = "pvw_"+com_lat+com_lon+com_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},{preL:preH},{com_lat},{com_lon})</div><div>varh1 = f->SwdelQw_waves(:,{lagn:lagp},{com_lev},{latS:latN},{lonE: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>;**********************************************************</div><div>; End Script</div><div>;********************************************************</div></div><div><br></div><div><div>;**********************************************************</div><div>; ncl_filedump of file</div><div>;********************************************************</div></div><div><br></div><div><div class="gmail_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">        </span>SwQw_1133650-1</div><div dir="ltr">path:<span style="white-space:pre">        </span>/typhoon/jorussel/pvbud/SwQw_1133650-1.nc</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">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">        </span>-2147483647</div><div dir="ltr"> long_name :<span style="white-space:pre">        </span>time</div><div dir="ltr"> units :<span style="white-space:pre">        </span>YYYYMMDDHH</div><div dir="ltr"><br></div><div dir="ltr"> integer lag ( lag )</div><div dir="ltr"> units :<span style="white-space:pre">        </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">        </span>isobaric level</div><div dir="ltr"> units :<span style="white-space:pre">        </span>hPa</div><div dir="ltr"><br></div><div dir="ltr"> float lat ( lat )</div><div dir="ltr"> La1 :<span style="white-space:pre">        </span>89.463</div><div dir="ltr"> Lo1 :<span style="white-space:pre">        </span> 0</div><div dir="ltr"> La2 :<span style="white-space:pre">        </span>-89.463</div><div dir="ltr"> Lo2 :<span style="white-space:pre">        </span>359.297</div><div dir="ltr"> Di :<span style="white-space:pre">        </span>0.7031252</div><div dir="ltr"> N :<span style="white-space:pre">        </span>128</div><div dir="ltr"> units :<span style="white-space:pre">        </span>degrees_north</div><div dir="ltr"> GridType :<span style="white-space:pre">        </span>Gaussian Latitude/Longitude Grid</div><div dir="ltr"> long_name :<span style="white-space:pre">        </span>latitude</div><div dir="ltr"><br></div><div dir="ltr"> float lon ( lon )</div><div dir="ltr"> La1 :<span style="white-space:pre">        </span>89.463</div><div dir="ltr"> Lo1 :<span style="white-space:pre">        </span> 0</div><div dir="ltr"> La2 :<span style="white-space:pre">        </span>-89.463</div><div dir="ltr"> Lo2 :<span style="white-space:pre">        </span>359.297</div><div dir="ltr"> Di :<span style="white-space:pre">        </span>0.7031252</div><div dir="ltr"> N :<span style="white-space:pre">        </span>128</div><div dir="ltr"> units :<span style="white-space:pre">        </span>degrees_east</div><div dir="ltr"> GridType :<span style="white-space:pre">        </span>Gaussian Latitude/Longitude Grid</div><div dir="ltr"> long_name :<span style="white-space:pre">        </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">        </span>none</div><div dir="ltr"> depth :<span style="white-space:pre">        </span>( -2147483647, -2147483647 )</div><div dir="ltr"> period :<span style="white-space:pre">        </span>( 2, 10 )</div><div dir="ltr"> wavenumber :<span style="white-space:pre">        </span>( -40, -10 )</div><div dir="ltr"> lat :<span style="white-space:pre">        </span>44.56129</div><div dir="ltr"> lev :<span style="white-space:pre">        </span>1000</div><div dir="ltr"> description :<span style="white-space:pre">        </span>zetax = -dvdp</div><div dir="ltr"> lonFlip :<span style="white-space:pre">        </span>longitude coordinate variable has been reordered via lonFlip</div><div dir="ltr"> initial_time :<span style="white-space:pre">        </span>10/31/2015 (18:00)</div><div dir="ltr"> forecast_time_units :<span style="white-space:pre">        </span>hours</div><div dir="ltr"> forecast_time :<span style="white-space:pre">        </span>0</div><div dir="ltr"> parameter_number :<span style="white-space:pre">        </span>132</div><div dir="ltr"> parameter_table_version :<span style="white-space:pre">        </span>128</div><div dir="ltr"> gds_grid_type :<span style="white-space:pre">        </span>4</div><div dir="ltr"> level_indicator :<span style="white-space:pre">        </span>100</div><div dir="ltr"> units :<span style="white-space:pre">        </span>/s</div><div dir="ltr"> long_name :<span style="white-space:pre">        </span>-grav*(zetaxw*dqw/dx + zetayw*dqw/dy)</div><div dir="ltr"> center :<span style="white-space:pre">        </span>European Center for Medium-Range Weather Forecasts (RSMC)</div><div dir="ltr"> _FillValue :<span style="white-space:pre">        </span>1e+20</div><div dir="ltr"><br></div><div dir="ltr"><div>;**********************************************************</div><div>; End ncl_filedump</div><div>;********************************************************</div><div><br></div><div><div>;**********************************************************</div><div>; printVarSummary of variable after read in and error comes up</div><div>;********************************************************</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">        </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">        </span>33.04689</div><div> waveName :<span style="white-space:pre">        </span>none</div><div> depth :<span style="white-space:pre">        </span>( -2147483647, -2147483647 )</div><div> period :<span style="white-space:pre">        </span>( 2, 10 )</div><div> wavenumber :<span style="white-space:pre">        </span>( -40, -10 )</div><div> lat :<span style="white-space:pre">        </span>44.56129</div><div> lev :<span style="white-space:pre">        </span>1000</div><div> description :<span style="white-space:pre">        </span>zetax = -dvdp</div><div> lonFlip :<span style="white-space:pre">        </span>longitude coordinate variable has been reordered via lonFlip</div><div> initial_time :<span style="white-space:pre">        </span>10/31/2015 (18:00)</div><div> forecast_time_units :<span style="white-space:pre">        </span>hours</div><div> forecast_time :<span style="white-space:pre">        </span>0</div><div> parameter_number :<span style="white-space:pre">        </span>132</div><div> parameter_table_version :<span style="white-space:pre">        </span>128</div><div> gds_grid_type :<span style="white-space:pre">        </span>4</div><div> level_indicator :<span style="white-space:pre">        </span>100</div><div> units :<span style="white-space:pre">        </span>/s</div><div> long_name :<span style="white-space:pre">        </span>-grav*(zetaxw*dqw/dx + zetayw*dqw/dy)</div><div> center :<span style="white-space:pre">        </span>European Center for Medium-Range Weather Forecasts (RSMC)</div><div> _FillValue :<span style="white-space:pre">        </span>1e+20</div></div><div><br></div><div><div>;**********************************************************</div><div>; end printVarSummary()</div><div>;********************************************************</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>