[Thread Prev][Thread Next][Index]

Re: determine number of rows in an ascii file



Hi Steve,
You can use the @NGD transformation.  Replace

  let n=2

with

  let n = `ullat[i=@ngd]

and that should do the trick. 

Or, if ID is a sequence number, then you could set

   let n = `id[i=@max]`

Ansley

Steve Knox wrote:
Howdy,

How can FERRET  determine the number of  rows in an ascii data file?
I want to draw a box for each row in the data file. In my test I hard coded the repeat index as
n = 2. In general I don't know the number of rows in the ascii file.

 ! Solaris 5.8 - 06/25/04
 ! 31-Jan-05 08:57

! the ascii file is read
file/var="id,ullat,ullon,lrlat,lrlon"/skip=1 grid.dat
! some lat/lon corners for my box are set
let lat1=ullat
let lon1=ullon
let lat2=lrlat
let lon2=ullon
let lat3=ullat
let lon3=lrlon
let lat4=lrlat
let lon4=lrlon
! a dummy plot to set up
plot/axes=0,0,0,0/nolabels/vlimits=20:50/hlimits=-130:-60 ullat
! draw red boxes
let n=2
repeat/k=1:`n` go box lon1[i=`k`] lon3[i=`k`]  lat2[i=`k`] lat1[i=`k`] 2
! overlay with land boundaries
go land thick overlay black black
quit

The file grid.dat has two rows in this example (not including the header):
id      ullatitude      ullongitude     lrlatitude      lrlongitude
1       40      -105    39      -103
2       50      -105    35      -100

Thanks for any ideas.
-- 
  Steve Knox
  Natural Resource Ecology Laboratory
  Colorado State University
  Fort Collins, CO 80523-1499
  stevek@nrel.colostate.edu
  

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement