1616
1717
1818@fmt_docstring
19- @use_alias (E = "dpi" , F = "scaling" , I = "inverse" , M = "unit" , n = "interpolation" )
20- def grdproject (
19+ @use_alias (n = "interpolation" )
20+ def grdproject ( # noqa: PLR0913
2121 grid : PathLike | xr .DataArray ,
2222 outgrid : PathLike | None = None ,
2323 center : Sequence [float | str ] | bool = False ,
2424 spacing : float | str | Sequence [float | str ] | None = None ,
25+ dpi : int | None = None ,
26+ inverse : bool = False ,
27+ unit : Literal ["c" , "i" , "p" ] | None = None ,
28+ scaling : Literal ["c" , "i" , "p" , "e" , "f" , "k" , "M" , "n" , "u" ] | bool = False ,
2529 projection : str | None = None ,
2630 region : Sequence [float | str ] | str | None = None ,
2731 registration : Literal ["gridline" , "pixel" ] | bool = False ,
@@ -32,27 +36,30 @@ def grdproject(
3236 r"""
3337 Forward and inverse map transformation of grids.
3438
35- This method will project a geographical gridded data set onto a
36- rectangular grid. If ``inverse`` is ``True``, it will project a
37- rectangular coordinate system to a geographic system. To obtain the value
38- at each new node, its location is inversely projected back onto the input
39- grid after which a value is interpolated between the surrounding input
40- grid values. By default bi-cubic interpolation is used. Aliasing is
41- avoided by also forward projecting the input grid nodes. If two or more
42- nodes are projected onto the same new node, their average will dominate in
43- the calculation of the new node value. Interpolation and aliasing is
44- controlled with the ``interpolation`` parameter. The new node spacing may
45- be determined in one of several ways by specifying the grid spacing,
46- number of nodes, or resolution. Nodes not constrained by input data are
47- set to NaN. The ``region`` parameter can be used to select a map region
48- large or smaller than that implied by the extent of the grid file.
39+ This method will project a geographical gridded data set onto a rectangular grid. If
40+ ``inverse`` is ``True``, it will project a rectangular coordinate system to a
41+ geographic system. To obtain the value at each new node, its location is inversely
42+ projected back onto the input grid after which a value is interpolated between the
43+ surrounding input grid values. By default bi-cubic interpolation is used. Aliasing
44+ is avoided by also forward projecting the input grid nodes. If two or more nodes are
45+ projected onto the same new node, their average will dominate in the calculation of
46+ the new node value. Interpolation and aliasing is controlled with the
47+ ``interpolation`` parameter. The new node spacing may be determined in one of
48+ several ways by specifying the grid spacing, number of nodes, or resolution. Nodes
49+ not constrained by input data are set to NaN. The ``region`` parameter can be used
50+ to select a map region large or smaller than that implied by the extent of the grid
51+ file.
4952
5053 Full GMT docs at :gmt-docs:`grdproject.html`.
5154
5255 $aliases
5356 - C = center
5457 - D = spacing
58+ - E = dpi
59+ - F = scaling
60+ - I = inverse
5561 - J = projection
62+ - M = unit
5663 - R = region
5764 - V = verbose
5865 - r = registration
@@ -61,32 +68,31 @@ def grdproject(
6168 ----------
6269 $grid
6370 $outgrid
64- inverse : bool
65- When set to ``True`` transforms grid from rectangular to geographical
66- [Default is ``False``].
67- $projection
68- $region
6971 center
7072 If ``True``, let the projected coordinates be relative to the projection center
7173 [Default is relative to the lower left corner]. Optionally, set offsets
7274 (*dx*, *dy*) in the projected units to be added (or subtracted when ``inverse``
7375 is set) to (from) the projected coordinates, such as false eastings and
7476 northings for particular projection zones [Default is ``(0, 0)``].
7577 $spacing
76- dpi : int
78+ dpi
7779 Set the resolution for the new grid in dots per inch.
78- scaling : str
79- [**c**\|\ **i**\|\ **p**\|\ **e**\|\ **f**\|\
80- **k**\|\ **M**\|\ **n**\|\ **u**].
81- Force 1:1 scaling, i.e., output or input data are in actual projected
82- meters [**e**]. To specify other units, append **f** (feet),
80+ inverse
81+ When set to ``True``, do the inverse transformation, from rectangular to
82+ geographical [Default is ``False``].
83+ unit
84+ Set the projected measure unit. Valid values are ``"c"`` for centimeters,
85+ ``"i"`` for inches, and ``"p"`` for points [Default is set by
86+ :gmt-term:`PROJ_LENGTH_UNIT`]. Cannot be used with ``scaling``.
87+ scaling
88+ Force 1:1 scaling, i.e., output (or input, see ``inverse``) data are in actual
89+ projected meters. To specify other units, set it to **f** (feet),
8390 **k** (kilometers), **M** (statute miles), **n** (nautical miles),
84- **u** (US survey feet), **i** (inches), **c** (centimeters), or
85- **p** (points).
86- unit : str
87- Append **c**, **i**, or **p** to indicate that centimeters, inches, or
88- points should be the projected measure unit. Cannot be used with
89- ``scaling``.
91+ **u** (US survey feet), **i** (inches), **c** (centimeters), or **p** (points).
92+ Without ``scaling``, the output (or input, see ``inverse``) are in the units
93+ specified by :gmt-term:`PROJ_LENGTH_UNIT` (but see ``unit``).
94+ $projection
95+ $region
9096 $verbose
9197 $interpolation
9298 $registration
@@ -117,6 +123,10 @@ def grdproject(
117123 aliasdict = AliasSystem (
118124 C = Alias (center , name = "center" , sep = "/" , size = 2 ),
119125 D = Alias (spacing , name = "spacing" , sep = "/" , size = 2 ),
126+ E = Alias (dpi , name = "dpi" ),
127+ F = Alias (scaling , name = "scaling" ),
128+ I = Alias (inverse , name = "inverse" ),
129+ M = Alias (unit , name = "unit" ),
120130 ).add_common (
121131 J = projection ,
122132 R = region ,
0 commit comments