diff --git a/primap2/_convert.py b/primap2/_convert.py index ffc19e5..e26baa3 100644 --- a/primap2/_convert.py +++ b/primap2/_convert.py @@ -186,7 +186,7 @@ def _fill_category( # if there is more than one category on the target side if len(output_selection[new_dim]) > 1: new_category = create_category_name(rule) - new_categories = list(da.indexes["category (IPCC2006)"]) + [new_category] + new_categories = [*da.indexes["category (IPCC2006)"], new_category] da = da.reindex({"category (IPCC2006)": new_categories}, fill_value=np.nan) new_output_selection = output_selection.copy() new_output_selection[new_dim] = new_category diff --git a/primap2/tests/test_convert.py b/primap2/tests/test_convert.py index 1f9ad96..be290d0 100644 --- a/primap2/tests/test_convert.py +++ b/primap2/tests/test_convert.py @@ -187,7 +187,7 @@ def test_convert_BURDI(empty_ds: xr.Dataset): (result.pr.loc[{"category": "3.C.7"}] == 1.0 * primap2.ureg("Gg CO2 / year")).all().item() ) # rule 2.E + 2.B -> 2.B - # 2.B is part of PRIMAP categories, but cannot be retrieved from conversion + # 2.E is part of PRIMAP categories, but cannot be retrieved from conversion assert np.isnan(result.pr.loc[{"category": "2.E"}].values).all() # cat 14638 in BURDI equals cat M.BIO in IPCC2006_PRIMAP assert (