Re: last line of the output of readAsciiTable

From: Hobbs, Will R (3244-Affiliate) <William.R.Hobbs_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 21 2012 - 16:40:48 MDT

The subscript in the final line should be 182, NOT 183, i.e.

ncl 42> print(dat(183,:))

NCL is based on fortran, and the first index of any array is 0, not 1, the second element has an index of 1, the third element has an index of 3, and so on.

Hence, the final element of an array, x, is dimsizes(x)-1, and NOT dimsizes(x).

See the section on standard subscripting in the NCL manual: http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#Subscripts

Will

**********************************************************
Will Hobbs, Ph.D. William.R.Hobbs@jpl.nasa.gov
Jet Propulsion Laboratory
4800 Oak Grove Dr. office: 300-324a
M/S 300-323 phone: (818) 354-0466
Pasadena, CA 91109 fax: (818) 354-0966
**********************************************************

From: ousmane ndiaye <ondiaye70@gmail.com<mailto:ondiaye70@gmail.com>>
Date: Wed, 21 Mar 2012 15:33:24 -0700
To: "ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>" <ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>>
Subject: last line of the output of readAsciiTable

I have problem with the last line of the output of readAsciiTable see below
==

dat=readAsciiTable("data2011.txt",ncols,"float",3);
ncl 41> printVarSummary(dat)

Variable: dat
Type: float
Total Size: 17568 bytes
            4392 values
Number of Dimensions: 2
Dimensions and sizes: [183] x [24]
Coordinates:
Number Of Attributes: 1
  _FillValue : 9.96921e+36
ncl 42> print(dat(183,:))
fatal:Subscript out of range, error in subscript #0
fatal:An error occurred reading dat
fatal:Execute: Error occurred at or near line 42

ncl 43>
===

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 21 16:41:11 2012

This archive was generated by hypermail 2.1.8 : Tue Mar 27 2012 - 08:50:24 MDT