[Thread Prev][Thread Next][Index]

Re: grid



Hi Guillaume,
	For data in a netCDF file there is a nifty /order= option to
the "use" command that allows you to flip the data any way you like.
And of course its easy to convert gridded ascii data into netcdf
too using Ferret.

For example
> ferret
...
yes? sp echo "1 2 3 4" > testdata.ascii
yes? sp echo "11 12 13 14" >> testdata.ascii
yes? sp echo "21 22 23 24" >> testdata.ascii
yes? ! so now we have an ascii file of data on a 4x3 x,y grid
yes? ! lets read it in
yes? def axis/x=1:4:1 xax ; def axis/y=10:30:10 yax
yes? def grid/x=xax/y=yax grd
yes? file/form=free/col=4/g=grd/var=v testdata.ascii
yes? list v
              1      2      3      4    
              1      2      3      4
 10   / 1:   1.00   2.00   3.00   4.00
 20   / 2:  11.00  12.00  13.00  14.00
 30   / 3:  21.00  22.00  23.00  24.00

yes? ! now copy the data to a netcdf file
yes? save/file=testdata.cdf v
yes? ! and read it in again.  if the /order argument to "use" is not
yes? ! included the data will be exactly as before
yes? use testdata.cdf
yes? list v
              1      2      3      4    
              1      2      3      4
 10   / 1:   1.00   2.00   3.00   4.00
 20   / 2:  11.00  12.00  13.00  14.00
 30   / 3:  21.00  22.00  23.00  24.00

yes? ! but WITH the /order argument you can get what you want
yes? can data/all
yes? use/order=x-y testdata.cdf
yes? list v
              1      2      3      4    
              1      2      3      4
 10   / 1:  21.00  22.00  23.00  24.00
 20   / 2:  11.00  12.00  13.00  14.00
 30   / 3:   1.00   2.00   3.00   4.00

Note that you could flip left to right with /order=-xy or both with
/order=-x-y.  Unfortunately, although the ascii read has a /order
option, its purpose is to specify whether x or y is varying fastest
in the data file and it cannot do the flipping of axis direction
you need.

Apologies if this explanation is too verbose, but since until going
to the manual I didn't know how to do this, probably others in the
user community will benefit as I did.  Those Ferret guys are
devilishly clever and seem to have thought of most things. This
stuff is in the 5.22 documentation under Command qualifiers for 
SET  DATA_SET/FORMAT on the web at
ferret.wrc.noaa.gov/Ferret/Documentation/Users_Guide/current/fer_html.htm

Regards,
Mick

|--****--****-*---*---***--***--|____spillane@pmel.noaa.gov____|
|-*__---*-----*--*-*--*--*-*--*-|_SCIENCE APPLICATIONS SUPPORT_|
|--***--*-----*-*---*-***--***--|____EPIC/Ferret/PlotPlus______|
|-----*-*-----*-*****-*----*----|__Room 2070 Bldg#3 NOAA/PMEL__|
|-****---****-*-*---*-*----*----|____Phone_:_(206)526-6780_____|



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement