File Exchange

image thumbnail

grdwrite2

version 1.1 (2.69 KB) by

Uses built-in netCDF capability to write a grid file to be read by GMT (Generic Mapping Tools).

7 Downloads

Updated

View License

GRDWRITE2(X,Y,Z,'file.grd') will create a grid file containing the data in the matrix Z. X and Y should be either vectors with dimensions that match the size of Z or two-component vectors containing the max and min values for each. The file will be a COARDS-compliant NetCDF file, the standard format for GMT version 4 and later.

Based on the compiled mexfile-based function grdwrite, part of the GMT supplemental packages.

For more information on GMT grid file formats, see:
http://www.soest.hawaii.edu/gmt/gmt/doc/gmt/html/GMT_Docs/node70.html

GMT (Generic Mapping Tools) was developed by Paul Wessel and Walter H. F. Smith (http://gmt.soest.hawaii.edu)

See also GRDREAD2, GRDINFO2

Comments and Ratings (2)

Donglai Gong

Need to update netcdf.create line in grdwrite2.m to work with R2010b. (i.e. the mode should be 'NC_SHARE' instead of 'NC_WRITE'). Otherwise work as advertised. Thanks!

Updates

1.1

Change netcdf.create to use NC_SHARE option

MATLAB Release
MATLAB 7.9 (R2009b)
Acknowledgements

Inspired by: grdread2

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video