API Reference
geomedian(in_array, **kwargs)
Compute the geomedian of a 4D array (y, x, band, time).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_array
|
ndarray
|
Input array with shape (y, x, band, time). |
required |
**kwargs
|
Additional keyword arguments for geomedian computation. - num_threads (int, optional): Number of threads to use. Default is 1. - eps (float, optional): Convergence threshold. Default is 1e-6. - maxiters (int, optional): Maximum number of iterations. Default is 1000. - scale (float, optional): Scaling factor for integer arrays. Default is 1.0. - offset (float, optional): Offset for integer arrays. Default is 0.0. - nodata (int or float, optional): Nodata value for the array. Default depends on dtype. |
{}
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Geomedian array with shape (y, x, band). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If input array does not have 4 dimensions. |
TypeError
|
If input dtype is not supported. |
Source code in datacube_compute/__init__.py
geomedian_block_processor(input, nodata=None, scale=1, offset=0, eps=1e-06, maxiters=1000, num_threads=1, dim='time', is_float=True)
Process a chunk of an xarray Dataset to compute the geomedian and MADS statistics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
Dataset
|
Input dataset chunk. |
required |
nodata
|
int or float
|
Nodata value. If None, will be inferred from input attributes. |
None
|
scale
|
float
|
Scaling factor for integer arrays. Default is 1. |
1
|
offset
|
float
|
Offset for integer arrays. Default is 0. |
0
|
eps
|
float
|
Convergence threshold. Default is 1e-6. |
1e-06
|
maxiters
|
int
|
Maximum number of iterations. Default is 1000. |
1000
|
num_threads
|
int
|
Number of threads to use. Default is 1. |
1
|
dim
|
str
|
Name of the time/spec dimension. Default is "time". |
'time'
|
is_float
|
bool
|
If True, input is assumed to be float32, else integer. Default is True. |
True
|
Returns:
| Type | Description |
|---|---|
Dataset
|
xr.Dataset: Dataset containing geomedian, emad, smad, bcmad, and count arrays. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If multiple nodata values are found in input data variables. |
Source code in datacube_compute/__init__.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
geomedian_with_mads(src, scale=1.0, offset=0.0, eps=None, maxiters=1000, num_threads=1, work_chunks=(100, 100), is_float=True, nodata=None)
Compute Geomedian on Dask backed Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
Dataset or DataArray
|
Input data, bands can be either float or integer with nodata values to indicate gaps in data. |
required |
scale
|
float
|
Only used when input contains integer values. Geomedian will run on scaled values |
1.0
|
offset
|
float
|
See scale param above. Default is 0.0. |
0.0
|
eps
|
float
|
Termination criteria passed on to geomedian algorithm. Default is None. |
None
|
maxiters
|
int
|
Maximum number of iterations done per output pixel. Default is 1000. |
1000
|
num_threads
|
int
|
Configure internal concurrency of the Geomedian computation. Default is 1. |
1
|
work_chunks
|
tuple of int
|
Default is (100, 100), only applicable when input is Dataset. |
(100, 100)
|
is_float
|
bool
|
If True, input is assumed to be float32, if False, input is integer. Default is True. |
True
|
nodata
|
int or float
|
Nodata value to use, if not provided it will be taken from input attributes. |
None
|
Returns:
| Type | Description |
|---|---|
Dataset
|
xr.Dataset: Geomedian and associated statistics as a Dataset. |
Source code in datacube_compute/__init__.py
percentile(in_array, percentiles, nodata=None)
Calculates the percentiles of the input data along the first axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_array
|
ndarray
|
Input array with shape (t, *other dims). |
required |
percentiles
|
sequence of float or float
|
Sequence of percentiles or a single percentile in the [0.0, 1.0] range. |
required |
nodata
|
same dtype as in_array
|
The nodata value. Must be provided for integer datatypes. For float types, this value is ignored and nodata is assumed to be NaN. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Array with shape (len(percentiles), *other dims), where the first index corresponds to the percentiles. |