grdlandmask¶
Create a "wet-dry" mask grid from shoreline data base
Synopsis¶
gmt grdlandmask -Gmask_grd_file -Iincrement -Rregion [ -Amin_area[/min_level/max_level][+a[g|i][s|S]][+l|r][+ppercent] ] [ -Dresolution[+f] ] [ -E[bordervalues] ] [ -Nmaskvalues ] [ -V[level] ] [ -rreg ] [ -x[[-]n] ] [ --PAR=value ]
Note: No space is allowed between the option flag and the associated arguments.
Description¶
grdlandmask reads the selected shoreline database and uses that information to decide which nodes in the specified grid are over land or over water. The nodes defined by the selected region and lattice spacing will be set according to one of two criteria: (1) land vs water, or (2) the more detailed (hierarchical) ocean vs land vs lake vs island vs pond. The resulting mask may be used in subsequent operations involving grdmath to mask out data from land [or water] areas.
Required Arguments¶
- -Gmask_grd_file
Name of resulting output mask grid file. (See Grid File Formats).
- -Ixinc[+e|n][/yinc[+e|n]]
x_inc [and optionally y_inc] is the grid spacing. Geographical (degrees) coordinates: Optionally, append a increment unit. Choose among m to indicate arc minutes or s to indicate arc seconds. If one of the units e, f, k, M, n or u is appended instead, the increment is assumed to be given in meter, foot, km, Mile, nautical mile or US survey foot, respectively, and will be converted to the equivalent degrees longitude at the middle latitude of the region (the conversion depends on PROJ_ELLIPSOID). If y_inc is given but set to 0 it will be reset equal to x_inc; otherwise it will be converted to degrees latitude. All coordinates: If +e is appended then the corresponding max x (east) or y (north) may be slightly adjusted to fit exactly the given increment [by default the increment may be adjusted slightly to fit the given domain]. Finally, instead of giving an increment you may specify the number of nodes desired by appending +n to the supplied integer argument; the increment is then recalculated from the number of nodes, the registration, and the domain. The resulting increment value depends on whether you have selected a gridline-registered or pixel-registered grid; see GMT File Formats for details. Note: If -Rgrdfile is used then the grid spacing and the registration have already been initialized; use -I and -r to override these values.
- -Rwest/east/south/north[/zmin/zmax][+r][+uunit]
west, east, south, and north specify the region of interest, and you may specify them in decimal degrees or in [±]dd:mm[:ss.xxx][W|E|S|N] format Append +r if lower left and upper right map coordinates are given instead of w/e/s/n. The two shorthands -Rg and -Rd stand for global domain (0/360 and -180/+180 in longitude respectively, with -90/+90 in latitude). Set geographic regions by specifying ISO country codes from the Digital Chart of the World using -Rcode1,code2,…[+r|R[incs]] instead: Append one or more comma-separated countries using the 2-character ISO 3166-1 alpha-2 convention. To select a state of a country (if available), append .state, e.g, US.TX for Texas. To specify a whole continent, prepend = to any of the continent codes AF (Africa), AN (Antarctica), AS (Asia), EU (Europe), OC (Oceania), NA (North America), or SA (South America). Use +r to modify the bounding box coordinates from the polygon(s): Append inc, xinc/yinc, or winc/einc/sinc/ninc to adjust the region to be a multiple of these steps [no adjustment]. Alternatively, use +R to extend the region outward by adding these increments instead, or +e which is like +r but it ensures that the bounding box extends by at least 0.25 times the increment [no extension]. Alternatively for grid creation, give Rcodelon/lat/nx/ny, where code is a 2-character combination of L, C, R (for left, center, or right) and T, M, B for top, middle, or bottom. e.g., BL for lower left. This indicates which point on a rectangular region the lon/lat coordinate refers to, and the grid dimensions nx and ny with grid spacings via -I is used to create the corresponding region. Alternatively, specify the name of an existing grid file and the -R settings (and grid spacing and registration, if applicable) are copied from the grid. Appending +uunit expects projected (Cartesian) coordinates compatible with chosen -J and we inversely project to determine actual rectangular geographic region. For perspective view (-p), optionally append /zmin/zmax. In case of perspective view (-p), a z-range (zmin, zmax) can be appended to indicate the third dimension. This needs to be done only when using the -Jz option, not when using only the -p option. In the latter case a perspective view of the plane is plotted, with no third dimension.
Optional Arguments¶
- -Amin_area[/min_level/max_level][+a[g|i][s|S]][+l|r][+ppercent]
Features with an area smaller than min_area in km^2 or of hierarchical level that is lower than min_level or higher than max_level will not be plotted [Default is 0/0/4 (all features)]. Level 2 (lakes) contains regular lakes and wide river bodies which we normally include as lakes; append +r to just get river-lakes or +l to just get regular lakes. Append +ppercent to exclude polygons whose percentage area of the corresponding full-resolution feature is less than percent. Use +a to control special aspects of the Antarctica coastline: By default (or add i) we select the ice shelf boundary as the coastline for Antarctica; alternatively, add g to select the ice grounding line instead. For expert users who wish to utilize their own Antarctica (with islands) coastline you can add s to skip all GSHHG features below 60S. In contrast, you can add S to instead skip all features north of 60S. See GSHHG INFORMATION below for more details.
- -Dresolution[+f]
Selects the resolution of the data set to use ((f)ull, (h)igh, (i)ntermediate, (l)ow, or (c)rude). The resolution drops off by ~80% between data sets. [Default is l]. Append +f to automatically select a lower resolution should the one requested not be available [abort if not found]. Alternatively, choose (a)uto to automatically select the best resolution given the chosen region. Note that because the coastlines differ in details a node in a mask file using one resolution is not guaranteed to remain inside [or outside] when a different resolution is selected.
- -E[bordervalues]
Nodes that fall exactly on a polygon boundary should be considered to be outside the polygon [Default considers them to be inside]. Alternatively, append either the four values cborder/lborder/iborder/pborder or just the single value bordervalue (for the case when they should all be the same value). This turns on the line-tracking mode. Now, after setting the mask values specified via -N we trace the lines and change the node values for all cells traversed by a line to the corresponding border value. Here, cborder is used for cells traversed by the coastline, lborder for cells traversed by a lake outline, iborder for islands-in-lakes outlines, and pborder for ponds-in-islands-in-lakes outlines [Default is no line tracing].
- -Nmaskvalues
Sets the values that will be assigned to nodes. Values can be any number, including the textstring NaN. Also select -E to let nodes exactly on feature boundaries be considered outside [Default is inside]. Specify this information using 1 of 2 formats:
-Nwet/dry.
-Nocean/land/lake/island/pond.
[Default is 0/1/0/1/0 (i.e., 0/1)].
- -V[level]
Select verbosity level [w]. (See full description) (See cookbook information).
- -r[g|p] (more …)
Set node registration [gridline].
- -x[[-]n] (more …)
Limit number of cores used in multi-threaded algorithms (OpenMP required).
- -^ or just -
Print a short message about the syntax of the command, then exit (NOTE: on Windows just use -).
- -+ or just +
Print an extensive usage (help) message, including the explanation of any module-specific option (but not the GMT common options), then exit.
- -? or no arguments
Print a complete usage (help) message, including the explanation of all options, then exit.
- --PAR=value
Temporarily override a GMT default setting; repeatable. See gmt.conf for parameters.
Notes¶
A grid produced by grdlandmask is a categorical dataset. As such, one has to be careful not to interpolate it with standard methods, such as splines. However, if you make a map of this grid using a map projection the grid will be reprojected to yield a rectangular matrix in the projected coordinates. This interpolation is done using splines by default and thus may yield artifacts in your map. We recommend you use grdimage -nn to instead use a nearest neighbor interpolation for such cases.
Global Landmask Grids¶
Before you make your own masks, be aware that the GMT data server offers global landmask files in multiple grid resolutions. These can be accessed using the remote file names @earth_mask_rru[_reg], where rru and the optional reg indicate the resolution and registration that you desire. See Global Earth Mask Grids for more information on the availability of resolutions.
Examples¶
To set all nodes on land to NaN, and nodes over water to 1, using the high resolution data set, do
gmt grdlandmask -R-60/-40/-40/-30 -Dh -I5m -N1/NaN -Gland_mask.nc -V
To make a 1x1 degree global grid with the hierarchical levels of the nodes based on the low resolution data:
gmt grdlandmask -R0/360/-90/90 -Dl -I1 -N0/1/2/3/4 -Glevels.nc -V
GSHHG Information¶
The coastline database is GSHHG (formerly GSHHS) which is compiled from three sources: World Vector Shorelines (WVS, not including Antarctica), CIA World Data Bank II (WDBII), and Atlas of the Cryosphere (AC, for Antarctica only). Apart from Antarctica, all level-1 polygons (ocean-land boundary) are derived from the more accurate WVS while all higher level polygons (level 2-4, representing land/lake, lake/island-in-lake, and island-in-lake/lake-in-island-in-lake boundaries) are taken from WDBII. The Antarctica coastlines come in two flavors: ice-front or grounding line, selectable via the -A option. Much processing has taken place to convert WVS, WDBII, and AC data into usable form for GMT: assembling closed polygons from line segments, checking for duplicates, and correcting for crossings between polygons. The area of each polygon has been determined so that the user may choose not to draw features smaller than a minimum area (see -A); one may also limit the highest hierarchical level of polygons to be included (4 is the maximum). The 4 lower-resolution databases were derived from the full resolution database using the Douglas-Peucker line-simplification algorithm. The classification of rivers and borders follow that of the WDBII. See The Global Self-consistent, Hierarchical, High-resolution Geography Database (GSHHG) for further details.