diff --git a/scripts/cluster_network.py b/scripts/cluster_network.py index ed55c24a..c13f2a55 100644 --- a/scripts/cluster_network.py +++ b/scripts/cluster_network.py @@ -208,8 +208,8 @@ if __name__ == "__main__": clustering = clustering_for_n_clusters(n, n_clusters, aggregate_renewables, line_length_factor=line_length_factor) clustering.network.export_to_netcdf(snakemake.output.network) - with pd.HDFStore(snakemake.output.clustermaps, model='w') as store: - with pd.HDFStore(snakemake.input.clustermaps) as clustermaps: + with pd.HDFStore(snakemake.output.clustermaps, mode='w') as store: + with pd.HDFStore(snakemake.input.clustermaps, mode='r') as clustermaps: for attr in clustermaps.keys(): store.put(attr, clustermaps[attr], format="table", index=False) for attr in ('busmap', 'linemap', 'linemap_positive', 'linemap_negative'): diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 2a6116a5..576b3ae5 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -222,7 +222,7 @@ if __name__ == "__main__": n.export_to_netcdf(snakemake.output.network) busemap_s = reduce(lambda x, y: x.map(y), busmaps[1:], busmaps[0]) - with pd.HDFStore(snakemake.output.clustermaps, model='w') as store: + with pd.HDFStore(snakemake.output.clustermaps, mode='w') as store: store.put('busmap_s', busemap_s, format="table", index=False) cluster_regions(busmaps, snakemake.input, snakemake.output)