From ba409c2f1e1943c57ddc3b63460cd21ba2cd308c Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 6 Feb 2024 13:55:51 +0100 Subject: [PATCH] backwards compatibility with old profile_{tech}.nc files --- scripts/build_renewable_profiles.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/build_renewable_profiles.py b/scripts/build_renewable_profiles.py index 99b177a8..a24045a8 100644 --- a/scripts/build_renewable_profiles.py +++ b/scripts/build_renewable_profiles.py @@ -411,9 +411,13 @@ if __name__ == "__main__": ds["underwater_fraction"] = xr.DataArray(underwater_fraction, [buses]) # select only buses with some capacity and minimal capacity factor + mean_profile = ds["profile"].mean("time") + if "year" in ds.indexes: + mean_profile.max("year") + ds = ds.sel( bus=( - (ds["profile"].mean("time").max("year") > params.get("min_p_max_pu", 0.0)) + (mean_profile > params.get("min_p_max_pu", 0.0)) & (ds["p_nom_max"] > params.get("min_p_nom_max", 0.0)) ) )