77
88import xarray as xr
99from pygmt ._typing import PathLike
10- from pygmt .alias import AliasSystem
10+ from pygmt .alias import Alias , AliasSystem
1111from pygmt .clib import Session
1212from pygmt .helpers import build_arg_list , fmt_docstring , kwargs_to_strings , use_alias
1313
1414
1515@fmt_docstring
1616@use_alias (
17- D = "distance" ,
18- F = "filter" ,
19- I = "spacing" ,
20- N = "nans" ,
21- T = "toggle" ,
22- f = "coltypes" ,
23- r = "registration" ,
17+ D = "distance" , F = "filter" , I = "spacing" , N = "nans" , f = "coltypes" , r = "registration"
2418)
2519@kwargs_to_strings (I = "sequence" )
2620def grdfilter (
2721 grid : PathLike | xr .DataArray ,
2822 outgrid : PathLike | None = None ,
23+ toggle : bool = False ,
2924 region : Sequence [float | str ] | str | None = None ,
3025 verbose : Literal ["quiet" , "error" , "warning" , "timing" , "info" , "compat" , "debug" ]
3126 | bool = False ,
@@ -49,6 +44,7 @@ def grdfilter(
4944
5045 {aliases}
5146 - R = region
47+ - T = toggle
5248 - V = verbose
5349 - x = cores
5450
@@ -101,9 +97,10 @@ def grdfilter(
10197 co-registered). **p** will force the filtered value to be NaN if any
10298 grid nodes with NaN-values are found inside the filter circle.
10399 {region}
104- toggle : bool
105- Toggle the node registration for the output grid to get the opposite of
100+ toggle
101+ Toggle the node registration for the output grid so as to become the opposite of
106102 the input grid [Default gives the same registration as the input grid].
103+ Alternatively, use ``registration`` to set the registration explicitly.
107104 {verbose}
108105 {coltypes}
109106 {registration}
@@ -138,7 +135,9 @@ def grdfilter(
138135 >>> grid = pygmt.datasets.load_earth_relief()
139136 >>> smooth_field = pygmt.grdfilter(grid=grid, filter="g600", distance="4")
140137 """
141- aliasdict = AliasSystem ().add_common (
138+ aliasdict = AliasSystem (
139+ T = Alias (toggle , name = "toggle" ),
140+ ).add_common (
142141 R = region ,
143142 V = verbose ,
144143 x = cores ,
0 commit comments