pyam
pyam copied to clipboard
Read data from ixmp v4.0
Per our discussion on the development of ixmp v4.0, we agreed to implement a new method pyam.read_ixmp()
that queries data and meta indicators (and other dimensions of the data model in the future) from an ixmp Platform instance.
The function should take the following arguments:
- An ixmp.Platform instance or arguments to instantiate an instance (connect to a database)
- Arguments to select runs (model, scenario, version, run-id's) - if not given, read all runs
- Arguments to select IAMC-format datapoints (variable, region, time)
- fail if not provided (*)
- require
variable = *
to read all datapoints
- Arguments to select meta indicators - retrieve none if not provided
These arguments can also be provided as a yaml-file, so there should also be a kwarg config (or similar).
(*) An IamDataFrame cannot be instantiated without data.
fyi @meksor @peterkolp
The implementation strategy should be something like
@classmethod
def read_ixmp(pyam.IamDataFrame, platform, **kwargs):
platform = platform if isinstance(mp, ixmp.Platform) else ixmp.Platform(** platform)
run_ids = < select run-id's >
data = < query data based on run_id's and kwargs >
if meta in kwargs:
meta = < query meta based on run_id's and kwargs >
else:
meta = None
return IamDataFrame(data, meta=meta)
Closing as implemented