[ncl-talk] ncl fatal:Subscript out of range, error in subscript #0
James Russell
jorussel at ncsu.edu
Wed Jun 14 10:46:40 MDT 2017
Hi all,
I'm getting the following error message when I run a script to read some
netcdf files that I wrote from another script:
ncl fatal:Subscript out of range, error in subscript #0
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.
The error comes up twice after the following two lines in the script:
var1 = f->SwdelQw_waves(:,{lagn:lagp},{preL:preH},{com_lat},{com_lon})
varh1 = f->SwdelQw_waves(:,{lagn:lagp},{com_lev},{latS:latN},{lonE:lonW})
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.
Thanks in advance,
James
See below for the script, an ncl_filedump of the file being read, and a
printVarSummary after the error comes up.
I'm running the script using a shell script:
ncl clat=\"{$clat}\" clon=\"{$clon}\" clev=\"{$clev}\" tho=\"{$tho}\"
plot_panelxs_SwQw.ncl
Here's the script:
;**********************************************************
; Script
;**********************************************************
com_lat = tofloat(clat)
com_lon = tofloat(clon)
com_lev = tofloat(clev)
thold = tofloat(tho)
; Domain and first and last points on cross-section
preL = 1000.
preH = 150.
lagn = -60
lagp = 60
latS = com_lat-15
latN = com_lat+15
lonW = com_lon-20
lonE = com_lon+20
; Data in
pathin = "/typhoon/jorussel/pvbud/"
filein = "SwQw_"+com_lat+com_lon+com_lev+thold+".nc"
pathino = "/typhoon/jorussel/basic_vars/"
fileino = "pvw_"+com_lat+com_lon+com_lev+thold+".nc"
print("Opening file and reading variable data")
f = addfile(pathin+filein,"r")
var1 = f->SwdelQw_waves(:,{lagn:lagp},{preL:preH},{com_lat},{com_lon})
varh1 = f->SwdelQw_waves(:,{lagn:lagp},{com_lev},{latS:latN},{lonE:lonW})
var1 = var1*(10^6)*6*60*60
varh1= varh1*(10^6)*6*60*60
;**********************************************************
; End Script
;********************************************************
;**********************************************************
; ncl_filedump of file
;********************************************************
Variable: f
Type: file
filename: SwQw_1133650-1
path: /typhoon/jorussel/pvbud/SwQw_1133650-1.nc
file global attributes:
creation_date : Tue Jun 13 11:36:22 EDT 2017
Conventions : None
source_file : original-file.nc
title : NCL Efficient Approach to netCDF Creation
dimensions:
wave = 411
lag = 21
lev = 27
lat = 57
lon = 85
variables:
integer wave ( wave )
_FillValue : -2147483647
long_name : time
units : YYYYMMDDHH
integer lag ( lag )
units : Hours
integer lev ( lev )
long_name : isobaric level
units : hPa
float lat ( lat )
La1 : 89.463
Lo1 : 0
La2 : -89.463
Lo2 : 359.297
Di : 0.7031252
N : 128
units : degrees_north
GridType : Gaussian Latitude/Longitude Grid
long_name : latitude
float lon ( lon )
La1 : 89.463
Lo1 : 0
La2 : -89.463
Lo2 : 359.297
Di : 0.7031252
N : 128
units : degrees_east
GridType : Gaussian Latitude/Longitude Grid
long_name : longitude
float SwdelQw_waves ( wave, lag, lev, lat, lon )
waveName : none
depth : ( -2147483647, -2147483647 )
period : ( 2, 10 )
wavenumber : ( -40, -10 )
lat : 44.56129
lev : 1000
description : zetax = -dvdp
lonFlip : longitude coordinate variable has been reordered via
lonFlip
initial_time : 10/31/2015 (18:00)
forecast_time_units : hours
forecast_time : 0
parameter_number : 132
parameter_table_version : 128
gds_grid_type : 4
level_indicator : 100
units : /s
long_name : -grav*(zetaxw*dqw/dx + zetayw*dqw/dy)
center : European Center for Medium-Range Weather Forecasts (RSMC)
_FillValue : 1e+20
;**********************************************************
; End ncl_filedump
;********************************************************
;**********************************************************
; printVarSummary of variable after read in and error comes up
;********************************************************
Variable: var1
Type: float
Total Size: 863100 bytes
215775 values
Number of Dimensions: 3
Dimensions and sizes: [wave | 411] x [lag | 21] x [lev | 25]
Coordinates:
wave: [1..411]
lag: [-60..60]
lev: [1000..150]
Number Of Attributes: 20
lon : 33.04689
waveName : none
depth : ( -2147483647, -2147483647 )
period : ( 2, 10 )
wavenumber : ( -40, -10 )
lat : 44.56129
lev : 1000
description : zetax = -dvdp
lonFlip : longitude coordinate variable has been reordered via lonFlip
initial_time : 10/31/2015 (18:00)
forecast_time_units : hours
forecast_time : 0
parameter_number : 132
parameter_table_version : 128
gds_grid_type : 4
level_indicator : 100
units : /s
long_name : -grav*(zetaxw*dqw/dx + zetayw*dqw/dy)
center : European Center for Medium-Range Weather Forecasts (RSMC)
_FillValue : 1e+20
;**********************************************************
; end printVarSummary()
;********************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170614/6942b4a2/attachment.html
More information about the ncl-talk
mailing list