diff --git a/nomenclature/processor/region.py b/nomenclature/processor/region.py index a30ad72d..f37b3c68 100644 --- a/nomenclature/processor/region.py +++ b/nomenclature/processor/region.py @@ -323,7 +323,7 @@ def apply(self, df: IamDataFrame, dsd: DataStructureDefinition) -> IamDataFrame: # If no mapping is defined the data frame is returned unchanged if model not in self.mappings: - logger.info(f"No region aggregation mapping found for model {model}") + logger.info(f"No model mapping found for model {model}") processed_dfs.append(model_df) # Otherwise we first rename, then aggregate @@ -331,7 +331,7 @@ def apply(self, df: IamDataFrame, dsd: DataStructureDefinition) -> IamDataFrame: # before aggregating, check that all regions are valid self.mappings[model].validate_regions(dsd) logger.info( - f"Applying region aggregation for model {model} from file " + f"Applying region-processing for model {model} from file " f"{self.mappings[model].file}" ) @@ -408,7 +408,8 @@ def apply(self, df: IamDataFrame, dsd: DataStructureDefinition) -> IamDataFrame: if not processed_dfs: raise ValueError( - f"The region aggregation for model {model} resulted in an empty dataset" + f"The region-processing for model(s) {df.model} returned an empty " + "dataset" ) return pyam.concat(processed_dfs) diff --git a/tests/data/region_processing/rename_only/rename_only.yaml b/tests/data/region_processing/rename_only/model_a.yaml similarity index 100% rename from tests/data/region_processing/rename_only/rename_only.yaml rename to tests/data/region_processing/rename_only/model_a.yaml diff --git a/tests/data/region_processing/rename_only/model_b.yaml b/tests/data/region_processing/rename_only/model_b.yaml new file mode 100644 index 00000000..79b3795f --- /dev/null +++ b/tests/data/region_processing/rename_only/model_b.yaml @@ -0,0 +1,4 @@ +model: model_b +native_regions: + - region_a: region_A + - region_B diff --git a/tests/test_core.py b/tests/test_core.py index cb85a8bf..8dc3830e 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -55,12 +55,12 @@ def test_region_processing_empty_raises(): pd.DataFrame( [ ["model_a", "scen_a", "region_foo", "Primary Energy", "EJ/yr", 1, 2], + ["model_b", "scen_a", "region_foo", "Primary Energy", "EJ/yr", 1, 2], ], columns=IAMC_IDX + [2005, 2010], ) ) - - with pytest.raises(ValueError, match="The region aggregation for model model_a"): + with pytest.raises(ValueError, match=("'model_a', 'model_b'.*empty dataset")): process( test_df, DataStructureDefinition(TEST_DATA_DIR / "region_processing/dsd"),