diff --git a/workflow/scripts/additional_functionality.py b/workflow/scripts/additional_functionality.py index 03fcb9c7..e6670697 100644 --- a/workflow/scripts/additional_functionality.py +++ b/workflow/scripts/additional_functionality.py @@ -544,9 +544,10 @@ def additional_functionality(n, snapshots, snakemake): add_max_capacity_limits(n, investment_year, constraints["limits_capacity_max"]) - h2_import_limits(n, investment_year, constraints["limits_volume_max"]) + if int(snakemake.wildcards.clusters) != 1: + h2_import_limits(n, investment_year, constraints["limits_volume_max"]) - electricity_import_limits(n, investment_year, constraints["limits_volume_max"]) + electricity_import_limits(n, investment_year, constraints["limits_volume_max"]) if investment_year >= 2025: h2_production_limits( diff --git a/workflow/scripts/cluster_wasserstoff_kernnetz.py b/workflow/scripts/cluster_wasserstoff_kernnetz.py index f5f62322..7c7d04e0 100644 --- a/workflow/scripts/cluster_wasserstoff_kernnetz.py +++ b/workflow/scripts/cluster_wasserstoff_kernnetz.py @@ -174,14 +174,17 @@ def aggregate_parallel_pipes(df): wasserstoff_kernnetz = build_clustered_gas_network(df, bus_regions) - wasserstoff_kernnetz[["bus0", "bus1"]] = ( - wasserstoff_kernnetz[["bus0", "bus1"]].apply(sorted, axis=1).apply(pd.Series) - ) + if not wasserstoff_kernnetz.empty: + wasserstoff_kernnetz[["bus0", "bus1"]] = ( + wasserstoff_kernnetz[["bus0", "bus1"]] + .apply(sorted, axis=1) + .apply(pd.Series) + ) - reindex_pipes(wasserstoff_kernnetz, prefix="H2 pipeline") + reindex_pipes(wasserstoff_kernnetz, prefix="H2 pipeline") - wasserstoff_kernnetz["p_min_pu"] = 0 - wasserstoff_kernnetz["p_nom_diameter"] = 0 - wasserstoff_kernnetz = aggregate_parallel_pipes(wasserstoff_kernnetz) + wasserstoff_kernnetz["p_min_pu"] = 0 + wasserstoff_kernnetz["p_nom_diameter"] = 0 + wasserstoff_kernnetz = aggregate_parallel_pipes(wasserstoff_kernnetz) wasserstoff_kernnetz.to_csv(snakemake.output.clustered_h2_network) diff --git a/workflow/scripts/export_ariadne_variables.py b/workflow/scripts/export_ariadne_variables.py index 93c3ea33..f50af2f7 100644 --- a/workflow/scripts/export_ariadne_variables.py +++ b/workflow/scripts/export_ariadne_variables.py @@ -1008,7 +1008,8 @@ def get_primary_energy(n, region): "Store", ("Link", "gas pipeline"), ("Link", "gas pipeline new"), - ] + ], + errors="ignore", ) .groupby("carrier") .sum() @@ -1154,7 +1155,8 @@ def get_primary_energy(n, region): # Assuming renewables are only generators and StorageUnits "Link", "Line", - ] + ], + errors="ignore", ) .filter(like=region) .groupby("carrier") @@ -1232,6 +1234,7 @@ def get_secondary_energy(n, region, _industry_demand): .multiply(MWh2PJ) .drop( ["AC", "DC", "electricity distribution grid"], + errors="ignore", ) ) @@ -1544,7 +1547,7 @@ def get_secondary_energy(n, region, _industry_demand): .groupby(["carrier", "component"]) .sum() .multiply(MWh2PJ) - .drop(["gas pipeline", "gas pipeline new", ("gas", "Store")]) + .drop(["gas pipeline", "gas pipeline new", ("gas", "Store")], errors="ignore") .groupby("carrier") .sum() )