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

Transfer coordinates to output #175

Merged
merged 5 commits into from
Jun 29, 2022
Merged

Transfer coordinates to output #175

merged 5 commits into from
Jun 29, 2022

Conversation

aulemahal
Copy link
Collaborator

This fixes #167.

  • All spatial coordinates of ds_out are transferred to the regridder's output (DataArray or Dataset). A "spatial coordinate" is any member of ds_out.coords whose dimensions are a subset of those of lon and lat.
  • To achieve this relatively elegantly, I modified all the internal properties we set on the regridder object to a simple out_coords dict. If ds_out was passed as a dictionary, the conversion to xarray objects now happens in the __init__.
  • Changed the logic for locstream_out : if the locstreams are passed as DataArrays and they do not have the same dimension, xESMF will raise an error because that doesn't make sense. (before it would only raise an error if they had different lengths).
  • Grid mappings variables are also transferred to the output. However, I don't think cf-xarray has a way to parse those. Thus, I needed to guess their names from the data variables attributes. This means this feature is a bit limited for now, and it feels sketchy for the regridder object to inspect the data of ds_out rather than only the coordinates. A better mechanism should wait for such a feature in cf-xarray.

Other unrelated changes:

  • Fixed a test that failed with python >= 3.8
  • Updated all pre-commit hooks
  • Removed blank panels in the "Comparison of 5 regridding algorithms" notebook.
  • Added a line in CHANGES.rst about the fix in conda's dependencies (Fix dependencies - sparse and numba #168).

After this PR, I think we could publish v0.6.3 to fix the conda builds?

@aulemahal aulemahal requested review from huard and malmans2 June 29, 2022 15:27
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@raphaeldussin
Copy link
Contributor

great job @aulemahal
LGTM as well

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.

Regridding drops coordinates
3 participants