6
6
7
7
import xarray as xr
8
8
from pygmt ._typing import PathLike
9
+ from pygmt .alias import Alias , AliasSystem
9
10
from pygmt .clib import Session
10
11
from pygmt .exceptions import GMTTypeError , GMTValueError
11
12
from pygmt .helpers import (
22
23
@fmt_docstring
23
24
@use_alias (
24
25
R = "region" ,
25
- J = "projection" ,
26
26
N = "extend" ,
27
27
S = "circ_subregion" ,
28
28
V = "verbose" ,
@@ -34,6 +34,7 @@ def grdcut(
34
34
grid : PathLike | xr .DataArray ,
35
35
kind : Literal ["grid" , "image" ] = "grid" ,
36
36
outgrid : PathLike | None = None ,
37
+ projection = None ,
37
38
** kwargs ,
38
39
) -> xr .DataArray | None :
39
40
r"""
@@ -51,6 +52,7 @@ def grdcut(
51
52
Full GMT docs at :gmt-docs:`grdcut.html`.
52
53
53
54
{aliases}
55
+ - J=projection
54
56
55
57
Parameters
56
58
----------
@@ -124,13 +126,19 @@ def grdcut(
124
126
case _:
125
127
raise GMTTypeError (type (grid ))
126
128
129
+ aliasdict = AliasSystem (
130
+ J = Alias (projection , name = "projection" ),
131
+ ).merge (kwargs )
132
+
127
133
with Session () as lib :
128
134
with (
129
135
lib .virtualfile_in (check_kind = "raster" , data = grid ) as vingrd ,
130
136
lib .virtualfile_out (kind = outkind , fname = outgrid ) as voutgrd ,
131
137
):
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
+ )
134
142
return lib .virtualfile_to_raster (
135
143
vfname = voutgrd , kind = outkind , outgrid = outgrid
136
144
)
0 commit comments