pytesmo.utils module
Module containing utility functions that do not fit into other modules
- pytesmo.utils.array_dropna(*arrs)[source]
Drop elements from input arrays where ANY array is NaN
- Parameters:
*arrs (np.array(s)) – One or multiple numpy arrays of the same length that contain nans
- Returns:
arrs_dropna – Input arrays without NaNs
- Return type:
np.array
- pytesmo.utils.deprecated(message: str | None = None)[source]
Decorator for classes or functions to mark them as deprecated. If the decorator is applied without a specific message (@deprecated()), the default warning is shown when using the function/class. To specify a custom message use it like:
@deprecated(‘Don’t use this function anymore!’).
- Parameters:
message (str, optional (default: None)) – Custom message to show with the DeprecationWarning.
- pytesmo.utils.element_iterable(el)[source]
Test if a element is iterable
- Parameters:
el (object) –
- Returns:
iterable – if True then then el is iterable if Fales then not
- Return type:
boolean
- pytesmo.utils.ensure_iterable(el)[source]
Ensure that an object is iterable by putting it into a list. Strings are handled slightly differently. They are technically iterable but we want to keep the whole.
- pytesmo.utils.interp_uniq(src)[source]
replace non unique values by their linear interpolated value This method interpolates iteratively like it is done in IDL.
- Parameters:
src (numpy.array) – array to ensure uniqueness of
- Returns:
src – interpolated unique values in array of same size as src
- Return type:
numpy.array