speasy.core.data_containers module

class speasy.core.data_containers.DataContainer(values: array, meta: Dict = None, name: str = None, is_time_dependent: bool = True)[source]

Bases: DataContainerProtocol[DataContainer]

astype(dtype) DataContainer[source]
copy(name=None)[source]
property dtype
static empty_like(other: DataContainer) DataContainer[source]
static from_dictionary(dictionary: ~typing.Dict[str, str | ~typing.Dict[str, str] | ~typing.List], dtype=<class 'numpy.float64'>) DataContainer[source]
property is_time_dependent: bool
property meta
property name
property nbytes: int
property ndim
static ones_like(other: DataContainer) DataContainer[source]
static reserve_like(other: DataContainer, length: int = 0) DataContainer[source]
reshape(new_shape) DataContainer[source]
select(indices, inplace=False) DataContainer[source]
property shape
to_dictionary(array_to_list=False) Dict[str, object][source]
property unit: str
unit_applied(unit: str = None) DataContainer[source]
property values: array
view(index_range: slice | ndarray)[source]
static zeros_like(other: DataContainer) DataContainer[source]
class speasy.core.data_containers.DataContainerProtocol(*args, **kwargs)[source]

Bases: Protocol[T]

astype(dtype) T[source]
property dtype: dtype
static from_dictionary(dictionary: ~typing.Dict[str, str | ~typing.Dict[str, str] | ~typing.List], dtype=<class 'numpy.float64'>) T[source]
property is_time_dependent: bool
property name: str
property nbytes: int
static reserve_like(other: T, length: int = 0) T[source]
select(indices, inplace=False) T[source]
property shape
to_dictionary(array_to_list=False) Dict[str, object][source]
property unit: str
property values: array
view(index_range: slice | ndarray) T[source]
class speasy.core.data_containers.VariableAxis(values: array = None, meta: Dict = None, name: str = '', is_time_dependent: bool = False, data: DataContainer = None)[source]

Bases: DataContainerProtocol[VariableAxis]

astype(dtype) VariableAxis[source]
property data_container: DataContainer
property dtype: dtype
empty_like() VariableAxis[source]
static from_dictionary(dictionary: Dict[str, str | Dict[str, str] | List], time=None) VariableAxis[source]
property is_time_dependent: bool
property meta: Dict
property name: str
property nbytes: int
ones_like() VariableAxis[source]
static reserve_like(other: VariableAxis, length: int = 0) VariableAxis[source]
select(indices, inplace=False) VariableAxis[source]
property shape
to_dictionary(array_to_list=False) Dict[str, object][source]
property unit: str
property values: array
view(index_range: slice | ndarray) VariableAxis[source]
zeros_like() VariableAxis[source]
class speasy.core.data_containers.VariableTimeAxis(values: array = None, meta: Dict = None, name: str = 'time', data: DataContainer = None)[source]

Bases: DataContainerProtocol[VariableTimeAxis]

astype(dtype) VariableTimeAxis[source]
property data_container: DataContainer
property dtype: dtype
empty_like() VariableTimeAxis[source]
static from_dictionary(dictionary: Dict[str, str | Dict[str, str] | List], time=None) VariableTimeAxis[source]
property is_time_dependent: bool
property meta: Dict
property name: str
property nbytes: int
ones_like() VariableTimeAxis[source]
static reserve_like(other: VariableTimeAxis, length: int = 0) VariableTimeAxis[source]
select(indices, inplace=False) VariableTimeAxis[source]
property shape
to_dictionary(array_to_list=False) Dict[str, object][source]
property unit: str
property values: array
view(index_range: slice | ndarray) VariableTimeAxis[source]
zeros_like() VariableTimeAxis[source]
speasy.core.data_containers.fill_value_mask(values: ndarray, meta: Dict) ndarray | None[source]

Returns a boolean mask of the entries equal to the ISTP FILLVAL, or None when no mask can be computed at all.

None means undecidable, not “nothing matched”: either FILLVAL is absent, or it is a string while the data is numeric, which warns. That second case is a real ISTP pattern rather than a hypothetical – CDAWeb mis-declares some numeric variables’ FILLVAL with a TT2000/EPOCH attribute type, which the data codec stringifies (e.g. ela_att_solution_date), and there is no reliable way to recover the intended numeric sentinel from that mismatch.

A NaN FILLVAL needs no special case: NaN != NaN, so it simply matches nothing, which is right because such data already carries NaN where it means fill.

speasy.core.data_containers.np_build_result_name(func, *args, **kwargs)[source]
speasy.core.data_containers.numpy_supported(cls)[source]
speasy.core.data_containers.scalar_meta(meta: Dict, key: str) Any[source]

Returns a metadata entry, unwrapped from the single-element list CDF attributes arrive in.