[ncl-talk] Subscript out of range, error in subscript #0
Barry Lynn
barry.h.lynn at gmail.com
Wed May 22 01:04:30 MDT 2019
Hello:
Have you looked for missing values.
You can do a check this way:
check = ismiissing (variable)
If it returns "True," then you'll get that error.
Barry
On Wed, May 22, 2019 at 9:08 AM Ajay Bankar <ajaybankar123 at gmail.com> wrote:
> 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 *
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
--
Barry H. Lynn, Ph.D
Senior Associate Scientist, Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581
C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190522/ce80123f/attachment.html>
More information about the ncl-talk
mailing list