Skip to content

Commit 1d8c0fd

Browse files
pygmt.select: Add aliases for "C", "F", and "L" (#2466)
Add aliases for pygmt.select. C -> dist2pt F -> polygon L -> dist2line * Use aliases from Julia wrapper * Add new aliases in overview list * Expand docstrings for 'dist2cpt', 'dist2line', 'polygon' * Add link to upstream GMT docs for 'multiple-segment file'
1 parent 3874b26 commit 1d8c0fd

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

pygmt/src/select.py

+41-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
@fmt_docstring
1818
@use_alias(
1919
A="area_thresh",
20+
C="dist2pt",
2021
D="resolution",
22+
F="polygon",
2123
G="gridmask",
2224
I="reverse",
2325
J="projection",
26+
L="dist2line",
2427
N="mask",
2528
R="region",
2629
V="verbose",
@@ -47,9 +50,9 @@ def select(data=None, outfile=None, **kwargs):
4750
they:
4851
4952
1. are inside a rectangular region (``region`` [and ``projection``])
50-
2. are within *dist* km of any point in *pointfile*
51-
3. are within *dist* km of any line in *linefile*
52-
4. are inside one of the polygons in *polygonfile*
53+
2. are within *dist* km of any point in *pointfile* (``dist2pt``)
54+
3. are within *dist* km of any line in *linefile* (``dist2line``)
55+
4. are inside one of the polygons in *polygonfile* (``polygon``)
5356
5. are inside geographical features (based on coastlines)
5457
6. have z-values within a given range
5558
7. are inside bins of a grid mask whose nodes are non-zero
@@ -69,6 +72,41 @@ def select(data=None, outfile=None, **kwargs):
6972
outfile : str
7073
The file name for the output ASCII file.
7174
{area_thresh}
75+
dist2pt : str
76+
*pointfile*\|\ *lon*/*lat*\ **+d**\ *dist*.
77+
Pass all records whose locations are within *dist* of any of the
78+
points in the ASCII file *pointfile*. If *dist* is zero, the 3rd
79+
column of *pointfile* must have each point's individual radius of
80+
influence. If you only have a single point, you can specify
81+
*lon*/*lat* instead of *pointfile*. Distances are Cartesian and in
82+
user units. Alternatively, if ``region`` and ``projection`` are used,
83+
the geographic coordinates are projected to map coordinates (in
84+
centimeters, inches, meters, or points, as determined by
85+
:gmt-term:`PROJ_LENGTH_UNIT`) before Cartesian distances are compared
86+
to *dist*.
87+
dist2line : str
88+
*linefile*\ **+d**\ *dist*\ [**+p**].
89+
Pass all records whose locations are within *dist* of any of the line
90+
segments in the ASCII :gmt-docs:`multiple-segment file
91+
<cookbook/file-formats.html#optional-segment-header-records>`
92+
*linefile*. If *dist* is zero, we will scan each sub-header in
93+
*linefile* for an embedded **-D**\ *dist* setting that sets each
94+
line's individual distance value. Distances are Cartesian and in
95+
user units. Alternatively, if ``region`` and ``projection`` are used,
96+
the geographic coordinates are projected to map coordinates (in
97+
centimeters, inches, meters, or points, as determined by
98+
:gmt-term:`PROJ_LENGTH_UNIT`) before Cartesian distances are
99+
compared to *dist*. Append **+p** to ensure only points whose
100+
orthogonal projections onto the nearest line-segment fall within
101+
the segment's endpoints [Default considers points "beyond" the
102+
line's endpoints].
103+
polygon : str
104+
*polygonfile*.
105+
Pass all records whose locations are within one of the closed
106+
polygons in the ASCII :gmt-docs:`multiple-segment file
107+
<cookbook/file-formats.html#optional-segment-header-records>`
108+
*polygonfile*. For spherical polygons (lon, lat), make sure no
109+
consecutive points are separated by 180 degrees or more in longitude.
72110
resolution : str
73111
*resolution*\ [**+f**].
74112
Ignored unless ``mask`` is set. Selects the resolution of the coastline

0 commit comments

Comments
 (0)