as_xarray_dataset
- HIRS4.as_xarray_dataset(M, skip_dimensions=(), rename_dimensions={})
Convert structured ndarray to xarray dataset
From an object with a dtype such as may be returned by self.read, return an xarray dataset.
This method is in flux and its API is currently not stable. There needs to be a proper system of defining the variable names etc.
See tickets 145, 148, 149.
NB: xarray does not support masked arrays (see https://github.com/pydata/xarray/issues/1194). Therefore, I convert each integer type to float/double. To prevent a loss of precision, I double the memory allocation for each, as int8 always fits in float16, int16 always fits in float32, and int32 always fits in float64. Note that assuming the encoding is set correctly in data_vars_props (such as in _tovs_defs) it will still be stored as the appropriate integer type.
- Parameters:
[ndarray] (M) – ndarray of same type as returned by self.read.
[Container[str]] (skip_dimensions) – dimensions that shall not be included. For example, normal HIRS data has a scanpos dimension, HIRS-HIRS collocations do not; to convert collocaitons, pass skip_dimensions=[“scanpos”].
[Mapping[str (rename_dimensions) – dimensions that shall be renamed. For example, for collocations you may want to rename “time” to “scanline” or to “collocation”.
str]] – dimensions that shall be renamed. For example, for collocations you may want to rename “time” to “scanline” or to “collocation”.