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

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Oct 31 2011 - 11:00:01 MDT

This message was already responded to by Dave A and Dennis, but I wanted to add some basic information for other people reading ASCII files.

Generally, if you have the same number of values on each line, but of different types, separated by some consistent delimiter, like a space, comma, or tab, then
you would use str_get_field to read in the various fields you want.

For example, the small text file below would be a good candidate for str_get_field and using "," as your delimiter (since the space is not used consistently):

-999, 1, 2, 3, 4, 5
1, bb, 3, -999, 4 5
-999, -999, -999, -999,-999, -999,
1,2,3,4,5, -999

If you do not have the same number of data values on each line, but your data is columnar, then use str_get_cols to indicate the start and end
column for each value. This is what Dennis did in the example he attached.

Here's an example of a small data set where str_get_cols would work, but str_get_field wouldn't:

  0 1 2 2 3 4 5
  1 2 3 4 5

  1 2 3 4 5

  0 4 5 6 7

Note that your L3 dataset was more complicated than either of the above, since you sort of had columnar data, but it was mixed with
non-columnar data.

--Mary

On Oct 28, 2011, at 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>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Oct 31 11:00:08 2011

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