diff --git a/riskmapjnr/benchmark/defrate_per_class.py b/riskmapjnr/benchmark/defrate_per_class.py index 921b32b..728e757 100644 --- a/riskmapjnr/benchmark/defrate_per_class.py +++ b/riskmapjnr/benchmark/defrate_per_class.py @@ -115,10 +115,12 @@ class is created (see ``tab_file_defrate``). data_for = defor_cat_data[fcc_data > 0] data_defor = defor_cat_data[np.isin(fcc_data, [1, 2])] # nfor_per_cat - cat_for = pd.Categorical(data_for.flatten(), categories=cat) + cat_for = pd.Categorical(data_for.flatten(), + categories=cat) df["nfor"] += cat_for.value_counts().values # ndefor_per_cat - cat_defor = pd.Categorical(data_defor.flatten(), categories=cat) + cat_defor = pd.Categorical(data_defor.flatten(), + categories=cat) df["ndefor"] += cat_defor.value_counts().values # Remove classes with no forest diff --git a/riskmapjnr/defrate_per_cat.py b/riskmapjnr/defrate_per_cat.py index 4400118..8459dff 100644 --- a/riskmapjnr/defrate_per_cat.py +++ b/riskmapjnr/defrate_per_cat.py @@ -113,10 +113,10 @@ def defrate_per_cat(fcc_file, riskmap_file, time_interval, if period == "calibration": data_for = defor_cat_data[fcc_data > 0] data_defor = defor_cat_data[fcc_data == 1] - elif period in ["validation", "confirmation"]: + elif period == "validation": data_for = defor_cat_data[fcc_data > 1] data_defor = defor_cat_data[fcc_data == 2] - elif period == "historical": + elif period in ["historical", "forecast"]: data_for = defor_cat_data[fcc_data > 0] data_defor = defor_cat_data[np.isin(fcc_data, [1, 2])] # nfor_per_cat