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

Use only strings in xarray.Dataset metadata #25

Merged
merged 1 commit into from
Nov 8, 2018
Merged

Use only strings in xarray.Dataset metadata #25

merged 1 commit into from
Nov 8, 2018

Conversation

leouieda
Copy link
Member

@leouieda leouieda commented Nov 8, 2018

The harmonica.load_icgem_gdf function populated the Dataset.attrs
with metadata derived from the file header. Two of these fields
(attributes and attributes_units) were lists. This was fine while
using xarray with netcdf4 but it does not work if trying to use scipy to
save/load the Dataset. And since xarray 0.11 stopped installing
netcdf4 automatically, we can't load our sample gravity and topography
data without adding netcdf4 as a dependency.

Instead of doing that, load_icgem_gdf now converts the metadata to
strings. New copies of the two sample grids have been generated using
scipy (netcdf3).

cc @santis19

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to the docstring, gallery, and/or tutorials.

The `harmonica.load_icgem_gdf` function populated the `Dataset.attrs`
with metadata derived from the file header. Two of these fields
(`attributes` and `attributes_units`) were lists. This was fine while
using xarray with netcdf4 but it does not work if trying to use scipy to
save/load the `Dataset`. And since xarray 0.11 stopped installing
netcdf4 automatically, we can't load our sample gravity and topography
data without adding netcdf4 as a dependency.

Instead of doing that, `load_icgem_gdf` now converts the metadata to
strings. New copies of the two sample grids have been generated using
scipy (netcdf3).
@leouieda leouieda merged commit 6b467c6 into master Nov 8, 2018
@leouieda leouieda deleted the netcdf branch November 8, 2018 03:49
@santisoler
Copy link
Member

I'll take this into account for future implementations.
In my opinion, we should try to minimize the dependencies, and sounds like pydata developers share this thought. And for our needs it does not substantially affect our functions and how we will define Datasets.

@leouieda
Copy link
Member Author

leouieda commented Nov 8, 2018

Yeah, this was a nasty surprise but it should be better now

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.

None yet

2 participants