mlair.data_handler.abstract_data_handler

Module Contents

Classes

AbstractDataHandler

Attributes

__author__

__date__

mlair.data_handler.abstract_data_handler.__author__ = Lukas Leufen
mlair.data_handler.abstract_data_handler.__date__ = 2020-09-21
class mlair.data_handler.abstract_data_handler.AbstractDataHandler(*args, **kwargs)

Bases: object

_requirements = []
_store_attributes = []
_skip_args = ['self']
classmethod build(cls, *args, **kwargs)

Return initialised class.

abstract __len__(self, upsampling=False)
classmethod requirements(cls, skip_args=None)

Return requirements and own arguments without duplicates.

classmethod own_args(cls, *args)

Return all arguments (including kwonlyargs).

classmethod super_args(cls)
classmethod store_attributes(cls)list

Let MLAir know that some data should be stored in the data store. This is used for calculations on the train subset that should be applied to validation and test subset.

To work properly, add a class variable cls._store_attributes to your data handler. If your custom data handler is constructed on different data handlers (e.g. like the DefaultDataHandler), it is required to overwrite the get_store_attributs method in addition to return attributes from the corresponding subclasses. This is not required, if only attributes from the main class are to be returned.

Note, that MLAir will store these attributes with the data handler’s identification. This depends on the custom data handler setting. When loading an attribute from the data handler, it is therefore required to extract the right information by using the class identification. In case of the DefaultDataHandler this can be achieved to convert all keys of the attribute to string and compare these with the station parameter.

get_store_attributes(self)

Returns all attribute names and values that are indicated by the store_attributes method.

classmethod transformation(cls, *args, **kwargs)
abstract apply_transformation(self, data, inverse=False, **kwargs)

This method must return transformed data. The flag inverse can be used to trigger either transformation or its inverse method.

abstract get_X(self, upsampling=False, as_numpy=False)
abstract get_Y(self, upsampling=False, as_numpy=False)
get_data(self, upsampling=False, as_numpy=False)
get_coordinates(self) → Union[None, Dict]

Return coordinates as dictionary with keys lon and lat.

_hash_list(self)