Re: Reading ASCII Files With NCL

From: Jan Dutton (jfd AT XXXXXX)
Date: Tue Mar 19 2002 - 11:12:59 MST


Hi,

In this case, I would write a fortran routine to
read the data file and use NCL's fortran capabilities
to access the data from NCL.

See http://www.cgd.ucar.edu/csm/support/Document/pdf/fortran.pdf
if you are unfamiliar with how to do this.

I can send you an example as well if desired.

J

Russell Todd wrote:

> Hi All,
>
> I need some help reading an ASCII file with NCL. The file
> contains a mixture of text, floats, and times and has the
> following format:
>
> YY/MM/DD HH:MM HH.MM Kd Kn Max Ratio
> 01/08/12 00:00 0.00 547.5 439.3 528.9 1.04
> 01/08/12 00:05 0.08 414.2 321.6 517.5 0.80
> 01/08/12 00:10 0.17 562.6 445.5 494.5 1.14
> 01/08/12 00:15 0.25 426.3 338.7 482.7 0.88
> 01/08/12 00:20 0.33 486.2 382.8 470.9 1.03
> 01/08/12 00:25 0.42 480.9 383.2 459.0 1.05
> 01/08/12 00:30 0.50 339.6 262.6 434.8 0.78
> 01/08/12 00:35 0.58 382.8 296.0 422.6 0.91
> 01/08/12 00:40 0.67 360.7 284.4 410.3 0.88
> 01/08/12 00:45 0.75 308.9 237.7 397.9 0.78
> 01/08/12 00:50 0.83 407.4 314.5 372.8 1.09
> 01/08/12 00:55 0.92 357.3 275.9 360.2 0.99
> 01/08/12 01:00 1.00 249.2 187.5 347.5 0.72
> 01/08/12 01:05 1.08 242.9 182.8 334.7 0.73
> <rest of file deleted>
>
> I would like to skip the header and read each column into a
> vector of appropriate type. If I use the following command
>
> asciiread("datafile", -1, "string")
>
> each line is read in as a string. Is there a built-in NCL
> command that can parse each line and extract the different
> fields?I checked the NCL FAQ but the links to the two examples
> it cites are broken:
>
> http://www.cgd.ucar.edu/cas/ncl-csm/IO_asc2nc_1.shtml
> http://www.cgd.ucar.edu/cas/ncl-csm/IO_nc2asc_1.shtml
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Russ Todd
> MIT Lincoln Laboratory
> Lexington, MA

--
Jan F. Dutton, PhD MBA        434-295-9989
President                     801-457-0153 (efax)
Weather Ventures, Ltd         jfd AT weatherventures.com

P.O. Box 1851 Charlottesville, VA 22903 http://www.weatherventures.com



This archive was generated by hypermail 2b29 : Tue Mar 19 2002 - 14:26:13 MST