diff --git a/Snakefile b/Snakefile index 72b726fc..c043e57a 100644 --- a/Snakefile +++ b/Snakefile @@ -226,7 +226,7 @@ rule simplify_network: network='networks/{network}_s{simpl}.nc', regions_onshore="resources/regions_onshore_{network}_s{simpl}.geojson", regions_offshore="resources/regions_offshore_{network}_s{simpl}.geojson", - clustermaps='resources/clustermaps_{network}_s{simpl}.h5' + busmap='resources/busmap_{network}_s{simpl}.csv' log: "logs/simplify_network/{network}_s{simpl}.log" benchmark: "benchmarks/simplify_network/{network}_s{simpl}" threads: 1 @@ -239,13 +239,14 @@ rule cluster_network: network='networks/{network}_s{simpl}.nc', regions_onshore="resources/regions_onshore_{network}_s{simpl}.geojson", regions_offshore="resources/regions_offshore_{network}_s{simpl}.geojson", - clustermaps=ancient('resources/clustermaps_{network}_s{simpl}.h5'), + busmap=ancient('resources/busmap_{network}_s{simpl}.csv'), tech_costs=COSTS output: network='networks/{network}_s{simpl}_{clusters}.nc', regions_onshore="resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson", regions_offshore="resources/regions_offshore_{network}_s{simpl}_{clusters}.geojson", - clustermaps='resources/clustermaps_{network}_s{simpl}_{clusters}.h5' + busmap="resources/busmap_{network}_s{simpl}_{clusters}.csv", + linemap="resources/linemap_{network}_s{simpl}_{clusters}.csv" log: "logs/cluster_network/{network}_s{simpl}_{clusters}.log" benchmark: "benchmarks/cluster_network/{network}_s{simpl}_{clusters}" threads: 1 diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 732b7f8f..756b3dae 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -35,6 +35,8 @@ Upcoming Release * Use `mamba` (https://github.com/mamba-org/mamba) for faster Travis CI builds (`#196 `_) +* The mappings for clustered lines and buses produced by the ``simplify_network`` and ``cluster_network`` rules changed from Hierarchical Data Format (.h5) to Comma-Separated Values format (.csv) (`#198 `_) + PyPSA-Eur 0.2.0 (8th June 2020) ================================== diff --git a/scripts/cluster_network.py b/scripts/cluster_network.py index a4da7cda..620d8868 100644 --- a/scripts/cluster_network.py +++ b/scripts/cluster_network.py @@ -371,11 +371,7 @@ if __name__ == "__main__": focus_weights=focus_weights) clustering.network.export_to_netcdf(snakemake.output.network) - 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'): - store.put(attr, getattr(clustering, attr), format="table", index=False) + for attr in ('busmap', 'linemap'): #also available: linemap_positive, linemap_negative + getattr(clustering, attr).to_csv(snakemake.output[attr]) cluster_regions((clustering.busmap,)) diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 74ba0a7e..d030a283 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -356,8 +356,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, mode='w') as store: - store.put('busmap_s', busemap_s, format="table", index=False) + busmap_s = reduce(lambda x, y: x.map(y), busmaps[1:], busmaps[0]) + busmap_s.to_csv(snakemake.output.busmap) cluster_regions(busmaps, snakemake.input, snakemake.output)