-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fixes for attributes of coordinates #140
Conversation
We should not read or alter ds after updated_ds is created, so delete the reference to ds to avoid errors.
Hello @johnomotani! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-09-10 23:14:44 UTC |
An xarray bug (pydata/xarray#2180 (comment), pydata/xarray#4393, pydata/xarray#4415) can deletes attributes of coordinates when a new DataArray is assigned to a Dataset. This commit adds workarounds for that bug in several places. Also adds checks for if 'ycoord' and 'zcoord' already exist in apply_geometry() before creating them. Helps with re-applying apply_geometry() to existing or re-loaded Datasets.
51fe097
to
451eda4
Compare
Workaround for possible bug with xarray, pydata/xarray#4417, needed for ensuring consistency so we can test for 'identical'.
Using assign_coords() can change existing coordinates on other variables, use a workaround instead to ensure more consistency.
Ensures input is not modified.
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
==========================================
+ Coverage 77.62% 77.69% +0.06%
==========================================
Files 14 14
Lines 2150 2156 +6
Branches 486 487 +1
==========================================
+ Hits 1669 1675 +6
Misses 308 308
Partials 173 173
Continue to review full report at Codecov.
|
A bug in xarray (pydata/xarray#2180 (comment), pydata/xarray#4393, pydata/xarray#4415) can result in attributes being deleted from coordinates when a new DataArray is added to a Dataset. This PR adds workarounds for that bug, and also some other fixes to make sure re-loaded Datasets get coordinates identical to the saved Dataset (including attrs).
Also added a work-around for a second weird possible bug in xarray pydata/xarray#4417.