Store the busmaps underlying the simplification process as busmap_s
This commit is contained in:
parent
21968a5d77
commit
fd026f4072
@ -100,7 +100,8 @@ rule simplify_network:
|
|||||||
output:
|
output:
|
||||||
network='networks/{network}_s{simpl}.nc',
|
network='networks/{network}_s{simpl}.nc',
|
||||||
regions_onshore="resources/regions_onshore_{network}_s{simpl}.geojson",
|
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}"
|
benchmark: "benchmarks/simplify_network/{network}_s{simpl}"
|
||||||
threads: 1
|
threads: 1
|
||||||
resources: mem_mb=4000
|
resources: mem_mb=4000
|
||||||
@ -110,7 +111,8 @@ rule cluster_network:
|
|||||||
input:
|
input:
|
||||||
network='networks/{network}_s{simpl}.nc',
|
network='networks/{network}_s{simpl}.nc',
|
||||||
regions_onshore="resources/regions_onshore_{network}_s{simpl}.geojson",
|
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:
|
output:
|
||||||
network='networks/{network}_s{simpl}_{clusters}.nc',
|
network='networks/{network}_s{simpl}_{clusters}.nc',
|
||||||
regions_onshore="resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson",
|
regions_onshore="resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson",
|
||||||
|
@ -206,6 +206,9 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
clustering.network.export_to_netcdf(snakemake.output.network)
|
clustering.network.export_to_netcdf(snakemake.output.network)
|
||||||
with pd.HDFStore(snakemake.output.clustermaps, model='w') as store:
|
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'):
|
for attr in ('busmap', 'linemap', 'linemap_positive', 'linemap_negative'):
|
||||||
store.put(attr, getattr(clustering, attr), format="table", index=False)
|
store.put(attr, getattr(clustering, attr), format="table", index=False)
|
||||||
|
|
||||||
|
@ -219,4 +219,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
n.export_to_netcdf(snakemake.output.network)
|
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)
|
cluster_regions(busmaps, snakemake.input, snakemake.output)
|
||||||
|
Loading…
Reference in New Issue
Block a user