66
77import xarray as xr
88from pygmt ._typing import PathLike
9+ from pygmt .alias import Alias , AliasSystem
910from pygmt .clib import Session
1011from pygmt .exceptions import GMTTypeError , GMTValueError
1112from pygmt .helpers import (
2223@fmt_docstring
2324@use_alias (
2425 R = "region" ,
25- J = "projection" ,
2626 N = "extend" ,
2727 S = "circ_subregion" ,
2828 V = "verbose" ,
@@ -34,6 +34,7 @@ def grdcut(
3434 grid : PathLike | xr .DataArray ,
3535 kind : Literal ["grid" , "image" ] = "grid" ,
3636 outgrid : PathLike | None = None ,
37+ projection = None ,
3738 ** kwargs ,
3839) -> xr .DataArray | None :
3940 r"""
@@ -51,6 +52,7 @@ def grdcut(
5152 Full GMT docs at :gmt-docs:`grdcut.html`.
5253
5354 {aliases}
55+ - J=projection
5456
5557 Parameters
5658 ----------
@@ -124,13 +126,19 @@ def grdcut(
124126 case _:
125127 raise GMTTypeError (type (grid ))
126128
129+ aliasdict = AliasSystem (
130+ J = Alias (projection , name = "projection" ),
131+ ).merge (kwargs )
132+
127133 with Session () as lib :
128134 with (
129135 lib .virtualfile_in (check_kind = "raster" , data = grid ) as vingrd ,
130136 lib .virtualfile_out (kind = outkind , fname = outgrid ) as voutgrd ,
131137 ):
132- kwargs ["G" ] = voutgrd
133- lib .call_module (module = "grdcut" , args = build_arg_list (kwargs , infile = vingrd ))
138+ aliasdict ["G" ] = voutgrd
139+ lib .call_module (
140+ module = "grdcut" , args = build_arg_list (aliasdict , infile = vingrd )
141+ )
134142 return lib .virtualfile_to_raster (
135143 vfname = voutgrd , kind = outkind , outgrid = outgrid
136144 )
0 commit comments