pymrio.MRIOMetaData
- class pymrio.MRIOMetaData(location=None, description=None, name=None, system=None, version=None, path_in_arc='', logger_function=<function info>)
MRIO Meta Data class.
- __init__(location=None, description=None, name=None, system=None, version=None, path_in_arc='', logger_function=<function info>)
Organzise 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.)
- param location
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.
- type location
str, valid path, optional
- param description
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’.
- type description
str, optional
- param name
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’.
- type name
str, optional
- param system
For example ‘industry by industry’, ‘ixi’, … Will be set the first time the metadata file gets established; subsequent changes are recorded in ‘history’.
- type system
str, optional
- param version
Version number Will be set the first time the metadata file gets established; subsequent changes are recorded in ‘history’.
- type version
str, int, float, optional
- param path_in_arc
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.
- type path_in_arc
string, optional
- param logger_function
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.
- type logger_function
func, optional
Methods
__init__([location, description, name, ...])Organzise the MRIO meta data.
change_meta(para, new_value[, log])Change the meta data.
note(entry)Add the passed string as note to the history.
save([location])Save the current status of the metadata.
Attributes
descriptionReturn description entries.
Return all fileio history entries.
Return all recorded history.
metadataReturn the current content.
Return all modification history entries.
nameReturn the name entry.
Return all note history entries.
systemReturn the system entry.
versionReturn version.