[Thread Prev][Thread Next][Index]
Re: reading ASCII data file
On Sun, 20 May 2001, Irina Marinov wrote:
> I have many ASCII data files which have a header of 8 lines, 3 columns of
> data and then some 8 lines of unwanted text. Is there any way to skip the
> 8 lines of text at the end ? The command
> set data/ez/skip=8/columns=3/var="depth,data,stdev" mydataset.dat
> doesn't work because I have those 8 lines of unwanted text at the end.
Hi Irina,
Here are two suggestions.
1) Define an input grid within Ferret:
yes? sp echo "let n =" \`wc mydataset.dat | awk '{print $1}'\` > tmp.jnl
yes? go tmp
yes? def axis/x=1:`n-16`:1 xax
yes? def grid/x=xax g
yes? set data/ez/skip=8/col=3/var="depth,data,stdev"/grid=g mydataset.dat
This method gives you explicit control over the grid that the data is
placed on -- you can change the "def axis" command to suit your needs.
- or -
2) Remove the offending lines outside of Ferret:
Save the following shell script as "cut_last":
# Shell script: cut_last
# Usage: cut_last nlines filename
set keep = `wc $2 | awk '{print $1}'`
@ keep = $keep - $1
head -n $keep $2 > $2.cut
Then at the shell prompt do
% chmod +x cut_last
% cut_last 8 mydataset.dat
This method lets you read the resulting "mydataset.dat.cut" using your
original idea. The results will be placed on Ferret's "EZ" grid.
Good luck!
Andrew
----------------------------------------------------------------------
Andrew Wittenberg Program in Atmospheric and Oceanic Sciences
andyw@splash.princeton.edu Princeton University
----------------------------------------------------------------------
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement