diff --git a/message_ix_models/project/edits/__init__.py b/message_ix_models/project/edits/__init__.py index da9dca5039..ea0233b1c6 100644 --- a/message_ix_models/project/edits/__init__.py +++ b/message_ix_models/project/edits/__init__.py @@ -10,6 +10,7 @@ from sdmx.model.common import Codelist from sdmx.model.v21 import DataStructureDefinition +from message_ix_models.tools.exo_data import ExoDataSource from message_ix_models.util import local_data_path if TYPE_CHECKING: @@ -156,6 +157,21 @@ def _transform(value: Any) -> str: } +class PASTA(ExoDataSource): + """Retrieve and process PASTA data for use in MESSAGEix-Transport.""" + + id = "PASTA" + + def __init__(self, source, source_kw): + if not source == self.id: + raise ValueError(source) + + self.raise_on_extra_kw(source_kw) + + def __call__(self): + raise NotImplementedError + + def gen_demand(context: "Context") -> None: """Generate MESSAGEix-Transport demand data from PASTA. diff --git a/message_ix_models/tests/project/test_edits.py b/message_ix_models/tests/project/test_edits.py index 075929ad5b..0ec23ba67f 100644 --- a/message_ix_models/tests/project/test_edits.py +++ b/message_ix_models/tests/project/test_edits.py @@ -2,7 +2,7 @@ import pytest -from message_ix_models.project.edits import gen_demand, pasta_native_to_sdmx +from message_ix_models.project.edits import PASTA, gen_demand, pasta_native_to_sdmx from message_ix_models.util import package_data_path @@ -15,6 +15,11 @@ def test_pasta_data(test_context): copyfile(package_data_path("test", *parts), target) +class TestPASTA: + def test_init(self) -> None: + PASTA("PASTA", {}) + + def test_pasta_native_to_sdmx(test_context, test_pasta_data): pasta_native_to_sdmx()