[Thread Prev][Thread Next][Index]

Re: How to customize the ascii output format?

Hi Ding,
I see there is a parallel discussion on this topic in the LAS users list;
one solution is to use the customization options ther.  One could also
use tools like perl to read and reformat the headers after Ferret lists
the data.  These could be called from a Ferret script with spawn

In Ferret, you can certainly output the ASCII data without a header,
with the LIST/NOHEADER qualifier. A different header is written with
LIST/HEADING=ENHANCED.  Ferret does not have much ability
to customize the header beyond that. You could make your own header
with a set of SPAWN commands, with or without the automatically-
generated header.

yes? SPAWN echo "first header line" > a.dat
yes? SPAWN echo "second header line" >> a.dat
yes? LIST/APPEND?FILE=a.dat   var

We might think of adding qualifiers LIST/PRE=   and LIST/COMMENT=
to let the user add text before and after the Ferret header; these could
be called with /NOHEADER to write an entirely  custom header.


Ansley Manke

Chi Ding wrote:

Hi everybody
I'm using ferret to extract ascii data out of my netcdf file
upon x/y/z/t selected by users.
The ferret statements are like
REPEAT/l=($lmin):($lmax):`lchunk` REPEAT/k=($kmin):($kmax):`kchunk` REPEAT/j=($jmin):($jmax):`jchunk` (list/append/file($format)/j=`j`:`jtop`/k=`k`:`ktop`/l=`l`:`ltop` ($theVar); CANC MEM/ALL)
And the output format is like
FILENAME : sb3.nc
FILEPATH : /home/local/ferret/go/
BAD FLAG : -99999.00 SUBSET : 145 points (TIME)
Z (meters): 0
coordinates 30W 28-SEP-2003 00 6.919
28-SEP-2003 01 7.104
28-SEP-2003 02 7.295
28-SEP-2003 03 7.928
28-SEP-2003 04 7.701
28-SEP-2003 05 8.061
28-SEP-2003 06 7.856
28-SEP-2003 07 8.169
28-SEP-2003 08 8.586
28-SEP-2003 09 8.416
28-SEP-2003 10 9.327
28-SEP-2003 11 8.478
28-SEP-2003 12 9.028
28-SEP-2003 13 8.879
28-SEP-2003 14 9.013

I need to modify the output format 1) customize the header, get rid of the Z(meters) information
2) add some customized words into the header
3) list the dat using the following format, ideally tab seperated
Day.Hour(local) Year_Day Wind_Speed(m/sec) Wind_Direction(deg)
9/25/03 0:00 131.23 4.2 32
9/25/03 1:00 131.27 3.8 30
My questions is
1) is ferret powerful enough to generate the output I want?
2) Right now I'm using a Matlab toolbox to work
on the netcdf file. Any netcdf tool is able to generate the output or extract pure ascii data
without the header information?

Any information will be highly appreciated.
Cheers, Ding

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement