sup3r.preprocessing.data_handling.exogenous_data_handling.ExoData

class ExoData(steps)[source]

Bases: dict

Special dictionary class for multiple exogenous_data steps

Combine multiple SingleExoDataStep objects

Parameters:

steps (dict) – Dictionary with feature keys each with entries describing whether features should be combined at input, a mid network layer, or with output. e.g. {‘topography’: {‘steps’: [

{‘combine_type’: ‘input’, ‘model’: 0, ‘data’: …,

‘resolution’: …},

{‘combine_type’: ‘layer’, ‘model’: 0, ‘data’: …,

‘resolution’: …}]}}

Each array in in ‘data’ key has 3D or 4D shape: (spatial_1, spatial_2, 1) (spatial_1, spatial_2, n_temporal, 1)

Methods

append(feature, step)

Append steps list for given feature

clear()

copy()

fromkeys([value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

get_combine_type_data(feature, combine_type)

Get exogenous data for given feature which is used according to the given combine_type (input/output/layer) for this model_step.

get_model_step_exo(model_step)

Get the exogenous data for the given model_step from the full list of steps

items()

keys()

pop(k[,d])

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

split_exo_dict(split_step)

Split exogenous_data into two dicts based on split_step.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

append(feature, step)[source]

Append steps list for given feature

get_model_step_exo(model_step)[source]

Get the exogenous data for the given model_step from the full list of steps

Parameters:

model_step (int) – Index of the model to get exogenous data for.

Returns:

model_step_exo (dict) – Dictionary of features each with list of steps which match the given model_step

split_exo_dict(split_step)[source]

Split exogenous_data into two dicts based on split_step. The first dict has only model steps less than split_step. The second dict has only model steps greater than or equal to split_step.

Parameters:

split_step (int) – Step index to use for splitting. To split this into exo data for spatial models and temporal models split_step should be len(spatial_models). If this is for a TemporalThenSpatial model split_step should be len(temporal_models).

Returns:

  • split_exo_1 (dict) – Same as input dictionary but with only entries with ‘model’: model_step where model_step is less than split_step

  • split_exo_2 (dict) – Same as input dictionary but with only entries with ‘model’: model_step where model_step is greater than or equal to split_step

get_combine_type_data(feature, combine_type, model_step=None)[source]

Get exogenous data for given feature which is used according to the given combine_type (input/output/layer) for this model_step.

Parameters:
  • feature (str) – Name of exogenous feature to get data for

  • combine_type (str) – Usage type for requested data. e.g input/output/layer

  • model_step (int | None) – Model step the data will be used for. If this is not None then only steps with self[feature][‘steps’][:][‘model’] == model_step will be searched for data.

Returns:

data (tf.Tensor | np.ndarray) – Exogenous data for given parameters

clear() None.  Remove all items from D.
copy() a shallow copy of D
fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() an object providing a view on D's values