atmos_flux_inversion.util module¶
Utility functions for compatibility.
Some functions mirror numpy
functions but produce dask
output. Others map similar functionality across the various methods
to accomplish that end.
-
atmos_flux_inversion.util.
ARRAY_TYPES
= (<class 'numpy.ndarray'>,)¶ Array types for determining Kronecker product type.
These are combined for a direct product.
-
atmos_flux_inversion.util.
MAX_EXPLICIT_ARRAY
= 1024¶ Maximum size for an array represented explicitly.
kronecker_product()
will form products smaller than this as an explicit matrix usinglinalg.kron()
. Arrays larger than this will uselinalg.DaskKroneckerProductOperator
.Currently completely arbitrary. 2 ** 16 works fine in memory, 2**17 gives a
MemoryError
. Hopefully Dask knows not to try this.
-
atmos_flux_inversion.util.
REAL_DTYPE_KINDS
= 'fiu'¶ The kinds used by dtypes to represent real numbers.
Includes subsets.
-
atmos_flux_inversion.util.
kronecker_product
(operator1, operator2)[source]¶ Form the Kronecker product of the given operators.
Delegates to
operator1.kron()
if possible,linalg.kron()
if both areARRAY_TYPES
, orSchmidtKroneckerProduct
otherwise.- Parameters
operator2 (operator1,) – The component operators of the Kronecker product.
- Returns
The kronecker product of the given operators.
- Return type
-
atmos_flux_inversion.util.
method_common
(inversion_method)[source]¶ Wrap method to validate args.
Can also deal with posterior uncertainty for a reduced-resolution domain, where the method opts not to provide that.
- Parameters
inversion_method (function) – The inversion function to wrap.
- Returns
The wrapped function.
- Return type
function