Re: column extraction in NCL

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 06 2011 - 12:55:09 MDT

Maggie,

Please check out the str_get_field and str_get_cols functions, which allow you to extract data from a string array that you get if you use asciiread(filename,-1,string):

http://www.ncl.ucar.edu/Document/Functions/Built-in/str_get_cols.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/str_get_fields.shtml

Which function you use depends on whether your data is separated by delimiters, or lined up by columns.

We also have several examples of reading ASCII files:

http://www.ncl.ucar.edu/Applications/read_ascii.shtml

In particular, see the example for reading "asc4.txt". This file has integers that have commas in them, so we had to use "str_sub_str" to remove the commas. You could use this to replace the "NA" strings with a number.

--Mary

On Apr 6, 2011, at 4:45 AM, Maggie Wong wrote:

> Hi,
>
> I am using the command asciiread to access a file from unix which has 35 rows and 99 columns. I want to extract the fifth columns but I failed to do it. I am afraid there is a limitation for the dimension of the file. Also, some columns contain the word "NA", when I assign the columns like this, IN_value = IN_Array(:,2), it will automatically omit the column so it will extract the wrong column. What should I do?
>
> Thanks and regards,
> Maggie
> _______________________________________________
> 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 Wed Apr 6 12:55:14 2011

This archive was generated by hypermail 2.1.8 : Fri Apr 08 2011 - 09:34:26 MDT