gshhg to make an octave readable coastline file

Added by Clinton 9 months ago

I want to use gmt to define the coastline and bathymetry of a coastal region (Santa Barbara Channel) for use with a numerical model of the tides. I have compiled and installed gmt 6.0.0 with extensions, all the extensions seem to be there, and I have been able to run all the tutorial examples.

The only information I have found on using gshhg comes from the man page, where an example is given to make an octave readable coastline file:
gmt gshhg gshhs_i.b --IO_SEGMENT_MARKER=N > gshhs_i.txt

because of where things ended up during installation, and because unpacking gshhg gave only netcdf files, I modified the above command to:

/opt/gmt/bin/gmt gshhg ../gshhg-gmt-2.3.7/binned_GSHHS_i.nc --IO_SEGMENT_MARKER=N > gshhs_i.txt

this resulted in the following error
gshhg [ERROR]: NetCDF variable Id_of_parent_polygons has different dimension (41230) from others (1)

Can anyone tell me what I need to change? Also is it possible to get coastlines in a given area (say as defined by the -R argument)


Replies (2)

RE: gshhg to make an octave readable coastline file - Added by Paul 9 months ago

Can confirm I get the same error message and will have a look. Yes you can extract just an ascii file with coastline for a given area, e.g.,

gmt pscoast -R0/30/0/30 -M -W -Df > bay_of_guinea.txt

These are line segments, not polygons though.

RE: gshhg to make an octave readable coastline file - Added by Paul 9 months ago

Sorry, you tricked me by passing the wrong file. The gshhg module reads a binary polygon GSHHG file, not the netcdf segment files distributed with GMT. Unless you need closed polygons, just use pscoast and add the IO_SEGMENT_MARKER setting. If you do need polygons, use gshhg with the binary files from NEIC or http://www.soest.hawaii.edu/pwessel/gshhg.

(1-2/2)