Re: not sure which txt example to read a grided data set

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Sat Oct 29 2011 - 16:50:27 MDT

No example fits well. I would start by reading the whole file into
a simple string array, as seen in the example "string1.txt". Omit
the header lines with range subscripting, and delete a single
leading blank from each line with str_get_cols.

The tricky part is to reshape each group of 12 lines into one long
string for each latitude and 288 longitudes. I would use a single
do loop over latitudes. Then, for each block of 12 input lines, use
str_join with null string delimiter, or perhaps the + operator, to
make a single long string.

Then use str_split_by_length to break into strings of length 3.
Then use range subscripting to get only the first 288 substrings,
and discard the rest which contain the text label on the right side
of the 12th line. Convert the 288 substrings to integers with
string_to_integer. Store the 288 integers into your output array,
one row at a time. HTH.

--Dave

On 10/28/2011 10:39 PM, Rashed Mahmood wrote:
> Dear NCL folks
> I want to read in NCL one data set (monthly mean Aerosol Index from
> TOMS) which is in a txt file with 1.25/1 degree lon/lat spatial
> resolution.
> I know there are many txt file reading examples however, when
> I compare this data file with the examples I am uncertain which
> example would read the data set. The data file is attached herewith.
> Can anyone guide me please.
> Thanks alot
> Rashed
>
> L3_aiavg_n7t_197901.txt
>
>
> Month: January 1979 Archive v8 N7 TOMS AEROSOL INDEX
> Longitudes: 288 bins centered on 179.375 W to 179.375 E (1.25 degree steps)
> Latitudes : 180 bins centered on 89.5 S to 89.5 N (1.00 degree steps)
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999999999999999999999999999999999999999
> 999999999999999999999999999999999999999 lat = -89.5
> 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0
> 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
> 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 lat = -88.5
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

<snip>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Oct 29 16:50:44 2011

This archive was generated by hypermail 2.1.8 : Tue Nov 01 2011 - 13:43:04 MDT