Skip to content

Commit cccf373

Browse files
committed
Update more modules
1 parent 6ca8aa7 commit cccf373

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1142
-167
lines changed

pygmt/src/binstats.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
N="normalize",
1919
R="region",
2020
S="search_radius",
21-
V="verbose",
2221
W="weight",
2322
a="aspatial",
2423
b="binary",
@@ -49,6 +48,16 @@ def binstats(
4948
"sum",
5049
] = "number",
5150
quantile_value: float = 50,
51+
verbose: Literal[
52+
"quiet",
53+
"error",
54+
"warning",
55+
"timing",
56+
"information",
57+
"compatibility",
58+
"debug",
59+
]
60+
| bool = False,
5261
**kwargs,
5362
) -> xr.DataArray | None:
5463
r"""
@@ -66,6 +75,7 @@ def binstats(
6675
6776
{aliases}
6877
- C = statistic
78+
- V = verbose
6979
7080
Parameters
7181
----------
@@ -151,7 +161,10 @@ def binstats(
151161
"sum": "z",
152162
},
153163
),
154-
).merge(kwargs)
164+
).add_common(
165+
V=verbose,
166+
)
167+
aliasdict.merge(kwargs)
155168
if statistic == "quantile":
156169
aliasdict["C"] += f"{quantile_value}"
157170

pygmt/src/blockm.py

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import numpy as np
88
import pandas as pd
99
from pygmt._typing import PathLike, TableLike
10+
from pygmt.alias import AliasSystem
1011
from pygmt.clib import Session
1112
from pygmt.helpers import (
1213
build_arg_list,
@@ -74,7 +75,6 @@ def _blockm(
7475
I="spacing",
7576
R="region",
7677
S="summary",
77-
V="verbose",
7878
a="aspatial",
7979
b="binary",
8080
d="nodata",
@@ -94,6 +94,16 @@ def blockmean(
9494
z=None,
9595
output_type: Literal["pandas", "numpy", "file"] = "pandas",
9696
outfile: PathLike | None = None,
97+
verbose: Literal[
98+
"quiet",
99+
"error",
100+
"warning",
101+
"timing",
102+
"information",
103+
"compatibility",
104+
"debug",
105+
]
106+
| bool = False,
97107
**kwargs,
98108
) -> pd.DataFrame | np.ndarray | None:
99109
r"""
@@ -111,6 +121,7 @@ def blockmean(
111121
Full GMT docs at :gmt-docs:`blockmean.html`.
112122
113123
{aliases}
124+
- V = verbose
114125
115126
Parameters
116127
----------
@@ -162,6 +173,11 @@ def blockmean(
162173
>>> # Calculate block mean values within 5 by 5 arc-minute bins
163174
>>> data_bmean = pygmt.blockmean(data=data, region=[245, 255, 20, 30], spacing="5m")
164175
"""
176+
aliasdict = AliasSystem().add_common(
177+
V=verbose,
178+
)
179+
aliasdict.merge(kwargs)
180+
165181
return _blockm(
166182
block_method="blockmean",
167183
data=data,
@@ -170,15 +186,14 @@ def blockmean(
170186
z=z,
171187
output_type=output_type,
172188
outfile=outfile,
173-
**kwargs,
189+
**aliasdict,
174190
)
175191

176192

177193
@fmt_docstring
178194
@use_alias(
179195
I="spacing",
180196
R="region",
181-
V="verbose",
182197
a="aspatial",
183198
b="binary",
184199
d="nodata",
@@ -198,6 +213,16 @@ def blockmedian(
198213
z=None,
199214
output_type: Literal["pandas", "numpy", "file"] = "pandas",
200215
outfile: PathLike | None = None,
216+
verbose: Literal[
217+
"quiet",
218+
"error",
219+
"warning",
220+
"timing",
221+
"information",
222+
"compatibility",
223+
"debug",
224+
]
225+
| bool = False,
201226
**kwargs,
202227
) -> pd.DataFrame | np.ndarray | None:
203228
r"""
@@ -215,6 +240,7 @@ def blockmedian(
215240
Full GMT docs at :gmt-docs:`blockmedian.html`.
216241
217242
{aliases}
243+
- V = verbose
218244
219245
Parameters
220246
----------
@@ -260,6 +286,11 @@ def blockmedian(
260286
... data=data, region=[245, 255, 20, 30], spacing="5m"
261287
... )
262288
"""
289+
aliasdict = AliasSystem().add_common(
290+
V=verbose,
291+
)
292+
aliasdict.merge(kwargs)
293+
263294
return _blockm(
264295
block_method="blockmedian",
265296
data=data,
@@ -268,15 +299,14 @@ def blockmedian(
268299
z=z,
269300
output_type=output_type,
270301
outfile=outfile,
271-
**kwargs,
302+
**aliasdict,
272303
)
273304

274305

275306
@fmt_docstring
276307
@use_alias(
277308
I="spacing",
278309
R="region",
279-
V="verbose",
280310
a="aspatial",
281311
b="binary",
282312
d="nodata",
@@ -296,6 +326,16 @@ def blockmode(
296326
z=None,
297327
output_type: Literal["pandas", "numpy", "file"] = "pandas",
298328
outfile: PathLike | None = None,
329+
verbose: Literal[
330+
"quiet",
331+
"error",
332+
"warning",
333+
"timing",
334+
"information",
335+
"compatibility",
336+
"debug",
337+
]
338+
| bool = False,
299339
**kwargs,
300340
) -> pd.DataFrame | np.ndarray | None:
301341
r"""
@@ -313,6 +353,7 @@ def blockmode(
313353
Full GMT docs at :gmt-docs:`blockmode.html`.
314354
315355
{aliases}
356+
- V = verbose
316357
317358
Parameters
318359
----------
@@ -356,6 +397,11 @@ def blockmode(
356397
>>> # Calculate block mode values within 5 by 5 arc-minute bins
357398
>>> data_bmode = pygmt.blockmode(data=data, region=[245, 255, 20, 30], spacing="5m")
358399
"""
400+
aliasdict = AliasSystem().add_common(
401+
V=verbose,
402+
)
403+
aliasdict.merge(kwargs)
404+
359405
return _blockm(
360406
block_method="blockmode",
361407
data=data,
@@ -364,5 +410,5 @@ def blockmode(
364410
z=z,
365411
output_type=output_type,
366412
outfile=outfile,
367-
**kwargs,
413+
**aliasdict,
368414
)

pygmt/src/colorbar.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
colorbar - Plot gray scale or color scale bar.
33
"""
44

5+
from typing import Literal
6+
57
from pygmt.alias import Alias, AliasSystem
68
from pygmt.clib import Session
79
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias
@@ -20,7 +22,6 @@
2022
L="equalsize",
2123
Q="log",
2224
R="region",
23-
V="verbose",
2425
W="scale",
2526
Z="zfile",
2627
c="panel",
@@ -30,7 +31,21 @@
3031
@kwargs_to_strings(
3132
R="sequence", G="sequence", I="sequence", c="sequence_comma", p="sequence"
3233
)
33-
def colorbar(self, projection=None, **kwargs):
34+
def colorbar(
35+
self,
36+
projection=None,
37+
verbose: Literal[
38+
"quiet",
39+
"error",
40+
"warning",
41+
"timing",
42+
"information",
43+
"compatibility",
44+
"debug",
45+
]
46+
| bool = False,
47+
**kwargs,
48+
):
3449
r"""
3550
Plot gray scale or color scale bar.
3651
@@ -46,6 +61,7 @@ def colorbar(self, projection=None, **kwargs):
4661
4762
{aliases}
4863
- J = projection
64+
- V = verbose
4965
5066
Parameters
5167
----------
@@ -149,6 +165,10 @@ def colorbar(self, projection=None, **kwargs):
149165

150166
aliasdict = AliasSystem(
151167
J=Alias(projection, name="projection"),
152-
).merge(kwargs)
168+
).add_common(
169+
V=verbose,
170+
)
171+
aliasdict.merge(kwargs)
172+
153173
with Session() as lib:
154174
lib.call_module(module="colorbar", args=build_arg_list(aliasdict))

pygmt/src/contour.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
contour - Contour table data by direct triangulation.
33
"""
44

5+
from typing import Literal
6+
57
from pygmt._typing import PathLike, TableLike
68
from pygmt.alias import Alias, AliasSystem
79
from pygmt.clib import Session
@@ -24,7 +26,6 @@
2426
N="no_clip",
2527
R="region",
2628
S="skip",
27-
V="verbose",
2829
W="pen",
2930
b="binary",
3031
c="panel",
@@ -45,6 +46,16 @@ def contour(
4546
y=None,
4647
z=None,
4748
projection=None,
49+
verbose: Literal[
50+
"quiet",
51+
"error",
52+
"warning",
53+
"timing",
54+
"information",
55+
"compatibility",
56+
"debug",
57+
]
58+
| bool = False,
4859
**kwargs,
4960
):
5061
r"""
@@ -59,6 +70,7 @@ def contour(
5970
6071
{aliases}
6172
- J = projection
73+
- V = verbose
6274
6375
Parameters
6476
----------
@@ -155,7 +167,10 @@ def contour(
155167

156168
aliasdict = AliasSystem(
157169
J=Alias(projection, name="projection"),
158-
).merge(kwargs)
170+
).add_common(
171+
V=verbose,
172+
)
173+
aliasdict.merge(kwargs)
159174

160175
with Session() as lib:
161176
with lib.virtualfile_in(

pygmt/src/dimfilter.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
dimfilter - Directional filtering of grids in the space domain.
33
"""
44

5+
from typing import Literal
6+
57
import xarray as xr
68
from pygmt._typing import PathLike
9+
from pygmt.alias import AliasSystem
710
from pygmt.clib import Session
811
from pygmt.exceptions import GMTInvalidInput
912
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias
@@ -18,11 +21,22 @@
1821
I="spacing",
1922
N="sectors",
2023
R="region",
21-
V="verbose",
2224
)
2325
@kwargs_to_strings(I="sequence", R="sequence")
2426
def dimfilter(
25-
grid: PathLike | xr.DataArray, outgrid: PathLike | None = None, **kwargs
27+
grid: PathLike | xr.DataArray,
28+
outgrid: PathLike | None = None,
29+
verbose: Literal[
30+
"quiet",
31+
"error",
32+
"warning",
33+
"timing",
34+
"information",
35+
"compatibility",
36+
"debug",
37+
]
38+
| bool = False,
39+
**kwargs,
2640
) -> xr.DataArray | None:
2741
r"""
2842
Directional filtering of grids in the space domain.
@@ -46,6 +60,7 @@ def dimfilter(
4660
Full GMT docs at :gmt-docs:`dimfilter.html`.
4761
4862
{aliases}
63+
- V = verbose
4964
5065
Parameters
5166
----------
@@ -143,13 +158,19 @@ def dimfilter(
143158
"distance, filters, or sectors."
144159
)
145160
raise GMTInvalidInput(msg)
161+
162+
aliasdict = AliasSystem().add_common(
163+
V=verbose,
164+
)
165+
aliasdict.merge(kwargs)
166+
146167
with Session() as lib:
147168
with (
148169
lib.virtualfile_in(check_kind="raster", data=grid) as vingrd,
149170
lib.virtualfile_out(kind="grid", fname=outgrid) as voutgrd,
150171
):
151-
kwargs["G"] = voutgrd
172+
aliasdict["G"] = voutgrd
152173
lib.call_module(
153-
module="dimfilter", args=build_arg_list(kwargs, infile=vingrd)
174+
module="dimfilter", args=build_arg_list(aliasdict, infile=vingrd)
154175
)
155176
return lib.virtualfile_to_raster(vfname=voutgrd, outgrid=outgrid)

0 commit comments

Comments
 (0)