Skip to content

Commit a885d75

Browse files
authored
Figure.grdview: Migrate the 'drapegrid' parameter to the new alias system (#4442)
1 parent d40dc5d commit a885d75

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

pygmt/src/grdview.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,11 @@ def _alias_option_Q( # noqa: N802
114114
@deprecate_parameter("facadepen", "facade_pen", "v0.18.0", remove_version="v0.20.0")
115115
@deprecate_parameter("meshpen", "mesh_pen", "v0.18.0", remove_version="v0.20.0")
116116
@deprecate_parameter("drapegrid", "drape_grid", "v0.18.0", remove_version="v0.20.0")
117-
@use_alias(C="cmap", G="drape_grid", I="shading", f="coltypes", n="interpolation")
117+
@use_alias(C="cmap", I="shading", f="coltypes", n="interpolation")
118118
def grdview( # noqa: PLR0913
119119
self,
120120
grid: PathLike | xr.DataArray,
121+
drape_grid: PathLike | xr.DataArray | None = None,
121122
surftype: Literal[
122123
"mesh", "surface", "surface+mesh", "image", "waterfall_x", "waterfall_y"
123124
]
@@ -156,6 +157,7 @@ def grdview( # noqa: PLR0913
156157
157158
$aliases
158159
- B = frame
160+
- G = drape_grid
159161
- J = projection
160162
- Jz = zscale
161163
- JZ = zsize
@@ -175,12 +177,13 @@ def grdview( # noqa: PLR0913
175177
$grid
176178
cmap : str
177179
The name of the color palette table to use.
178-
drape_grid : str or :class:`xarray.DataArray`
179-
The file name or a :class:`xarray.DataArray` of the image grid to be draped on
180-
top of the relief provided by ``grid`` [Default determines colors from ``grid``]
181-
Note that ``zscale`` and ``plane`` always refer to ``grid``. ``drape_grid`` only
182-
provides the information pertaining to colors, which (if ``drape_grid`` is a
183-
grid) will be looked-up via the CPT (see ``cmap``).
180+
drapegrid
181+
The grid (a file name or a :class:`xarray.DataArray`) or image to be draped on
182+
top of the grid surface provided by ``grid`` [Default determines colors from
183+
``grid``]. Note that ``zscale`` and ``plane`` always refer to ``grid``.
184+
``drape_grid`` only provides the information pertaining to colors. If it's a
185+
grid, the colors will be looked-up via the CPT (see ``cmap``); if it's an image,
186+
``cmap`` is not expected.
184187
surftype
185188
Specify surface type for the grid. Valid values are:
186189
@@ -324,7 +327,7 @@ def grdview( # noqa: PLR0913
324327
with (
325328
lib.virtualfile_in(check_kind="raster", data=grid) as vingrd,
326329
lib.virtualfile_in(
327-
check_kind="raster", data=kwargs.get("G"), required=False
330+
check_kind="raster", data=aliasdict.get("G", drape_grid), required=False
328331
) as vdrapegrid,
329332
):
330333
aliasdict["G"] = vdrapegrid

0 commit comments

Comments
 (0)