[Thread Prev][Thread Next][Index]

ASCII file input



I have a question about reading ASCII files in Ferret: 
is there a way to read an ASCII file in parts using the FILE 
or some other command?  This would enable a Ferret script to
read and use background data before generating a display.

I am currently running Ferret 4.11, and reading a file of the form

 76 85
   -10.492  -42.000  -30.310     .499     .451     .740    3.892
   -10.836  -41.000  -30.680     .501     .442     .744    3.892
   -11.172  -40.000  -31.041     .503     .433     .748    3.892
     .
     .
     .

The first entry is the row and column breakdown of the following
data: 76 rows, 85 columns.  The data is for a 3D plot.

I am using a command of the form

	file/variable="x,y,z,a,b,c,d"/skip=1 ref3d.plt
	
which skips the first line and then reads the file data into variables
x,y,z,a,b,c,d.  

As I understand Ferret, it is necessary to define a grid for the data 
before generating a plot.  All of the Ferret ASCII file plotting examples
I have seen have the data grid dimensions built into the script, such as:

	DEFINE AXIS/X=1:85:1 xrows
	DEFINE AXIS/Y=1:76:1 yrows
	DEFINE GRID/X=xrows/Y=yrows gdata
	FILE/VAR="x,y,z,a,b,c,d"/GRID=gdata/skip=1 ref3d.plt
	
which defines a grid for the ASCII data before reading it.

What I would like to do is to read the X and Y grid values from
the file instead of hardcoding them so that I can define a grid 
based on their current values.  This would be something like: 

	DEFINE AXIS/X=1:XDELTA:1 xrows
	DEFINE AXIS/Y=1:YDELTA:1 yrows
	DEFINE GRID/X=xrows/Y=yrows gdata
	FILE/VAR="x,y,z,a,b,c,d"/GRID=gdata ref3d.plt
	
where the values of XDELTA and YDELTA have been defined previously
from data in the file.

Or maybe the grid could be established after the ASCII file is 
read, if there is a way to set up the FILE (or some other) command
to read the first line in one format and the next lines in
another?

Is there a way to do this in Ferret 4.11, or perhaps in a later
version that I can download?  I have looked at the latest on-line
Ferret manual, and there doesn't seem to have been any changes
in ASCII file input.

One alternative would be to create a "front end" program that
reads the ASCII file and generates a netCDF database containing
the required data.

I would appreciate any opinions as to whether an ASCII file can
be read in the desired manner, or if we would be better off using
a netCDF front end.

Thanks,
Kim Rudeen



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / ERL / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement