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

add bounds property #214

Merged
merged 5 commits into from
Apr 22, 2021
Merged

add bounds property #214

merged 5 commits into from
Apr 22, 2021

Conversation

malmans2
Copy link
Member

@malmans2 malmans2 commented Apr 21, 2021

Closes #210
Closes #215

What should we do with DataArrays, where we can't have bounds because of the extra dimension?

Currently nothing specific is done. For example, when we extract a DataArray from a Dataset, da.cf.bounds is not empty, as we don't pop the bounds attribute from the coordinates. However, da.cf.__repr__ shows Bounds: n/a as the bounds variables are not present.

Should cf.bounds only include variables present in the object (and warn about missing bounds)?
Should cf.bounds be a property of Datasets only?
Should we pop the bounds attribute from coordinates when extracting a DataArray?
Should we only show Bounds in the representation of Datasets?

  • Tests
  • API docs
  • What's new

@codecov-commenter
Copy link

codecov-commenter commented Apr 21, 2021

Codecov Report

Merging #214 (2f701c3) into main (64e8695) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #214      +/-   ##
==========================================
+ Coverage   96.27%   96.32%   +0.04%     
==========================================
  Files          12       12              
  Lines        1505     1525      +20     
==========================================
+ Hits         1449     1469      +20     
  Misses         56       56              
Flag Coverage Δ
unittests 96.32% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cf_xarray/accessor.py 95.09% <100.00%> (+0.08%) ⬆️
cf_xarray/tests/test_accessor.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64e8695...2f701c3. Read the comment docs.

Copy link
Contributor

@dcherian dcherian left a comment

Choose a reason for hiding this comment

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

Thanks! Looks great

@dcherian
Copy link
Contributor

dcherian commented Apr 21, 2021

I think we can raise an error for da.cf.bounds.

it's pretty easy to just do da.attrs["bounds"] or da.bounds to get a string...

The current repr is fine IMO. We can update is someone complains

@dcherian dcherian merged commit 36b98fe into xarray-contrib:main Apr 22, 2021
dcherian added a commit to jukent/cf-xarray that referenced this pull request Jun 8, 2021
* main: (57 commits)
  Add CITATION.cff, tributors, zenodo.json (xarray-contrib#231)
  Add zenodo badge
  Improve `rename_like` (xarray-contrib#222)
  Don't apply mappers to DataArrays (xarray-contrib#227)
  Add unit support to cf-xarray (xarray-contrib#197)
  Update README.rst
  Add earthcube 2021 notebook link to readme
  v0.5.2
  Some CMIP6 support
  Add pooch to binder environment (xarray-contrib#223)
  `add_bounds` uses `keys` rather than `dims` (xarray-contrib#221)
  Add .cf.formula_terms (xarray-contrib#213)
  Update whats-new.rst (xarray-contrib#217)
  add bounds property (xarray-contrib#214)
  Update some tests.
  Compile regexes
  Fix black
  Add __version__ (xarray-contrib#208)
  add skip to rename_like (xarray-contrib#206)
  Refactor out coordinate criteria to criteria.py (xarray-contrib#205)
  ...
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.

Revise cf.standard_names docstring Add cf.bounds?
3 participants