Skip to content

classes

Module classes contains ...

Pythonic classes accessing underlying C++ objects functionalities

TimeSeriesLibrary

Bases: TimeSeriesProvider

Object that acts as a catalogue with various time series available for retrieval

Under construction...

Source code in uchronia/classes.py
class TimeSeriesLibrary(TimeSeriesProvider):
    """Object that acts as a catalogue with various time series available for retrieval

    Under construction...

    """

    def __init__(
        self,
        handle: CffiData,
        release_native: Callable[[CffiData], None],
        type_id: str = None,
        prior_ref_count: int = 0,
    ):
        super(TimeSeriesLibrary, self).__init__(
            handle, release_native, type_id, prior_ref_count
        )

    def get_dataset_ids(self) -> List[str]:
        """
        Gets the top level data identifiers in a data library (data set)

        Returns:
            List[str]: identifiers for the datasets in this library
        """
        return uds.get_dataset_ids(self)

    def get_dataset(self, data_id: str) -> "NdTimeSeries":
        """
        Gets the data from a library for a given identifier.

        Args:
            data_id (str): character, one data identifier for the data retrieved.

        Returns:
            NdTimeSeries: a uni- or multidimensional time series
        """
        return uds.get_dataset(self, data_id)

    def sub_identifiers(self, identifier:str) -> List[str]:
        """
        Gets the next level data identifier of a top level ID

        Gets the next level data identifier of a top level ID.
        A collection of time series such as one identified by "streamflows" may have
        sub-identifiers such as gauge numbers. A single time series in a data library
        may thus be retrieved by a hierarchical string ID  "streamflows.401221" 401221 is a gauge ID.

        Args:
            identifier (str): character, the top level identifier to test again for next level ids

        Returns:
            List[str] sub-identifiers for a root identifier
        """
        return uts.sub_identifiers(self, identifier)

    def datasets_summaries(self) -> List[str]:
        """Get the summaries of datasets in a library 

        Returns:
            List[str]: short descriptions of all the datasets in this library
        """    
        return uds.datasets_summaries(self)

datasets_summaries()

Get the summaries of datasets in a library

Returns:

Type Description
List[str]

List[str]: short descriptions of all the datasets in this library

Source code in uchronia/classes.py
def datasets_summaries(self) -> List[str]:
    """Get the summaries of datasets in a library 

    Returns:
        List[str]: short descriptions of all the datasets in this library
    """    
    return uds.datasets_summaries(self)

get_dataset(data_id)

Gets the data from a library for a given identifier.

Parameters:

Name Type Description Default
data_id str

character, one data identifier for the data retrieved.

required

Returns:

Name Type Description
NdTimeSeries NdTimeSeries

a uni- or multidimensional time series

Source code in uchronia/classes.py
def get_dataset(self, data_id: str) -> "NdTimeSeries":
    """
    Gets the data from a library for a given identifier.

    Args:
        data_id (str): character, one data identifier for the data retrieved.

    Returns:
        NdTimeSeries: a uni- or multidimensional time series
    """
    return uds.get_dataset(self, data_id)

get_dataset_ids()

Gets the top level data identifiers in a data library (data set)

Returns:

Type Description
List[str]

List[str]: identifiers for the datasets in this library

Source code in uchronia/classes.py
def get_dataset_ids(self) -> List[str]:
    """
    Gets the top level data identifiers in a data library (data set)

    Returns:
        List[str]: identifiers for the datasets in this library
    """
    return uds.get_dataset_ids(self)

sub_identifiers(identifier)

Gets the next level data identifier of a top level ID

Gets the next level data identifier of a top level ID. A collection of time series such as one identified by "streamflows" may have sub-identifiers such as gauge numbers. A single time series in a data library may thus be retrieved by a hierarchical string ID "streamflows.401221" 401221 is a gauge ID.

Parameters:

Name Type Description Default
identifier str

character, the top level identifier to test again for next level ids

required

Returns:

Type Description
List[str]

List[str] sub-identifiers for a root identifier

Source code in uchronia/classes.py
def sub_identifiers(self, identifier:str) -> List[str]:
    """
    Gets the next level data identifier of a top level ID

    Gets the next level data identifier of a top level ID.
    A collection of time series such as one identified by "streamflows" may have
    sub-identifiers such as gauge numbers. A single time series in a data library
    may thus be retrieved by a hierarchical string ID  "streamflows.401221" 401221 is a gauge ID.

    Args:
        identifier (str): character, the top level identifier to test again for next level ids

    Returns:
        List[str] sub-identifiers for a root identifier
    """
    return uts.sub_identifiers(self, identifier)

TimeSeriesMixin

Mixin interface for time series objects of various dimensionality

Source code in uchronia/classes.py
class TimeSeriesMixin:
    """Mixin interface for time series objects of various dimensionality"""

    def __init__(self):
        super(TimeSeriesMixin, self).__init__()

    def get_item(self, i: int, convert_to_xr=True):
        return uts.get_item(self, i, convert_to_xr)

    def as_xarray(self):
        return uts.as_xarray(self)

TimeSeriesProvider

Bases: DeletableCffiNativeHandle

TimeSeriesProvider is an interface for objects that can provide time series.

Under construction...

Source code in uchronia/classes.py
class TimeSeriesProvider(DeletableCffiNativeHandle):
    """TimeSeriesProvider is an interface for objects that can provide time series.

    Under construction...

    """

    def __init__(
        self,
        handle: CffiData,
        release_native: Callable[[CffiData], None],
        type_id: str = None,
        prior_ref_count: int = 0,
    ):
        super(TimeSeriesProvider, self).__init__(
            handle, release_native, type_id, prior_ref_count
        )