[Thread Prev][Thread Next][Index]

Re: Reverse data

On Feb 4,  5:08pm, beland@CERCA.umontreal.CA wrote:
> Subject: Reverse data
> Hello all,
> I am trying to plot a 2-d field on the globe.  The data is written in a
> Fortran unformatted file.  I read it with the following:
> define axis/x=0:357.5:2.5/unit=degrees x144
> define axis/y=90S:90N:2.5/unit=degrees y73
> define grid/x=x144/y=y73 g144x73
> file /var=precip/grid=g144x73/format=UNFORMATTED/COLUMNS=`144*73`
> ppl shakey 1,1,0,0,-3
> fill /line/key/title="Total Precipitation (mm)"/i=1:144/j=1:73 precip
> The problem is that the output is upside down, since the data is stored
> from North to South instead of from South to North.  How can I tell
> ferret to reverse the data and only the data (not the axes) ?  I know I
> could write a Fortran program, but I thought that ferret ought to be
> able to do this.


Hi Michel,

Here's what you have to do (for now):

i. yes? SAVE/file=precip79.cdf precip

ii. exit ferret

iii. ncdump precip79.cdf > precip79.cdl

iv. edit the precip79.cdl file to **reverse the order of the points on the Y
coordinate axis**. Let Ferret help: cut and paste the output of
    yes? list/y=90s:90n/format=(10(F6.1,","))/order=y -1*y[gy=y73]

v. ncgen -o precip79_reversed.cdf precip79.cdl

vi. yes? use precip79_reversed

Ferret is capable of reversing data that it reads from a NetCDF file, although
it is not presently capable of doing the same from an ASCII or binary file.

	cheers - steve

PS: We will be adding a "@REV" (reversal) transform in a near future version
that will make solving this problem much simpler.


		|  NOAA/PMEL               |  ph. (206) 526-6080  
Steve Hankin	|  7600 Sand Point Way NE  |  FAX (206) 526-6744
		|  Seattle, WA 98115-0070  |  hankin@pmel.noaa.gov

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement