Fix HDFStore writing modes

This commit is contained in:
Jonas Hörsch 2018-09-27 12:18:47 +02:00
parent 52e214a3b2
commit 6635732cb7
2 changed files with 3 additions and 3 deletions

View File

@ -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'):

View File

@ -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)