Store the busmaps underlying the simplification process as busmap_s

This commit is contained in:
Jonas Hörsch 2018-07-10 16:31:57 +02:00
parent 21968a5d77
commit fd026f4072
3 changed files with 11 additions and 2 deletions

View File

@ -100,7 +100,8 @@ rule simplify_network:
output:
network='networks/{network}_s{simpl}.nc',
regions_onshore="resources/regions_onshore_{network}_s{simpl}.geojson",
regions_offshore="resources/regions_offshore_{network}_s{simpl}.geojson"
regions_offshore="resources/regions_offshore_{network}_s{simpl}.geojson",
clustermaps='resources/clustermaps_{network}_s{simpl}.h5'
benchmark: "benchmarks/simplify_network/{network}_s{simpl}"
threads: 1
resources: mem_mb=4000
@ -110,7 +111,8 @@ rule cluster_network:
input:
network='networks/{network}_s{simpl}.nc',
regions_onshore="resources/regions_onshore_{network}_s{simpl}.geojson",
regions_offshore="resources/regions_offshore_{network}_s{simpl}.geojson"
regions_offshore="resources/regions_offshore_{network}_s{simpl}.geojson",
clustermaps='resources/clustermaps_{network}_s{simpl}.h5'
output:
network='networks/{network}_s{simpl}_{clusters}.nc',
regions_onshore="resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson",

View File

@ -206,6 +206,9 @@ if __name__ == "__main__":
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:
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)

View File

@ -219,4 +219,8 @@ 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:
store.put('busmap_s', busemap_s, format="table", index=False)
cluster_regions(busmaps, snakemake.input, snakemake.output)