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

Mergeback of "Feature _split_attrs" branch #5152

Merged
merged 20 commits into from Nov 21, 2023
Merged

Conversation

pp-mo
Copy link
Member

@pp-mo pp-mo commented Feb 8, 2023

PURELY DRAFT : do not merge
The purpose of this is to spot when we get any conflicts with main.

OK, following inclusion of #5595 this is now a fully-formed proposal to merge !

Don't forget : a merge commit is wanted (for which a core dev is needed to make a temporary permissions change)
~-- I.E. it should not be squashed.@
OK scrub that too -- we can just squash, I think.

* Convert Test___eq__ to pytest.

* Convert Test_combine to pytest.

* Convert Test_difference to pytest.

* Review changes.
@trexfeathers trexfeathers added the Type: Feature Branch Highlight this for a feature branch label Feb 15, 2023
@trexfeathers trexfeathers linked an issue Feb 20, 2023 that may be closed by this pull request
pp-mo and others added 5 commits February 20, 2023 14:17
Merge-forward to FEATURE_split_attrs
* Tests for attribute handling in netcdf load/save.

* Tidy test functions.

* Fix import order exception.

* Add cf-global attributes test.

* Towards more pytest-y implemenation.

* Replace 'create_testcase' with fixture which also handles temporary directory.

* Much tidy; use fixtures to parametrise over multiple attributes.

* Fix warnings; begin data-style attrs tests.

* Tests for data-style attributes.

* Simplify setup fixture + improve docstring.

* No parallel test runner, to avoid error for Python>3.8.

* Fixed for new-style netcdf module.

* Small review changes.

* Rename attributes set 'data-style' as 'local-style'.

* Simplify use of fixtures; clarify docstrings/comments and improve argument names.

* Clarify testing sections for different attribute 'styles'.

* Re-enable parallel testing.

* Sorted params to avoid parallel testing bug - pytest#432.

* Rename test functions to make alpha-order match order in class.

* Split netcdf load/save attribute testing into separate sourcefile.

* Add tests for loaded cube attributes; refactor to share code between Load and Roundtrip tests.

* Add tests for attribute saving.

* Fix method names in comments.

* Clarify source of Conventions attributes.

* Explain the test numbering in TestRoundtrip/TestLoad.

* Remove obsolete test helper method.

* Fix small typo; Fix numbering of testcases in TestSave.
* Implement split cube attributes.

* Test fixes.

* Modify examples for simpler metadata printouts.

* Added tests, small behaviour fixes.

* Simplify copy.

* Fix doctests.

* Skip doctests with non-replicable outputs (from use of sets).

* Tidy test comments, and add extra test.

* Tiny typo.

* Remove redundant redefinition of Cube.attributes.

* Add CubeAttrsDict in module __all__ + improve docs coverage.

* Review changes - small test changes.

* More review changes.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix CubeAttrsDict example docstrings.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Odd small fixes.

* Improved docstrings and comments; fix doctests.

* Don't sidestep netcdf4 thread-safety.

* Publicise LimitedAttributeDict, so CubeAttrsDict can refer to it.

* Fix various internal + external links.

* Update lib/iris/cube.py

Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>

* Update lib/iris/cube.py

Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>

* Update lib/iris/cube.py

Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>

* Update lib/iris/cube.py

Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>

* Streamline docs.

* Review changes.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (20393cc) 89.55% compared to head (842676f) 89.63%.
Report is 1 commits behind head on main.

Files Patch % Lines
lib/iris/cube.py 96.15% 2 Missing and 2 partials ⚠️
lib/iris/fileformats/netcdf/saver.py 94.11% 3 Missing and 1 partial ⚠️
lib/iris/__init__.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5152      +/-   ##
==========================================
+ Coverage   89.55%   89.63%   +0.08%     
==========================================
  Files          89       90       +1     
  Lines       22495    22711     +216     
  Branches     5351     5418      +67     
==========================================
+ Hits        20146    20358     +212     
- Misses       1616     1619       +3     
- Partials      733      734       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pp-mo and others added 2 commits July 21, 2023 15:08
* Distinguish local+global attributes in netcdf loads.

* Small test fixes.

* Small doctest fix.

* Fix attribute load-save tests for new behaviour, and old-behaviour equivalence.
* Clarification in CubeAttrsDict examples.

* CubeAttrsDict fix docstring typo.

* Raise awareness of split attributes in user guide.

* What's New entry.

* Changes to metadata documentation.
@pp-mo pp-mo self-assigned this Aug 30, 2023
* Add docs and future switch, no function yet.

* Typing enables code completion for Cube.attributes.

