Skip to content

Commit f74ff96

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

File tree

9 files changed

+173
-23
lines changed

9 files changed

+173
-23
lines changed

pygmt/src/ternary.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
ternary - Plot data on ternary diagrams.
33
"""
44

5+
from typing import Literal
6+
57
import pandas as pd
68
from packaging.version import Version
79
from pygmt._typing import PathLike, TableLike
@@ -18,7 +20,6 @@
1820
JX="width",
1921
R="region",
2022
S="style",
21-
V="verbose",
2223
W="pen",
2324
c="panel",
2425
p="perspective",
@@ -31,6 +32,16 @@ def ternary(
3132
alabel: str | None = None,
3233
blabel: str | None = None,
3334
clabel: str | None = None,
35+
verbose: Literal[
36+
"quiet",
37+
"error",
38+
"warning",
39+
"timing",
40+
"information",
41+
"compatibility",
42+
"debug",
43+
]
44+
| bool = False,
3445
**kwargs,
3546
):
3647
r"""
@@ -48,6 +59,7 @@ def ternary(
4859
4960
{aliases}
5061
- L = alabel/blabel/clabel
62+
- V = verbose
5163
5264
Parameters
5365
----------
@@ -91,7 +103,10 @@ def ternary(
91103

92104
aliasdict = AliasSystem(
93105
L=Alias(labels, name="alabel/blabel/clabel", sep="/", size=3),
94-
).merge(kwargs)
106+
).add_common(
107+
V=verbose,
108+
)
109+
aliasdict.merge(kwargs)
95110

96111
# TODO(GMT>=6.5.0): Remove the patch for upstream bug fixed in GMT 6.5.0.
97112
# See https://github.com/GenericMappingTools/pygmt/pull/2138

pygmt/src/text.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
from collections.abc import Sequence
6+
from typing import Literal
67

78
import numpy as np
89
from pygmt._typing import AnchorCode, PathLike, StringArrayTypes, TableLike
@@ -29,7 +30,6 @@
2930
D="offset",
3031
G="fill",
3132
N="no_clip",
32-
V="verbose",
3333
W="pen",
3434
a="aspatial",
3535
c="panel",
@@ -42,7 +42,7 @@
4242
w="wrap",
4343
)
4444
@kwargs_to_strings(R="sequence", c="sequence_comma", p="sequence")
45-
def text_( # noqa: PLR0912
45+
def text_( # noqa: PLR0912, PLR0913, PLR0915
4646
self,
4747
textfiles: PathLike | TableLike | None = None,
4848
x=None,
@@ -53,6 +53,16 @@ def text_( # noqa: PLR0912
5353
font=None,
5454
justify: bool | None | AnchorCode | Sequence[AnchorCode] = None,
5555
projection=None,
56+
verbose: Literal[
57+
"quiet",
58+
"error",
59+
"warning",
60+
"timing",
61+
"information",
62+
"compatibility",
63+
"debug",
64+
]
65+
| bool = False,
5666
**kwargs,
5767
):
5868
r"""
@@ -74,6 +84,7 @@ def text_( # noqa: PLR0912
7484
{aliases}
7585
- F = **+a**: angle, **+c**: position, **+j**: justify, **+f**: font
7686
- J = projection
87+
- V = verbose
7788
7889
Parameters
7990
----------
@@ -266,7 +277,10 @@ def text_( # noqa: PLR0912
266277

267278
aliasdict = AliasSystem(
268279
J=Alias(projection, name="projection"),
269-
).merge(kwargs)
280+
).add_common(
281+
V=verbose,
282+
)
283+
aliasdict.merge(kwargs)
270284

271285
with Session() as lib:
272286
with lib.virtualfile_in(

pygmt/src/tilemap.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
N="no_clip",
2626
Q="nan_transparent",
2727
# R="region",
28-
V="verbose",
2928
c="panel",
3029
p="perspective",
3130
t="transparency",
@@ -41,6 +40,16 @@ def tilemap(
4140
max_retries: int = 2,
4241
zoom_adjust: int | None = None,
4342
projection=None,
43+
verbose: Literal[
44+
"quiet",
45+
"error",
46+
"warning",
47+
"timing",
48+
"information",
49+
"compatibility",
50+
"debug",
51+
]
52+
| bool = False,
4453
**kwargs,
4554
):
4655
r"""
@@ -58,6 +67,7 @@ def tilemap(
5867
5968
{aliases}
6069
- J = projection
70+
- V = verbose
6171
6272
Parameters
6373
----------
@@ -129,7 +139,10 @@ def tilemap(
129139

130140
aliasdict = AliasSystem(
131141
J=Alias(projection, name="projection"),
132-
).merge(kwargs)
142+
).add_common(
143+
V=verbose,
144+
)
145+
aliasdict.merge(kwargs)
133146

134147
with Session() as lib:
135148
with lib.virtualfile_in(check_kind="raster", data=raster) as vingrd:

pygmt/src/velo.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
velo - Plot velocity vectors, crosses, anisotropy bars, and wedges.
33
"""
44

5+
from typing import Literal
6+
57
import numpy as np
68
import pandas as pd
79
from pygmt._typing import PathLike, TableLike
@@ -30,7 +32,6 @@
3032
N="no_clip",
3133
R="region",
3234
S="spec",
33-
V="verbose",
3435
W="pen",
3536
Z="zvalue",
3637
c="panel",
@@ -42,7 +43,22 @@
4243
t="transparency",
4344
)
4445
@kwargs_to_strings(R="sequence", c="sequence_comma", i="sequence_comma", p="sequence")
45-
def velo(self, data: PathLike | TableLike | None = None, projection=None, **kwargs):
46+
def velo(
47+
self,
48+
data: PathLike | TableLike | None = None,
49+
projection=None,
50+
verbose: Literal[
51+
"quiet",
52+
"error",
53+
"warning",
54+
"timing",
55+
"information",
56+
"compatibility",
57+
"debug",
58+
]
59+
| bool = False,
60+
**kwargs,
61+
):
4662
r"""
4763
Plot velocity vectors, crosses, anisotropy bars, and wedges.
4864
@@ -59,6 +75,7 @@ def velo(self, data: PathLike | TableLike | None = None, projection=None, **kwar
5975
6076
{aliases}
6177
- J = projection
78+
- V = verbose
6279
6380
Parameters
6481
----------
@@ -259,7 +276,10 @@ def velo(self, data: PathLike | TableLike | None = None, projection=None, **kwar
259276

260277
aliasdict = AliasSystem(
261278
J=Alias(projection, name="projection"),
262-
).merge(kwargs)
279+
).add_common(
280+
V=verbose,
281+
)
282+
aliasdict.merge(kwargs)
263283

264284
with Session() as lib:
265285
with lib.virtualfile_in(check_kind="vector", data=data) as vintbl:

pygmt/src/which.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,30 @@
33
"""
44

55
from collections.abc import Sequence
6+
from typing import Literal
67

78
from pygmt._typing import PathLike
9+
from pygmt.alias import AliasSystem
810
from pygmt.clib import Session
911
from pygmt.helpers import build_arg_list, fmt_docstring, is_nonstr_iter, use_alias
1012

1113

1214
@fmt_docstring
13-
@use_alias(G="download", V="verbose")
14-
def which(fname: PathLike | Sequence[PathLike], **kwargs) -> str | list[str]:
15+
@use_alias(G="download")
16+
def which(
17+
fname: PathLike | Sequence[PathLike],
18+
verbose: Literal[
19+
"quiet",
20+
"error",
21+
"warning",
22+
"timing",
23+
"information",
24+
"compatibility",
25+
"debug",
26+
]
27+
| bool = False,
28+
**kwargs,
29+
) -> str | list[str]:
1530
r"""
1631
Find full path to specified files.
1732
@@ -30,6 +45,7 @@ def which(fname: PathLike | Sequence[PathLike], **kwargs) -> str | list[str]:
3045
Full GMT docs at :gmt-docs:`gmtwhich.html`.
3146
3247
{aliases}
48+
- V = verbose
3349
3450
Parameters
3551
----------
@@ -60,11 +76,16 @@ def which(fname: PathLike | Sequence[PathLike], **kwargs) -> str | list[str]:
6076
FileNotFoundError
6177
If the file is not found.
6278
"""
79+
aliasdict = AliasSystem().add_common(
80+
V=verbose,
81+
)
82+
aliasdict.merge(kwargs)
83+
6384
with Session() as lib:
6485
with lib.virtualfile_out(kind="dataset") as vouttbl:
6586
lib.call_module(
6687
module="which",
67-
args=build_arg_list(kwargs, infile=fname, outfile=vouttbl),
88+
args=build_arg_list(aliasdict, infile=fname, outfile=vouttbl),
6889
)
6990
paths = lib.virtualfile_to_dataset(vfname=vouttbl, output_type="strings")
7091

pygmt/src/wiggle.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
wiggle - Plot z=f(x,y) anomalies along tracks.
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
@@ -41,7 +43,6 @@ def _parse_fills(fillpositive, fillnegative):
4143
D="position",
4244
R="region",
4345
T="track",
44-
V="verbose",
4546
W="pen",
4647
Z="scale",
4748
b="binary",
@@ -66,6 +67,16 @@ def wiggle(
6667
fillpositive=None,
6768
fillnegative=None,
6869
projection=None,
70+
verbose: Literal[
71+
"quiet",
72+
"error",
73+
"warning",
74+
"timing",
75+
"information",
76+
"compatibility",
77+
"debug",
78+
]
79+
| bool = False,
6980
**kwargs,
7081
):
7182
r"""
@@ -81,6 +92,7 @@ def wiggle(
8192
{aliases}
8293
- G = **+p**: fillpositive, **+n**: fillnegative
8394
- J = projection
95+
- V = verbose
8496
8597
Parameters
8698
----------
@@ -133,7 +145,10 @@ def wiggle(
133145
aliasdict = AliasSystem(
134146
J=Alias(projection, name="projection"),
135147
G=Alias(_fills, name="fillpositive/fillnegative"),
136-
).merge(kwargs)
148+
).add_common(
149+
V=verbose,
150+
)
151+
aliasdict.merge(kwargs)
137152

138153
with Session() as lib:
139154
with lib.virtualfile_in(

0 commit comments

Comments
 (0)