[ncl-talk] Subscript out of range, error in subscript #0

Ajay Bankar ajaybankar123 at gmail.com
Wed May 22 00:13:34 MDT 2019


Hi all,
      I'm running following ncl script to read and write some parameters
from AIRS datasets in csv file. I'm trying to read data for particular
region from all (27) files. Every file having different number of lat and
lon. If I run the following script I'm getting an error :



*fatal:ind_resolve: One of the input indices is invalid; will return a
missing valuefatal:Subscript out of range, error in subscript #0fatal:An
error occurred reading latfatal:["Execute.c":8637]:Execute: Error occurred
at or near line 41 in file airs2.ncl*

This is the line where it's giving an error :LAT :=
lat(ilat1:ilat2,ilon1:ilon2)
It's printing number of lats, lons, min and max for first 6 files and after
that I'm getting this error.

The ncl script I used is as below :

begin

 files = systemfunc ("ls /scratch/DATASETS/AIRS/*.hdf")
 filein = addfiles (files+".he2","r")

 do nf = 0, ListCount(filein)-1
 ;print(filein)
 lat = filein[nf]->Latitude_L2_Support_atmospheric_surface_product
 lon = filein[nf] ->Longitude_L2_Support_atmospheric_surface_product
 TAir = filein[nf] ->TAirSup_L2_Support_atmospheric_surface_product
 TAir_QC = filein[nf] ->TAirSup_QC_L2_Support_atmospheric_surface_product
 H2OMMRLEV = filein[nf]
->H2OMMRLevSup_L2_Support_atmospheric_surface_product
 H2OMMRLEV_QC = filein[nf]
->H2OMMRLevSup_QC_L2_Support_atmospheric_surface_product

printMinMax(lat, 0)
printMinMax(lon, 0)
latS := 5.0
latN := 40.0
lonW := 62.0
lonE := 100.0


ij := region_ind (lat,lon,latS,latN, lonW,lonE )

ilat1 := ij(0)
ilat2 := ij(1)
ilon1 := ij(2)
ilon2 := ij(3)

;print(ij)
LAT := lat(ilat1:ilat2,ilon1:ilon2)
LON := lon(ilat1:ilat2,ilon1:ilon2)

print("# of valid latitude values       =" +num(.not.ismissing(LAT)))
print("# of missing latitude values     =" +num(ismissing(LAT)))
print("# of valid longitude values      =" +num(.not.ismissing(LON)))
print("# of missing longitude values    =" +num(ismissing(LON)))
printMinMax(LAT,0)
printMinMax(LON, 0)

end

Thanks in advance for any help !

-- 

*Thanks & Regards,*

*Ajay *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190522/a03b8654/attachment.html>


More information about the ncl-talk mailing list