From cffb001aff7232e83fbe14279d04fbf4fa85705e Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 27 Mar 2021 16:36:01 +1100 Subject: [PATCH 1/2] Check CO2 conc units --- tests/integration/test_ciceroSCM.py | 25 +------------------ .../expected_ciceroscm_test_run_output.json | 24 +++++++++++++++++- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/tests/integration/test_ciceroSCM.py b/tests/integration/test_ciceroSCM.py index 8016d23a..ce5d74bb 100644 --- a/tests/integration/test_ciceroSCM.py +++ b/tests/integration/test_ciceroSCM.py @@ -102,30 +102,7 @@ def test_run( self._check_output(res, expected_output_file, update_expected_values) - # to add into the json file - - # [ - # { - # "variable": "Atmospheric Concentrations|CO2", - # "unit": "ppm", - # "region": "World", - # "year": 2100, - # "scenario": "ssp370", - # "quantile": 1 - # }, - # 2400.88 - # ], - # [ - # { - # "variable": "Emissions|CO2", - # "unit": "Pg/C", - # "region": "World", - # "year": 2100, - # "scenario": "ssp370", - # "quantile": 1 - # }, - # 2400.88 - # ], + assert res.filter(variable="Atmospheric Concentrations|CO2").get_unique_meta("unit", True) == "ppm" @pytest.mark.ciceroscm def test_variable_naming(self, test_scenarios): diff --git a/tests/test-data/expected-integration-output/expected_ciceroscm_test_run_output.json b/tests/test-data/expected-integration-output/expected_ciceroscm_test_run_output.json index da5194df..3bc9d30c 100644 --- a/tests/test-data/expected-integration-output/expected_ciceroscm_test_run_output.json +++ b/tests/test-data/expected-integration-output/expected_ciceroscm_test_run_output.json @@ -151,6 +151,28 @@ "quantile": 0.95 }, 3.6048250000000004 + ], + [ + { + "variable": "Atmospheric Concentrations|CO2", + "region": "World", + "year": 2100, + "scenario": "ssp370", + "unit": "ppm", + "quantile": 1 + }, + 240 + ], + [ + { + "variable": "Emissions|CO2", + "region": "World", + "year": 2100, + "scenario": "ssp370", + "unit": "Pg/C", + "quantile": 1 + }, + 2400.88 ] ] -} \ No newline at end of file +} From a3e65b9428521eb6151a6357c3cf8db9ec33de04 Mon Sep 17 00:00:00 2001 From: Malte Meinshausen Date: Sat, 27 Mar 2021 05:55:02 +0000 Subject: [PATCH 2/2] Add failing test --- tests/integration/test_ciceroSCM.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_ciceroSCM.py b/tests/integration/test_ciceroSCM.py index ce5d74bb..2ac44d58 100644 --- a/tests/integration/test_ciceroSCM.py +++ b/tests/integration/test_ciceroSCM.py @@ -100,9 +100,11 @@ def test_run( quantiles = calculate_quantiles(res, [0, 0.05, 0.17, 0.5, 0.83, 0.95, 1]) assert "run_id" not in quantiles.meta + assert res.filter(variable="Atmospheric Concentrations|CO2").get_unique_meta("unit", True) == "ppm" + assert res.filter(variable="Emissions|CO2").get_unique_meta("unit", True) == "PgC / yr" + self._check_output(res, expected_output_file, update_expected_values) - assert res.filter(variable="Atmospheric Concentrations|CO2").get_unique_meta("unit", True) == "ppm" @pytest.mark.ciceroscm def test_variable_naming(self, test_scenarios):