Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to_hdf compression #665

Merged
merged 1 commit into from
Nov 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tardis/io/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def check_equality(item1, item2):
return True


def to_hdf(path_or_buf, path, elements):
def to_hdf(path_or_buf, path, elements, complevel=9, complib='blosc'):
"""
A function to uniformly store TARDIS data
to an HDF file.
Expand Down Expand Up @@ -217,7 +217,7 @@ def to_hdf(path_or_buf, path, elements):

# Unfortunately, with to_hdf we cannot append, so merge beforehand
scalars_path = os.path.join(path, 'scalars')
with pd.HDFStore(path_or_buf) as store:
with pd.HDFStore(path_or_buf, complevel=complevel, complib=complib) as store:
if scalars_path in store:
scalars_series = store[scalars_path].append(scalars_series)
scalars_series.to_hdf(path_or_buf, os.path.join(path, 'scalars'))
scalars_series.to_hdf(path_or_buf, os.path.join(path, 'scalars'))