Next: B.2.2 Gridline and Pixel Up: B.2 Grid files Previous: B.2 Grid files Contents Index

##
B.2.1 NetCDF files

By default, GMT stores 2-D grids as COARDS-compliant netCDF files. COARDS (which stands for Cooperative Ocean/Atmosphere Research Data Service) is a convention used by many agencies distributing gridded data for ocean and atmosphere research. Sticking to this convention allows GMT to read gridded data provided by other institutes and other programs. Conversely, other general domain programs will be able to read grids created by GMT. COARDS is a subset of a more extensive convention for netCDF data called CF-1.0 (Climate and Forecast, version 1.0). Hence, GMT grids are also automatically CF-1.0-compliant. However, since CF-1.0 has more general application than COARDS, not all CF-1.0 compliant netCDF files can be read by GMT.

The netCDF grid file in GMT has several attributes (See Table B.1) to describe the content. The routine that deals with netCDF grid files is sufficiently flexible so that grid files slightly deviating from the standards used by GMT can also be read.

Table: Attributes of default GMT grid file in COARDS-compliant netCDF format.

Attribute | Description
Global attributes
Conventions | COARDS, CF-1.0 (optional)
title | Title (optional)
source | How file was created (optional)
node_offset | 0 for gridline node registration (default), 1 for pixel registration
- and -variable attributes
long_name | Coordinate name (default: ``Longitude'' and ``Latitude'')
units | Unit of the coordinate (default: ``degrees_east'' and ``degrees_north'')
actual_range | Minimum and maximum and of region; if absent
(or valid_range) | the first and last - and -values are queried
-variable attributes
long_name | Name of the variable (default: ``z'')
units | Unit of the variable (no default)
scale_factor | Factor to multiply with (default: 1)
add_offset | Offset to add to scaled (default: 0)
actual_range | Minimum and maximum (optional)
_FillValue | Value associated with missing data points; if absent an
(or missing_value) | appropriate default value is assumed, depending on data type.

By default, the first 2-dimensional variable in a netCDF file will by read as the variable and the coordinate axes and will be determined from the dimensions of the variable. GMT will recognize whether the (latitude) variable increases or decreases. Both forms of data storage are handled appropriately.

For more information on the use of COARDS-compliant netCDF files, and on how to load multi-dimensional grids, read Section 4.18.

GMT also allows other formats to be read. In addition to the default netCDF format it can use binary floating points, short integers, bytes, and bits, as well as 8-bit Sun raster files (colormap ignored). Additional formats may be used by supplying read/write functions and linking these with the GMT libraries. The source file gmt_customio.c has the information that programmers will need to augment GMT to read custom grid files. We anticipate that the number of pre-programmed formats will increase as enterprising users implement what they need. See Section 4.17 for more information.

Next: B.2.2 Gridline and Pixel Up: B.2 Grid files Previous: B.2 Grid files Contents Index