Re: Error with reading ascii

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 21 Mar 2008 22:02:51 -0600

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

   NROW = numAsciiRow("/project/cas/shea/erik.ascii")
   print("NROW="+NROW)

   a = asciiread ("/project/cas/shea/erik.ascii", -1, "float")
   print(a(0:25)) ; print 1st 26 numeric values to see file structure

   ncol = 3
   nrow = NROW-6 ; number of rows with data
   x = onedtond(a(12:), (/nrow,ncol/))
   LAT = x(:,0)
   LON = x(:,1)
   VAL = x(:,2)

Erik Noble wrote:
> Hi.
> I am receiving an error when trying to follow the example "Reading data that
> is a mix of alpha and numeric characters" at
> http://www.ncl.ucar.edu/Applications/ascii_multicol.shtml
> I am counting from "zero," for columns and rows.
> Confused.
> Thank you for all of your help.
> Sincerely,
> -Erik
>
> My Ascii file:
> Selected parameter: Daily TRMM 3B42(V6) Accumulated Rainfall
> Selected area: lat=[25S,35N], lon=[35W,35E]
> Selected time period: (01Aug2006-30Sep2006)
> Undefined/Missing Value: -9999
> Unit: (mm)
> Latitude Longitude AccRain
> -25.000 -35.000 151.6500
> -25.000 -34.500 217.4100
> -25.000 -34.000 221.4900
> -25.000 -33.500 193.1400
> .
> .
> .
>
> My NCL command line with fatal error:
> ncl 86> data = asciiread("./TRMM_SOP3_Daily_Rainfall.dat", -1, "string")
> ncl 87> cdata = stringtochar(data)
> ncl 88> printVarSummary(cdata)
>
>
> Variable: cdata
> Type: character
> Total Size: 1041148 bytes
> 1041148 values
> Number of Dimensions: 2
> Dimensions and sizes: [17068] x [61]
> Coordinates:
> ncl 89> lat = stringtofloat(charactertostring(cdata(6:,0:6)))
> fatal:A bad value was passed to stringtofloat, input strings must contain
> numeric digits, replacing with missing value
> ncl 90>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 21 2008 - 22:02:51 MDT

This archive was generated by hypermail 2.2.0 : Sun Mar 23 2008 - 15:01:36 MDT