* Make roundtrip checking more precise + improve some tests accordingly (cf. #5403).

* Rework all tests to use common setup + results-checking code.

* Saver supports split-attributes saving (no tests yet).

* Tiny docs fix.

* Explain test routines better.

* Fix init of FUTURE object.

* Remove spurious re-test of FUTURE.save_split_attrs.

* Don't create Cube attrs of 'None' (n.b. but no effect as currently used).

* Remove/repair refs to obsolete routines.

* Check all warnings from save operations.

* Remove TestSave test numbers.

* More save cases: no match with missing, and different cube attribute types.

* Run save/roundtrip tests both with+without split saves.

* Fix.

* Review changes.

* Fix changed warning messages.

* Move warnings checking from 'run' to 'check' phase.

* Simplify and improve warnings checking code.

* Fix wrong testcase.

* Minor review changes.

* Fix reverted code.

* Use sets to simplify demoted-attributes code.

* WIP

* Working with iris 3.6.1, no errors TestSave or TestRoundtrip.

* Interim save (incomplete?).

* Different results form for split tests; working for roundtrip.

* Check that all param lists are sorted.

* Check matrix result-files compatibility; add test_save_matrix.

* test_load_matrix added; two types of load result.

* Finalise special-case attributes.

* Small docs tweaks.

* Add some more testcases,

* Ensure valid sort-order for globals of possibly different types.

* Initialise matrix results with legacy values from v3.6.1 -- all matching.

* Add full current matrix results, i.e. snapshot current behaviours.

* Review changes : rename some matrix testcases, for clarity.
@trexfeathers
Copy link
Contributor

@pp-mo are you comfortable with everything on the project? There are a few things in the No Status column and I'm not certain whether anything is supposed to be happening there.

* Define common-metadata operartions on split attribute dictionaries.

* Tests for split-attributes handling in CubeMetadata operations.

* Small tidy and clarify.

* Common metadata ops support mixed split/unsplit attribute dicts.

* Clarify with better naming, comments, docstrings.

* Remove split-attrs handling to own sourcefile, and implement as a decorator.

* Remove redundant tests duplicated by matrix testcases.

* Newstyle split-attrs matrix testing, with fewer testcases.

* Small improvements to comments + docstrings.

* Fix logic for equals expectation; expand primary/secondary independence test.

* Clarify result testing in metadata operations decorator.
@trexfeathers
Copy link
Contributor

Just this one left 🤞

@pp-mo
Copy link
Member Author

pp-mo commented Nov 15, 2023

@pp-mo are you comfortable with everything on the project? There are a few things in the No Status column and I'm not certain whether anything is supposed to be happening there.

I'm reviewing those now.
I also checked the mergeback conflicts yesterday : it shows that resolving the conflicts is pretty straightforward 😃

@pp-mo pp-mo mentioned this pull request Nov 15, 2023
pp-mo and others added 5 commits November 17, 2023 13:30
* Add tests in advance for split-attributes handling cases.

* Move dict conversion inside utility, for use elsewhere.

* Add support for split-attributes to equalise_attributes.

* Update lib/iris/util.py

Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>

* Update lib/iris/tests/unit/util/test_equalise_attributes.py

Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>

* Simplify and clarify equalise_attributes code.

---------

Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>
* Extra CubeAttrsDict methods to emulate dictionary behaviours.

* Don't use staticmethod on fixture.
@pp-mo pp-mo closed this Nov 21, 2023
@pp-mo pp-mo reopened this Nov 21, 2023
* Small improvement to split-attrs whatsnew.

* Emit deprecation warning when saving without split-attrs enabled.

* Stop legacy-split-attribute warnings from upsetting delayed-saving tests.
@pp-mo pp-mo marked this pull request as ready for review November 21, 2023 13:51
Copy link
Contributor

@ESadek-MO ESadek-MO left a comment

Choose a reason for hiding this comment

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

Had a brief look at the doc side, and otherwise all looks good to me!
Good job @pp-mo, and all your sidekicks on this one, super cool.

@ESadek-MO ESadek-MO merged commit 5b93be6 into main Nov 21, 2023
25 checks passed
@ESadek-MO ESadek-MO deleted the FEATURE_split_attrs branch November 21, 2023 14:51
tkknight added a commit to tkknight/iris that referenced this pull request Nov 27, 2023
* upstream/main:
  Mergeback of `FEATURE_chunk_control` branch (SciTools#5588)
  [CI Bot] environment lockfiles auto-update (SciTools#5547)
  Mergeback of "Feature _split_attrs" branch (SciTools#5152)
  add whatsnew (SciTools#5596)
  Refactor area weighted regridding, improve performance (SciTools#5543)
  Allowing exemption to axis guessing on coords (SciTools#5551)
tkknight added a commit to tkknight/iris that referenced this pull request Dec 6, 2023
* main:
  DOCS: Numpydocs1 (SciTools#5578)
  add links to scitools-classroom repo. (SciTools#5609)
  Feedstock rc branch management in do-nothing script (SciTools#5515)
  Relocated the Technical Papers documentation to Further Topics.  (SciTools#5602)
  Fix pp save of realization coordinate (SciTools#5568)
  Bump actions/checkout from 3 to 4 (SciTools#5460)
  Bump actions/github-script from 6 to 7 (SciTools#5580)
  Bump conda-incubator/setup-miniconda from 2 to 3 (SciTools#5607)
  CI: specify matplotlib-base (SciTools#5606)
  Mergeback of `FEATURE_chunk_control` branch (SciTools#5588)
  [CI Bot] environment lockfiles auto-update (SciTools#5547)
  Mergeback of "Feature _split_attrs" branch (SciTools#5152)
  add whatsnew (SciTools#5596)
  Refactor area weighted regridding, improve performance (SciTools#5543)
  Allowing exemption to axis guessing on coords (SciTools#5551)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Branch Highlight this for a feature branch
Projects
Status: 🏁 Done
Development

Successfully merging this pull request may close these issues.

NetCDF global attributes vs data variable local attributes
3 participants