IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
227 stars 118 forks source link

Read data from ixmp v4.0 #721

Closed danielhuppmann closed 5 months ago

danielhuppmann commented 1 year ago

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:

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

danielhuppmann commented 1 year ago

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)
danielhuppmann commented 5 months ago

Closing as implemented