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

Change default CF writer engine to follow xarray defaults #844

Merged
merged 3 commits into from Jul 4, 2019

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Jul 3, 2019

Xarray has default engine choices based on what is available in the current environment. It prefers to use netcdf4-python if available, otherwise scipy. It is also possible to tell xarray to use h5netcdf. Right now Satpy defaults to h5netcdf regardless of what is installed. This has caused unexpected results for some users (at least me) where they're able to read NetCDF files with the abi_l1b reader, but can't write NetCDF files with the cf writer because they don't have h5netcdf installed.

This PR changes the default to None which means "let xarray choose". The biggest issue with doing this is that it seems xarray doesn't use h5netcdf unless it is explicitly asked for. So if someone only had h5netcdf installed or was using an h5netcdf-only feature they would have to explicitly specify the engine. The other better option would be to make our own "try importing these backends and use that backend if successful" where we include h5netcdf as one of the options. Or we could make a PR to xarray to add h5netcdf as one of the options.

The only other thing I considered adding to this PR, similar to the above point, is importing one of the netcdf backends in the module level so that things like available_writers and check_satpy would "know" if one of the dependencies was installed. Thoughts? I'm not sure whether to mark this as a "bug" or "backwards-incompatibility".

This PR also includes some sphinx docs clean up.

  • Tests added and test suite added to parent suite
  • Tests passed
  • Passes flake8 satpy
  • Fully documented

@djhoese djhoese added component:writers backwards-incompatibility Causes backwards incompatibility or introduces a deprecation labels Jul 3, 2019
@djhoese djhoese requested review from mraspaud and sfinkens July 3, 2019 16:19
@djhoese djhoese self-assigned this Jul 3, 2019
@coveralls
Copy link

coveralls commented Jul 3, 2019

Coverage Status

Coverage increased (+0.007%) to 84.092% when pulling f15b74a on djhoese:bugfix-cf-engine into da0cf50 on pytroll:master.

Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM

@djhoese djhoese merged commit 51c5c65 into pytroll:master Jul 4, 2019
@djhoese djhoese deleted the bugfix-cf-engine branch July 4, 2019 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards-incompatibility Causes backwards incompatibility or introduces a deprecation component:writers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants