Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pygmt/alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ def add_common(self, **kwargs):
alias = Alias(value, name="panel", sep=",", size=2)
case "t":
alias = Alias(value, name="transparency")
case "x":
alias = Alias(value, name="cores")
case _:
raise GMTValueError(key, description="common parameter")
self.aliasdict[key] = alias
Expand Down
2 changes: 1 addition & 1 deletion pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
Specify data types of input and/or output columns (time or geographical
data). Full documentation is at :gmt-docs:`gmt.html#f-full`.""",
"cores": r"""
cores : bool or int
cores
Specify the number of active cores to be used in any OpenMP-enabled
multi-threaded algorithms. By default, all available cores are used. Set a
positive number *n* to use *n* cores (if too large it will be truncated to
Expand Down
4 changes: 3 additions & 1 deletion pygmt/src/grdfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
T="toggle",
f="coltypes",
r="registration",
x="cores",
)
@kwargs_to_strings(I="sequence", R="sequence")
def grdfilter(
grid: PathLike | xr.DataArray,
outgrid: PathLike | None = None,
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
| bool = False,
cores: int | bool = False,
**kwargs,
) -> xr.DataArray | None:
r"""
Expand All @@ -48,6 +48,7 @@ def grdfilter(

{aliases}
- V = verbose
- x = cores

Parameters
----------
Expand Down Expand Up @@ -137,6 +138,7 @@ def grdfilter(
"""
aliasdict = AliasSystem().add_common(
V=verbose,
x=cores,
)
aliasdict.merge(kwargs)

Expand Down
4 changes: 3 additions & 1 deletion pygmt/src/grdimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
n="interpolation",
f="coltypes",
p="perspective",
x="cores",
)
@kwargs_to_strings(R="sequence", p="sequence")
def grdimage(
Expand All @@ -39,6 +38,7 @@ def grdimage(
| bool = False,
panel: int | tuple[int, int] | bool = False,
transparency: float | None = None,
cores: int | bool = False,
**kwargs,
):
r"""
Expand Down Expand Up @@ -79,6 +79,7 @@ def grdimage(
- V = verbose
- c = panel
- t = transparency
- x = cores

Parameters
----------
Expand Down Expand Up @@ -177,6 +178,7 @@ def grdimage(
V=verbose,
c=panel,
t=transparency,
x=cores,
)
aliasdict.merge(kwargs)

Expand Down
11 changes: 4 additions & 7 deletions pygmt/src/grdlandmask.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@
from pygmt.alias import Alias, AliasSystem
from pygmt.clib import Session
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import (
build_arg_list,
fmt_docstring,
kwargs_to_strings,
use_alias,
)
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias

__doctest_skip__ = ["grdlandmask"]

Expand All @@ -26,7 +21,6 @@
I="spacing",
R="region",
r="registration",
x="cores",
)
@kwargs_to_strings(I="sequence", R="sequence")
def grdlandmask(
Expand All @@ -38,6 +32,7 @@ def grdlandmask(
] = None,
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
| bool = False,
cores: int | bool = False,
**kwargs,
) -> xr.DataArray | None:
r"""
Expand All @@ -56,6 +51,7 @@ def grdlandmask(
- E = bordervalues
- N = maskvalues
- V = verbose
- x = cores

Parameters
----------
Expand Down Expand Up @@ -136,6 +132,7 @@ def grdlandmask(
E=Alias(bordervalues, name="bordervalues", sep="/", size=4),
).add_common(
V=verbose,
x=cores,
)
aliasdict.merge(kwargs)

Expand Down
4 changes: 3 additions & 1 deletion pygmt/src/grdsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
f="coltypes",
n="interpolation",
r="registration",
x="cores",
)
@kwargs_to_strings(I="sequence", R="sequence")
def grdsample(
grid: PathLike | xr.DataArray,
outgrid: PathLike | None = None,
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
| bool = False,
cores: int | bool = False,
**kwargs,
) -> xr.DataArray | None:
r"""
Expand All @@ -51,6 +51,7 @@ def grdsample(

{aliases}
- V = verbose
- x = cores

Parameters
----------
Expand Down Expand Up @@ -92,6 +93,7 @@ def grdsample(
"""
aliasdict = AliasSystem().add_common(
V=verbose,
x=cores,
)
aliasdict.merge(kwargs)

Expand Down
4 changes: 3 additions & 1 deletion pygmt/src/sph2grd.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
h="header",
i="incols",
r="registration",
x="cores",
)
@kwargs_to_strings(I="sequence", R="sequence", i="sequence_comma")
def sph2grd(
data: PathLike | TableLike,
outgrid: PathLike | None = None,
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
| bool = False,
cores: int | bool = False,
**kwargs,
) -> xr.DataArray | None:
r"""
Expand All @@ -42,6 +42,7 @@ def sph2grd(

{aliases}
- V = verbose
- x = cores

Parameters
----------
Expand Down Expand Up @@ -77,6 +78,7 @@ def sph2grd(
"""
aliasdict = AliasSystem().add_common(
V=verbose,
x=cores,
)
aliasdict.merge(kwargs)

Expand Down
Loading