_MeshIndexSet first pass (#7149)#7210
Conversation
* Use Monotonicity error in Cube indexing, plus test coverage. * Implement MeshIndexSetMetadata. * Changes to cube.mesh type hinting. * Create experimental/mesh_coord_indexing.py . * Implement MeshIndexSet. * Render _MeshIndexSet in docs. * Easy CI fixes. * style: pre-commit fixes * Add TODO for later type hinting. * Missing sphinx-needs item. * Remove linkable UGRID footnotes to avoid duplication warning. * Fix doctest. * TODO comments. * Fix doctest. * TODO comment. * Fix doctest. * Achieve an accurate view of Mesh via Dask arrays and timestamps. * Remove Mesh.is_view_of. * Fixes after rough testing. * Prevent overzealous updates. * Disconnect new meshes from original meshes. * Review suggestions. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Templating
This PR includes changes that may be worth sharing via templating. For each file listed below, please either:
- Action the suggestion via a pull request editing/adding the relevant file in the SciTools/.github
templates/directory. 1 - Raise an issue against the SciTools/.github repo for the above action if you really don't have 10mins spare right now. Include an assignee, to avoid it being forgotten.
- Dismiss the suggestion if the changes are not suitable for templating.
You will need to dismiss this review before this PR can be merged. Recommend the reviewer does this as their final action before merging, as this text will continually update as commits come in.
Template candidates
The following changed files are not currently templated, but their parent directories suggest they may be good candidates for a new template to be created:
Footnotes
-
Include this text in the PR body to avoid any notifications about applying the template changes back to the source repo!
@scitools-templating: please no update notification on: iris↩
* Refactor _MeshIndexSet for true lazy support. * Update lib/iris/mesh/components.py * Resolve MyPy failures. * Review comments. * Better naming. * Correct mathematical terminology.
* remove unused import * made _MeshXYMixin get and set state abstract * bonus comments * Add _MeshCoordinateManager as parent ot 1d and 2d * typing with _MeshConnectivityManagerBase * fix typing generator * accounting for dask array in _MeshConnectivityManagerBase indexed (to be discussed) * hacky way to fix test * Sequence check for MeshCoord * _MeshCoordinateManagerBase saves and gets _view_message with state * Raise exception when MeshXY.from_coords is called with MeshCoords * validation to _MeshIndexSet __init__ * Typing _MeshIndexSet. Other areas touched for mypy * Raise exception when saving _MeshIndexSet. Could possibly be done earlier * Added _MeshIndexSet._NOT_IMPLEMENTED * using match-case for _MeshIndexSet._calculate_node_indices and removing the null case because it is handled in the __init__ * Prevent mismatch of location in MeshCoord.__init__ when supplied a _MeshIndexSet * Further typing of _MeshXYMixin * post merge numpy fixes * Added forgotten bonus comment * fixed logic mistake in summary * updating remove_duplicate_nodes in tests to deal with `None`s * Update _MeshIndexSet init validation to use isinstance * remove finished todo * remove completed todos * remove unused import * update _calculate_node_bool_index to use match case * fixed ambiguous truthy and reformatted indexed * updated _MeshIndexSet saving is not yet supported error message * Remove completed todos * fixed from_coords type check and updated error message * improverd _MeshIndexSet.__init__ error messages * removed completed todo * Updated MeshCoord.__getitem__ error message * refactor _MeshCoordinateManagerBase.indexed * Cope with scalar indexing, plus view_message fix. * Updated expected exception messages * Made _MeshIndexSet.__init__ indices more lenient --------- Co-authored-by: Martin Yeo <martin.yeo@metoffice.gov.uk>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7210 +/- ##
==========================================
- Coverage 90.18% 89.86% -0.33%
==========================================
Files 91 92 +1
Lines 25102 25573 +471
Branches 4706 4768 +62
==========================================
+ Hits 22638 22980 +342
- Misses 1685 1789 +104
- Partials 779 804 +25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
* Docstrings for MeshIndexSet work. * More explication. * Indicate default `start_index`. Co-authored-by: pt331 <144435193+pt331@users.noreply.github.com> --------- Co-authored-by: pt331 <144435193+pt331@users.noreply.github.com>
* Barebones tests * assertion fix and allowing for single value index * fixed tests/stock/mesh topology_dimension * Update as_mesh to deal with locations not existing * Copied as_mesh changes from unit tests branch * Applied equality changes offered by @trexfeathers * Remove cube_mesh_node from test_subset_indexing_new_mesh test * updating to full tests - test_subset_indexing_mesh_index_set fails now * Fixed looking at the wrong part of cube and _MeshIndexSet test
Description
Draft PR to 'simulate' the final merge of the
FEATURE_index_setfeature branch.Checklist
Important
The Iris core developers are here to help! If anything below is unclear, just post a comment asking for help 😊
(further reading)
Tip
Things you can trigger on this PR:
9999for this PR's number - to re-trigger the CLA check:https://cla-assistant.io/check/SciTools/iris?pullRequest=9999