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

ENH: support exporting individual variables in DataCatalog.export_data #302

Merged
merged 5 commits into from
Apr 3, 2023

Conversation

DirkEilander
Copy link
Contributor

fixes #301

@Tjalling-dejong Tjalling-dejong self-requested a review March 10, 2023 15:21
Copy link
Contributor

@Tjalling-dejong Tjalling-dejong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A section of the to_file() method in geodataset.py requires some more tests. Besides that the PR looks good to me.

Comment on lines +148 to +158
if variables is None:
encoding = {k: {"zlib": True} for k in dvars}
fn_out = join(data_root, f"{data_name}.nc")
obj.to_netcdf(fn_out, encoding=encoding)
else: # save per variable
if not os.path.isdir(join(data_root, data_name)):
os.makedirs(join(data_root, data_name))
for var in dvars:
fn_out = join(data_root, data_name, f"{var}.nc")
obj[var].to_netcdf(fn_out, encoding={var: {"zlib": True}})
fn_out = join(data_root, data_name, "{variable}.nc")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is not covered by tests yet. Check the coverage report.

@DirkEilander
Copy link
Contributor Author

Thanks @Tjalling-dejong for extending the tests!

@DirkEilander DirkEilander merged commit 502040a into main Apr 3, 2023
@DirkEilander DirkEilander deleted the data_catalog/export branch April 3, 2023 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: support exporting individual variables in DataCatalog.export_data
2 participants