muse.readers package

Submodules

muse.readers.csv module

Ensemble of functions to read MUSE data.

read_attribute_table(path)[source]

Read a standard MUSE csv file for price projections.

read_csv_agent_parameters(filename)[source]

Reads standard MUSE agent-declaration csv-files.

Returns a list of dictionaries, where each dictionary can be used to instantiate an agent in muse.agents.factories.factory().

read_csv_outputs(paths, columns='commodity', indices=('RegionName', 'ProcessName', 'Timeslice'), drop=('Unnamed: 0',))[source]

Read standard MUSE output files for consumption or supply.

read_csv_timeslices(path, **kwargs)[source]

Reads timeslice information from input.

read_global_commodities(path)[source]

Reads commodities information from input.

read_initial_assets(filename)[source]

Reads and formats data about initial capacity into a dataframe.

read_initial_market(projections, base_year_import=None, base_year_export=None, timeslices=None)[source]

Read projections, import and export csv files.

read_io_technodata(filename)[source]

Reads process inputs or outputs.

There are four axes: (technology, region, year, commodity)

read_macro_drivers(path)[source]

Reads a standard MUSE csv file for macro drivers.

read_regression_parameters(path)[source]

Reads the regression parameters from a standard MUSE csv file.

read_technodictionary(filename)[source]

Reads and formats technodata into a dataset.

There are three axes: technologies, regions, and year.

read_technologies(technodata_path_or_sector=None, technodata_timeslices_path=None, comm_out_path=None, comm_in_path=None, commodities=None, sectors_directory=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/muse-os/checkouts/latest/docs/data'))[source]

Reads data characterising technologies from files.

Parameters:
  • technodata_path_or_sector – If comm_out_path and comm_in_path are not given, then this argument refers to the name of the sector. The three paths are then determined using standard locations and name. Specifically, thechnodata looks for a “technodataSECTORNAME.csv” file in the standard location for that sector. However, if comm_out_path and comm_in_path are given, then this should be the path to the the technodata file.

  • technodata_timeslices_path – This argument refers to the TechnodataTimeslices file which specifies the utilization factor per timeslice for the specified technology.

  • comm_out_path – If given, then refers to the path of the file specifying output commmodities. If not given, then defaults to “commOUTtechnodataSECTORNAME.csv” in the relevant sector directory.

  • comm_in_path – If given, then refers to the path of the file specifying input commmodities. If not given, then defaults to “commINtechnodataSECTORNAME.csv” in the relevant sector directory.

  • commodities – Optional. If commodities is given, it should point to a global commodities file, or a dataset akin to reading such a file with read_global_commodities. In either case, the information pertaining to commodities will be added to the technologies dataset.

  • sectors_directory – Optional. If paths_or_sector is a string indicating the name of the sector, then this is a path to a directory where standard input files are contained.

Returns:

A dataset with all the characteristics of the technologies.

read_timeslice_shares(path=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/muse-os/checkouts/latest/docs/data'), sector=None, timeslice='Timeslices{sector}.csv')[source]

Reads sliceshare information into a xr.Dataset.

Additionally, this function will try and recover the timeslice multi- index from a import file “Timeslices{sector}.csv” in the same directory as the timeslice shares. Pass None if this behaviour is not required.

muse.readers.toml module

Ensemble of functions to read MUSE data.

read_settings(settings_file, path=None)[source]

Loads the input settings for any MUSE simulation.

Loads a MUSE settings file. This must be a TOML formatted file. Missing settings are loaded from the DEFAULT_SETTINGS. Custom Python modules, if present, are loaded and checks are run to validate the settings and ensure that they are compatible with a MUSE simulation.

Parameters:
  • settings_file – A string or a Path to the settings file

  • path – A string or path to the settings folder

Returns:

A dictionary with the settings

Module contents

Aggregates methods to read data from file.

DEFAULT_SETTINGS_PATH = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/muse-os/envs/latest/lib/python3.9/site-packages/muse/data/default_settings.toml')

Default settings path.

camel_to_snake(name)[source]

Transforms CamelCase to snake_case.

kebab_to_camel(string)[source]
snake_to_kebab(string)[source]