25
25
V = "verbose" ,
26
26
f = "coltypes" ,
27
27
r = "registration" ,
28
+ x = "cores" ,
28
29
)
29
30
@kwargs_to_strings (I = "sequence" , R = "sequence" )
30
31
def grdfilter (grid , ** kwargs ):
31
32
r"""
32
33
Filter a grid in the space (or time) domain.
33
34
34
- Filter a grid file in the time domain using one of the selected convolution
35
- or non-convolution isotropic or rectangular filters and compute distances
36
- using Cartesian or Spherical geometries. The output grid file can
37
- optionally be generated as a sub-region of the input (via ``region``)
35
+ Filter a grid file in the space (or time) domain using one of the selected
36
+ convolution or non-convolution isotropic or rectangular filters and compute
37
+ distances using Cartesian or Spherical geometries. The output grid file
38
+ can optionally be generated as a sub-region of the input (via ``region``)
38
39
and/or with new increment (via ``spacing``) or registration
39
40
(via ``toggle``). In this way, one may have "extra space" in the input
40
41
data so that the edges will not be used and the output can be within one
@@ -48,67 +49,63 @@ def grdfilter(grid, **kwargs):
48
49
Parameters
49
50
----------
50
51
grid : str or xarray.DataArray
51
- The file name of the input grid or the grid loaded as a DataArray.
52
+ The file name of the input grid or the grid loaded as a
53
+ :class:`xarray.DataArray`.
52
54
outgrid : str or None
53
55
The name of the output netCDF file with extension .nc to store the grid
54
56
in.
55
57
filter : str
56
- **b**\|\ **c**\|\ **g**\|\ **o**\|\ **m**\|\ **p**\|\ **h**\ *xwidth *\
58
+ **b**\|\ **c**\|\ **g**\|\ **o**\|\ **m**\|\ **p**\|\ **h**\ *width *\
57
59
[/*width2*\][*modifiers*].
58
- Name of filter type you which to apply, followed by the width:
60
+ Name of the filter type you wish to apply, followed by the * width* :
59
61
60
- b: Box Car
62
+ - **b** - Box Car
63
+ - **c** - Cosine Arch
64
+ - **g** - Gaussian
65
+ - **o** - Operator
66
+ - **m** - Median
67
+ - **p** - Maximum Likelihood probability
68
+ - **h** - Histogram
61
69
62
- c: Cosine Arch
63
-
64
- g: Gaussian
65
-
66
- o: Operator
67
-
68
- m: Median
69
-
70
- p: Maximum Likelihood probability
71
-
72
- h: histogram
73
70
distance : str
74
- Distance *flag* tells how grid (x,y) relates to filter width as
75
- follows:
71
+ State how the grid (x,y) relates to the filter *width*:
76
72
77
- p: grid (px,py) with *width* an odd number of pixels; Cartesian
78
- distances.
79
-
80
- 0: grid (x,y) same units as *width*, Cartesian distances.
81
-
82
- 1: grid (x,y) in degrees, *width* in kilometers, Cartesian distances.
83
-
84
- 2: grid (x,y) in degrees, *width* in km, dx scaled by cos(middle y),
85
- Cartesian distances.
73
+ - ``"p"``: grid (px,py) with *width* an odd number of pixels,
74
+ Cartesian distances.
75
+ - ``"0"``: grid (x,y) same units as *width*, Cartesian distances.
76
+ - ``"1"``: grid (x,y) in degrees, *width* in kilometers, Cartesian
77
+ distances.
78
+ - ``"2"``: grid (x,y) in degrees, *width* in km, dx scaled by
79
+ cos(middle y), Cartesian distances.
86
80
87
81
The above options are fastest because they allow weight matrix to be
88
82
computed only once. The next three options are slower because they
89
83
recompute weights for each latitude.
90
84
91
- 3: grid (x,y) in degrees, *width* in km, dx scaled by cosine(y),
92
- Cartesian distance calculation.
93
-
94
- 4: grid (x,y) in degrees, *width* in km, Spherical distance
95
- calculation.
96
-
97
- 5: grid (x,y) in Mercator ``projection="m1"`` img units, *width* in km,
98
- Spherical distance calculation.
85
+ - ``"3"``: grid (x,y) in degrees, *width* in km, dx scaled by cos(y),
86
+ Cartesian distance calculation.
87
+ - ``"4"``: grid (x,y) in degrees, *width* in km, Spherical distance
88
+ calculation.
89
+ - ``"5"``: grid (x,y) in Mercator ``projection="m1"`` img units,
90
+ *width* in km, Spherical distance calculation.
99
91
100
92
{spacing}
101
93
nans : str or float
102
94
**i**\|\ **p**\|\ **r**.
103
- Determine how NaN-values in the input grid affects the filtered output.
95
+ Determine how NaN-values in the input grid affect the filtered output.
96
+ Use **i** to ignore all NaNs in the calculation of the filtered value
97
+ [Default]. **r** is same as **i** except if the input node was NaN then
98
+ the output node will be set to NaN (only applies if both grids are
99
+ co-registered). **p** will force the filtered value to be NaN if any
100
+ grid nodes with NaN-values are found inside the filter circle.
104
101
{region}
105
102
toggle : bool
106
- Toggle the node registration for the output grid so as to become the
107
- opposite of the input grid. [Default gives the same registration as the
108
- input grid].
103
+ Toggle the node registration for the output grid to get the opposite of
104
+ the input grid [Default gives the same registration as the input grid].
109
105
{verbose}
110
106
{coltypes}
111
107
{registration}
108
+ {cores}
112
109
113
110
Returns
114
111
-------
0 commit comments