Re: readAsciiHead

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 21 Jun 2006 12:33:45 -0600 (MDT)

FYI

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

Under File IO

Click: Parsing ascii files

D
========================================
>
>I solved the problem of reading a large ascii file in NCL
>using asciiread and systemfunc (grep, cut). It is a bit
>awkward but is able to read info from the data field and
>also the header even though the header is > 256 characters.
>
>Mike
>
>
>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>begin
>
>x=asciiread("usa_1_fixed.ascii",-1,"integer")
>elev=x(384:630)
>lat=x(631:877)
>lon=x(878:1124)
>data=x(1619:225066)
>years=ispan(1100,2000,1)
>width=new((/247,901/),integer)
>
>cnt=1
>do iy=0,900
> width(:,iy)=data(cnt:cnt+246)
> cnt=cnt+248
>end do
>
>species=new((/247/),string)
>cnt=2
>do i=0,246
> species(i)=systemfunc("grep Species usa_1_fixed.ascii | cut -f"+cnt
>+" ")
> cnt=cnt+1
>end do
>
>end
>
>_______________________________________________
>ncl-talk mailing list
>ncl-talk_at_ucar.edu
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jun 21 2006 - 12:33:45 MDT

This archive was generated by hypermail 2.2.0 : Wed Jun 21 2006 - 17:13:41 MDT