smif.convert package

In this module, we implement the conversion across space and time

The SpaceTimeConvertor is instantiated with data to convert, and the names of the four source and destination spatio-temporal resolutions.

The convert() method returns a new numpy.ndarray for passing to a sector model.

Submodules:

Classes:

SpaceTimeUnitConvertor Handles the conversion of time and space for a list of values

Reference

class smif.convert.SpaceTimeUnitConvertor[source]

Bases: object

Handles the conversion of time and space for a list of values

Notes

Future development requires using a data object which allows multiple views upon the values across the three dimensions of time, space and units. This will then allow more efficient conversion across any one of these dimensions while holding the others constant. One option could be collections.ChainMap.

convert(data, from_spatial, to_spatial, from_temporal, to_temporal, from_unit, to_unit)[source]

Convert the data from set of regions and intervals to another

Parameters:
  • data (numpy.ndarray) – An array of values with dimensions regions x intervals
  • from_spatial (str) – The name of the spatial resolution of the data
  • to_spatial (str) – The name of the required spatial resolution
  • from_temporal (str) – The name of the temporal resolution of the data
  • to_temporal (str) – The name of the required temporal resolution
  • from_unit (str) – The name of the unit of the data
  • to_unit (str) – The name of the required unit
Returns:

An array of data with dimensions regions x intervals

Return type:

numpy.ndarray