Skip to content

Commit a41827f

Browse files
committed
Merge branch 'main' into docstring/order
2 parents bc74071 + 026e28e commit a41827f

File tree

4 files changed

+37
-29
lines changed

4 files changed

+37
-29
lines changed

doc/contributing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,10 @@ integration systems will warn us and you can make a new commit with the formatte
488488
Even better, you can just write `/format` in the first line of any comment in a
489489
pull request to lint the code automatically.
490490

491-
When wrapping a new alias, use an underscore to separate words bridged by vowels
492-
(aeiou), such as `no_skip` and `z_only`. Do not use an underscore to separate
493-
words bridged only by consonants, such as `distcalc`, and `crossprofile`. This
494-
convention is not applied by the code checking tools, but the PyGMT maintainers
491+
When introducing a new parameter name, use an underscore to separate words. This improves
492+
readability and aligns with the [PEP 8 style guide](https://peps.python.org/pep-0008/).
493+
For common shortcuts no underscore is needed, e.g., `surftype`, `outgrid`, or `timefmt`.
494+
This convention is not applied by the code checking tools, but the PyGMT maintainers
495495
will comment on any pull requests as needed.
496496

497497
When working on a tutorial or a gallery plot, it is good practice to use code

examples/tutorials/advanced/cartesian_histograms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@
320320
# Grouped bars
321321
# ------------
322322
#
323-
# By setting the ``barwidth`` parameter in respect to the values passed to the
323+
# By setting the ``bar_width`` parameter in respect to the values passed to the
324324
# ``series`` parameter histograms with grouped bars can be created.
325325
#
326326
# Limitations of histograms with grouped bars are:
@@ -347,7 +347,7 @@
347347
# of the bin width
348348
# Offset ("+o") the bars to align each bar with the left limit of the corresponding
349349
# bin
350-
barwidth=f"{binwidth / 2}+o-{binwidth / 4}",
350+
bar_width=f"{binwidth / 2}+o-{binwidth / 4}",
351351
label="data01",
352352
)
353353

@@ -358,7 +358,7 @@
358358
fill="orange",
359359
pen="1p,darkgray,solid",
360360
histtype=0,
361-
barwidth=f"{binwidth / 2}+o{binwidth / 4}",
361+
bar_width=f"{binwidth / 2}+o{binwidth / 4}",
362362
label="data02",
363363
)
364364

pygmt/src/histogram.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,22 @@
88
from pygmt._typing import PathLike, TableLike
99
from pygmt.alias import AliasSystem
1010
from pygmt.clib import Session
11-
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias
11+
from pygmt.helpers import (
12+
build_arg_list,
13+
deprecate_parameter,
14+
fmt_docstring,
15+
kwargs_to_strings,
16+
use_alias,
17+
)
1218

1319

1420
@fmt_docstring
21+
@deprecate_parameter("barwidth", "bar_width", "v0.18.0", remove_version="v0.20.0")
1522
@use_alias(
1623
A="horizontal",
1724
C="cmap",
1825
D="annotate",
19-
E="barwidth",
26+
E="bar_width",
2027
F="center",
2128
G="fill",
2229
L="extreme",
@@ -84,7 +91,7 @@ def histogram(
8491
annotation font; use **+o** to change the offset between bar and
8592
label [Default is ``"6p"``]; use **+r** to rotate the labels from
8693
horizontal to vertical.
87-
barwidth : float or str
94+
bar_width : float or str
8895
*width*\ [**+o**\ *offset*].
8996
Use an alternative histogram bar width than the default set via
9097
``series``, and optionally shift all bars by an *offset*. Here

pygmt/src/select.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from pygmt.clib import Session
1313
from pygmt.helpers import (
1414
build_arg_list,
15+
deprecate_parameter,
1516
fmt_docstring,
1617
kwargs_to_strings,
1718
use_alias,
@@ -22,14 +23,16 @@
2223

2324

2425
@fmt_docstring
26+
@deprecate_parameter("mask", "mask_values", "v0.18.0", remove_version="v0.20.0")
27+
@deprecate_parameter("gridmask", "mask_grid", "v0.18.0", remove_version="v0.20.0")
2528
@use_alias(
2629
A="area_thresh",
2730
C="dist2pt",
2831
F="polygon",
29-
G="gridmask",
32+
G="mask_grid",
3033
I="reverse",
3134
L="dist2line",
32-
N="mask",
35+
N="mask_values",
3336
Z="z_subregion",
3437
b="binary",
3538
d="nodata",
@@ -128,42 +131,40 @@ def select(
128131
<reference/file-formats.html#optional-segment-header-records>`
129132
*polygonfile*. For spherical polygons (lon, lat), make sure no
130133
consecutive points are separated by 180 degrees or more in longitude.
131-
gridmask : str
134+
mask_grid : str
132135
Pass all locations that are inside the valid data area of the grid
133-
*gridmask*. Nodes that are outside are either NaN or zero.
136+
*mask_grid*. Nodes that are outside are either NaN or zero.
134137
reverse : str
135138
[**cflrsz**].
136139
Reverse the sense of the test for each of the criteria specified:
137140
138141
- **c** select records NOT inside any point's circle of influence.
139142
- **f** select records NOT inside any of the polygons.
140143
- **g** will pass records inside the cells with z equal zero of the
141-
grid mask in ``gridmask``.
144+
*mask_grid* in ``mask_grid``.
142145
- **l** select records NOT within the specified distance of any line.
143146
- **r** select records NOT inside the specified rectangular region.
144-
- **s** select records NOT considered inside as specified by ``mask``
147+
- **s** select records NOT considered inside as specified by ``mask_values``
145148
(and ``area_thresh``, ``resolution``).
146149
- **z** select records NOT within the range specified by
147150
``z_subregion``.
148151
$projection
149-
mask : str or list
150-
Pass all records whose location is inside specified geographical
151-
features. Specify if records should be skipped (s) or kept (k) using
152-
1 of 2 formats:
152+
mask_values : str or list
153+
Pass all records whose location is inside specified geographical features.
154+
Specify if records should be skipped (s) or kept (k) using 1 of 2 formats:
153155
154156
- *wet/dry*.
155157
- *ocean/land/lake/island/pond*.
156158
157-
[Default is s/k/s/k/s (i.e., s/k), which passes all points on dry
158-
land].
159+
[Default is s/k/s/k/s (i.e., s/k), which passes all points on dry land].
159160
resolution
160-
Ignored unless ``mask`` is set. Select the resolution of the coastline dataset
161-
to use. The available resolutions from highest to lowest are: ``"full"``,
162-
``"high"``, ``"intermediate"``, ``"low"``, and ``"crude"``, which drops by 80%
163-
between levels. Alternatively, choose ``"auto"`` to automatically select the
164-
most suitable resolution given the chosen region. Note that because the
165-
coastlines differ in details, a node in a mask file using one resolution is not
166-
guaranteed to remain inside [or outside] when a different resolution is
161+
Ignored unless ``mask_values`` is set. Select the resolution of the coastline
162+
dataset to use. The available resolutions from highest to lowest are:
163+
``"full"``, ``"high"``, ``"intermediate"``, ``"low"``, and ``"crude"``, which
164+
drops by 80% between levels. Alternatively, choose ``"auto"`` to automatically
165+
select the most suitable resolution given the chosen region. Note that because
166+
the coastlines differ in details, a node in a mask file using one resolution is
167+
not guaranteed to remain inside [or outside] when a different resolution is
167168
selected. If ``None``, the low resolution is used by default.
168169
$region
169170
$verbose

0 commit comments

Comments
 (0)