Question about readAsciiTable

From: Gina Henderson <ginah_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 24 2010 - 13:25:45 MDT

Hi there,

I am reading in ascii data but want to skip some header information.
Previously I used the following to read a file with no header information
and had no spaces so had to do some reformatting to read in correctly:

; The ascii data had no spaces so had to do some reformatting to read them
correctly
 zero_offset = charactertoshort(stringtocharacter("0"))

 data_character = asciiread("ims2008349_24km.asc" ,(/nrows,ncols+1/),
"character")
 data_string = charactertoshort(data_character(:,:ncols-1)) - zero_offset(0)
 delete(data_string@_FillValue)

I want to do the same thing to a file with 30 lines of header information
using readAsciiTable, so tried the following but got the error
"fatal:_NclBuildArray: each element of a literal array must have the same
dimension sizes, at least one item doesn't
fatal:Execute: Error occurred at or near line 8073 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl". I think this has to
do with the fact that I am reading the data in as type character, but don't
know how to get around it while dealing with the no spaces issue?

; The ascii data had no spaces so had to do some reformatting to read them
correctly
 zero_offset = charactertoshort(stringtocharacter("0"))

 nhead = 30 ; no. of header lines at the beginning of the file
 data_character = readAsciiTable("ims2008349_24km.asc" ,(/nrows,ncols+1/),
"character", nhead)
 data_string = charactertoshort(data_character(:,:ncols-1)) - zero_offset(0)
 delete(data_string@_FillValue)

Any suggestions would be greatly appreciated.
Thanks, Gina.

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 24 13:25:53 2010

This archive was generated by hypermail 2.1.8 : Wed Aug 25 2010 - 11:50:26 MDT