From 410a77b71b3fa0de76b6ca04ce42f8d85007d1f8 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Fri, 20 Aug 2021 13:41:49 +0200 Subject: [PATCH] Update/add grdlandmask parameters and aliases (#1423) Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> Co-authored-by: Dongdong Tian --- doc/api/index.rst | 2 +- pygmt/src/grdlandmask.py | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/doc/api/index.rst b/doc/api/index.rst index 3536e83f640..a9bec80af88 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -92,8 +92,8 @@ Operations on grids: grdcut grdfill grdfilter - grdlandmask grdgradient + grdlandmask grdsample grdtrack xyz2grd diff --git a/pygmt/src/grdlandmask.py b/pygmt/src/grdlandmask.py index 1da363dc2fe..8965d9d1a87 100644 --- a/pygmt/src/grdlandmask.py +++ b/pygmt/src/grdlandmask.py @@ -16,13 +16,17 @@ @fmt_docstring @use_alias( + A="area_thresh", + D="resolution", + E="bordervalues", G="outgrid", I="spacing", + N="maskvalues", R="region", V="verbose", r="registration", ) -@kwargs_to_strings(R="sequence") +@kwargs_to_strings(R="sequence", N="sequence", E="sequence") def grdlandmask(**kwargs): r""" Create a grid file with set values for land and water. @@ -45,6 +49,38 @@ def grdlandmask(**kwargs): in. {I} {R} + {A} + resolution : str + *res*\[\ **+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. + bordervalues : bool or str or float or list + 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 a list of 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 ``maskvalues`` 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]. + maskvalues : str or list + [*wet*, *dry*] or [*ocean*, *land*, *lake*, *island*, *pond*]. + Sets the values that will be assigned to nodes. Values can + be any number, including the textstring NaN + [Default is [0, 1, 0, 1, 0] (i.e., [0, 1])]. Also select + ``bordervalues`` to let nodes exactly on feature boundaries be + considered outside [Default is inside]. {V} {r}