Skip to content

Commit 55ae6d9

Browse files
grdlandmask: Improve docstrings for parameters 'maskvalues' and 'bordervalues' (#3951)
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
1 parent 6496ccb commit 55ae6d9

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

pygmt/src/grdlandmask.py

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ def grdlandmask(outgrid: PathLike | None = None, **kwargs) -> xr.DataArray | Non
2828
r"""
2929
Create a "wet-dry" mask grid from shoreline database.
3030
31-
Read the selected shoreline database and create a grid to specify which
32-
nodes in the specified grid are over land or over water. The nodes defined
33-
by the selected region and lattice spacing
34-
will be set according to one of two criteria: (1) land vs water, or
35-
(2) the more detailed (hierarchical) ocean vs land vs lake
36-
vs island vs pond.
31+
Read the selected shoreline database and use that information to decide which nodes
32+
in the specified grid are over land or over water. The nodes defined by the selected
33+
region and lattice spacing will be set according to one of two criteria: (1) land vs
34+
water, or (2) the more detailed (hierarchical) ocean vs land vs lake vs island vs
35+
pond. A mask grid is created with the specified grid spacing.
3736
3837
Full option list at :gmt-docs:`grdlandmask.html`
3938
@@ -56,26 +55,29 @@ def grdlandmask(outgrid: PathLike | None = None, **kwargs) -> xr.DataArray | Non
5655
the coastlines differ in details a node in a mask file using one
5756
resolution is not guaranteed to remain inside [or outside] when a
5857
different resolution is selected.
59-
bordervalues : bool, str, float, or list
60-
Nodes that fall exactly on a polygon boundary should be
61-
considered to be outside the polygon [Default considers them to be
62-
inside]. Alternatively, append either a list of four values
63-
[*cborder*, *lborder*, *iborder*, *pborder*] or just the single value
64-
*bordervalue* (for the case when they should all be the same value).
65-
This turns on the line-tracking mode. Now, after setting the mask
66-
values specified via ``maskvalues`` we trace the lines and change the
67-
node values for all cells traversed by a line to the corresponding
68-
border value. Here, *cborder* is used for cells traversed by the
69-
coastline, *lborder* for cells traversed by a lake outline, *iborder*
70-
for islands-in-lakes outlines, and *pborder* for
71-
ponds-in-islands-in-lakes outlines [Default is no line tracing].
72-
maskvalues : str or list
73-
[*wet*, *dry*] or [*ocean*, *land*, *lake*, *island*, *pond*].
74-
Set the values that will be assigned to nodes. Values can
75-
be any number, including the textstring NaN
76-
[Default is [0, 1, 0, 1, 0] (i.e., [0, 1])]. Also select
77-
``bordervalues`` to let nodes exactly on feature boundaries be
78-
considered outside [Default is inside].
58+
maskvalues : list
59+
Set the values that will be assigned to nodes, in the form of [*wet*, *dry*], or
60+
[*ocean*, *land*, *lake*, *island*, *pond*]. Default is ``[0, 1, 0, 1, 0]``
61+
(i.e., ``[0, 1]``), meaning that all "wet" nodes will be assigned a value of 0
62+
and all "dry" nodes will be assigned a value of 1. Values can be any number, or
63+
one of ``None``, ``"NaN"``, and ``np.nan`` for setting nodes to NaN.
64+
65+
Use ``bordervalues`` to control how nodes on feature boundaries are handled.
66+
bordervalues : bool, float, or list
67+
Sets the behavior for nodes that fall exactly on a polygon boundary. Valid
68+
values are:
69+
70+
- ``False``: Treat boundary nodes as inside [Default]
71+
- ``True``: Treat boundary nodes as outside
72+
- A single value: Set all boundary nodes to the same value
73+
- A sequence of four values in the form of [*cborder*, *lborder*, *iborder*,
74+
*pborder*] to treat different kinds of boundary nodes as the specified values.
75+
*cborder* is for coastline, *lborder* for lake outline, *iborder* for
76+
islands-in-lakes outlines, and *pborder* for ponds-in-islands-in-lakes
77+
outlines.
78+
79+
Values can be any number, or one of ``None``, ``"NaN"``, and ``np.nan`` for
80+
setting nodes to NaN.
7981
{verbose}
8082
{registration}
8183
{cores}

0 commit comments

Comments
 (0)