Linux & Mac OS X 27 Jun 2008 07:43 pm

Loading a binary file in Ferret

Playing around a bit more with Ferret, one of the things that I wanted to do was to load a binary flat file of pixels where each pixel represents the area of 0.1 x 0.1 degree which of course changes with longitude and latitude.

To do this I wrote out data as a real*4 floating point number in one column running up from south to north then west to east. This is equivalent to the GMT command

grd2xyz -R159.9/230/12.4/32.5 -ZBLf area.grd

where the grid spacing is x = 0.1 and y = 0.1

To load this into Ferret (on a linux system):

DEFINE AXIS/X=160:230:0.1 x10
DEFINE AXIS/Y=12.5:32.5:0.1 y10
DEFINE GRID/X=x10/Y=y10 g10
FILE/VAR=MYVAR/GRID=g10/FORMAT=stream area.bin
shade MYVAR # To view

the only difference on the Mac was that I had to byte swap, which is done with a /swap qualifier on the loading line:

FILE/VAR=MYVAR/GRID=g10/FORMAT=stream/swap area.bin

Blogged with the Flock Browser

Tags:

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply

You must be logged in to post a comment.


Creative Commons License
This work is licensed under a Creative Commons Attribution 2.5 License.