[Thread Prev][Thread Next][Index]

Re: reading NetCDF output files from GMT



Hi Liz,

It turns out that GMT's use of NetCDF is a bit odd in the sense that 2d
grid information is stored in a 1D array ("surface"). Thus the file is
not fully self-documenting.

The Ferret (V4.91) function RESHAPE can be used to reshape the 1d array
into a 2d grid (First define the axes using the "X_range", "Y_range"
information and the DEFINE AXIS command).

 yes? show func reshape
 RESHAPE(A,B)
    reshape A to grid of B
    A: data to be reshaped
    B: destination grid

However, V4.91 cannot read a variable named "Z" -- that is a reserved
name. Two solutions to this:

1) use ncdump/ncgen to change the variable name "Z" to (say) "surf":

	ncdump gmt_file.nc | sed s/Z/surf/ | ncgen -o gmt_fixed.nc

or

2) We can give you a BETA version of Ferret that supports more gen'l 
variable names by enclosing the "special" name in quotation marks.


	- steve

========================================
	

Liz Dobbins wrote:
> 
> Hi all,
> 
> I've been playing with generic mapping tools (GMT) trying to create a
> gridded bathymetic data set.  I've had partial success, but cannot read
> the new grid into ferret.  GMT outputs data in a NetCDF format which I
> thought was self-descriptive, but ferret doesn't seems to be getting
> enought information about the grid.
> 
> Has anyone been able to read NetCDF files output from GMT into ferret?
> Alternatively, is there a way to define the grid before I 'use' the
> NetCDF file, like I would do to read in an ASCII file.
> 
> --------------
> Here's the error message I get:
> 
> yes? use data.grd
> yes? sho data
>      currently SET data sets:
>     1> ./data.grd  (default)
>  name     title                             I         J
> K         L
>  X_RANGE                                   1:2       1:1       1:1
> 1:1
>  Y_RANGE                                   1:2       1:1       1:1
> 1:1
>  Z_RANGE                                   1:2       1:1       1:1
> 1:1
>  SPACING                                   1:2       1:1       1:1
> 1:1
>  DIMENSION
>                                            1:2       1:1       1:1
> 1:1
>  Z        surface                          1:1519    1:1       1:1
> 1:1
> 
> yes? list Z
>  **ERROR: dimensions improperly specified: Z
> --
> 
> Thanks in advance,
> Liz
> 
> *********************
> Elizabeth L. Dobbins
> Research Scientist
> JISAO/PMEL
> phone: (206) 526-4581
> 
> "Keeping your eyelids closed, turn your face towards the sun
>  or lamp, and move your head slowly from side to side, up and
>  down, in diagonals, in circles.  Feel the light warming your
>  eyes, loosening your muscles.  Breathe."
>       -- Computer User's Survival Guide

-- 

                |  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