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
Received on Tue Jun 20 2006 - 10:58:52 MDT
This archive was generated by hypermail 2.2.0 : Wed Jun 21 2006 - 17:13:25 MDT