pymrio.MRIOMetaData

class pymrio.MRIOMetaData(location=None, description=None, name=None, system=None, version=None, path_in_arc='', logger_function=<function info>)
__init__(location=None, description=None, name=None, system=None, version=None, path_in_arc='', logger_function=<function info>)

Organzises the MRIO meta data

The meta data is stored in a json file.

Note

The parameters ‘description’, ‘name’, ‘system’, and ‘version’ should be set during the establishment of the meta data file. If the meta data file already exists and they are given again, the corresponding entry will be overwritten if replace_existing_meta_content is set to True (with a note in the ‘History’ field.)

Parameters:
  • location (str, valid path, optional) – Path or file for loading a previously saved metadata file and/or saving additional metadata (the method ‘save’ will use this location by default). This can be the full file path or just the storage folder. In the latter case, the filename defined in DEFAULT_FILE_NAMES[‘metadata’] (currently ‘metadata.json’) is assumed. The metadata can also be read from an archived zip file. In this case the data is ‘read only’ and can not be stored back to the same archive directly (writing data as zip archive not implemented yet). This means, that a new file has to be specified when saving the metadata.
  • description (str, optional) – Description of the metadata file purpose and mrio, default set to ‘Metadata file for pymrio’. Will be set the first time the metadata file gets established; subsequent changes are recorded in ‘history’.
  • name (str, optional) – Name of the mrio (e.g. wiod, exiobase) Will be set the first time the metadata file gets established; subsequent changes are recorded in ‘history’.
  • system (str, optional) – For example ‘industry by industry’, ‘ixi’, … Will be set the first time the metadata file gets established; subsequent changes are recorded in ‘history’.
  • version (str, int, float, optional) – Version number Will be set the first time the metadata file gets established; subsequent changes are recorded in ‘history’.
  • path_in_arc (string, optional) – Path to the meta data in a zip file. path_in_arc must be given without leading dot or slash; thus to point to the data in the root of the compressed file pass ‘’, for data in e.g. the folder ‘emissions’ pass ‘emissions/’. Only used if parameter ‘location’ points to a compressed zip file.
  • logger_function (func, optional) – Function accepting strings. The info string written to the metadata is also passed to this function. By default, the funtion is set to logging.info. Set to None for no output.

Methods

__init__([location, description, name, …]) Organzises the MRIO meta data
change_meta(para, new_value[, log]) Changes the meta data
note(entry) Add the passed string as note to the history
save([location]) Saves the current status of the metadata

Attributes

description
file_io_history All fileio history entries
history All recorded history
metadata
modification_history All modification history entries
name
note_history All note history entries
system
version