-
Notifications
You must be signed in to change notification settings - Fork 314
Mesh Documentation #4504
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
Merged
Merged
Mesh Documentation #4504
Changes from 6 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
4fda40c
UGRID docs stub pages.
trexfeathers 1901782
UGRID docs index page.
trexfeathers a6e92ae
Fleshed out UGRID docs stubs.
trexfeathers 83f350c
Correct UGRID docs linkage.
trexfeathers 8cea7f1
Minor adjustments to ugrid/index.rst.
trexfeathers f46ce45
UGRID data model explanation.
trexfeathers f36e9ae
UGRID partner packages docs page.
trexfeathers 9e74b93
Detail on Iris UGRID data model.
trexfeathers 19894ca
UGRID data model docs tweaks.
trexfeathers 77e3f95
Reduced emphasis on UGRID in docs.
trexfeathers c670b92
UGRID partner packages rephrasing.
trexfeathers 4a7f6e2
Remove UGRID partner package comment.
trexfeathers 2b4cce8
Reduced emphasis on UGRID in docs.
trexfeathers eb31ae6
Comment about UGRID data model diagrams.
trexfeathers 226812d
Start documenting UGRID operations examples.
trexfeathers 49f1dc4
Improved linking between UGRID doc pages.
trexfeathers 1d94cc8
UGRID docs review actions.
trexfeathers 9f05718
Example UGRID operations.
trexfeathers 73f3f1b
More UGRID operations documenting.
trexfeathers a0b405c
UGRID docs review actions from @pp-mo.
trexfeathers 3c0e5f8
UGRID docs review actions from @wjbenfold.
trexfeathers ea895e2
Minor UGRID docs corrections.
trexfeathers d8dde31
Merge remote-tracking branch 'upstream/main' into ugrid_docs
trexfeathers 0e96826
UGRID docs updates for new Connectivity names.
trexfeathers 7a27b3f
More example UGRID operations.
trexfeathers aee2be5
UGRID region extraction example tweaks.
trexfeathers 3692c1c
UGRID docs review actions from @lbdreyer.
trexfeathers a315462
Second round UGRID docs review actions from @wjbenfold.
trexfeathers 20113ca
UGRID docs review action from @stephenworsley.
trexfeathers ef47b6b
Add UGRID Operations Summary subheading.
trexfeathers 4a996af
Mention the unstructured dimension more in UGRID docs.
trexfeathers 30c9c69
UGRID docs plotting example.
trexfeathers 954770a
UGRID docs tidy-up.
trexfeathers b8b23e7
UGRID docs plotting example.
trexfeathers d8de567
UGRID docs lat-lon switcheroo.
trexfeathers 4c2b19a
UGRID docs image fix.
trexfeathers 8bc8c84
UGRID data model MeshCoord clarification.
trexfeathers 67b1eb3
Corrected UGRID docs example coords.
trexfeathers d2e504f
UGRID docs more Mesh and Cube printouts.
trexfeathers 970db3c
UGRID docs be more explicit about region extraction.
trexfeathers be5f51b
UGRID docs be more generic about low level languages.
trexfeathers 3d18be7
UGRID docs cubed-sphere example explicitly 2-dimensional.
trexfeathers 5f31e05
Make code-examples copybutton respect line continuations.
pp-mo 2acd327
Merge pull request #8 from pp-mo/ugrid_docs_copybutton
trexfeathers 0761b58
Sphinx copybutton fix.
trexfeathers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,202 @@ | ||
| .. include:: ../../common_links.inc | ||
|
|
||
| .. _ugrid model: | ||
|
|
||
| .. | ||
| The conventions page is [necessarily] not for a layperson. This is an | ||
| opportunity to explain UGRID at an Iris user's level - doesn't need to be | ||
| exhaustive, just get across what is needed for the user to understand why | ||
| their experience will be different to 'normal'. | ||
|
|
||
|
|
||
| The UGRID Data Model | ||
| ******************** | ||
|
|
||
| .. important:: | ||
|
|
||
| This page is intended to summarise what Iris users need to know about | ||
| the UGRID model. For full detail | ||
| `visit the official UGRID conventions site`__. | ||
|
|
||
| Something to note straight away is that UGRID is designed as an addition to the | ||
| existing CF model. It concerns only spatial location of data, and even there | ||
| it can be limited just the horizontal location - X and Y - which is so far the | ||
| most popular use for UGRID. Other dimensions such as time and experimental run | ||
| numbers remain formatted as they always have been. | ||
|
|
||
| What's Different? | ||
| ================= | ||
|
|
||
| The UGRID format represents data's geographic location using an **unstructured | ||
| mesh**. This has significant pros and cons when compared to a structured grid. | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| The Detail | ||
| ---------- | ||
| Structured Grids | ||
|
wjbenfold marked this conversation as resolved.
Outdated
|
||
| ~~~~~~~~~~~~~~~~ | ||
| Assigning data to locations using a structured grid is essentially an act of | ||
| matching coordinate arrays to each dimension of the data array. The data can | ||
| also be represented as an area (instead of a point) by including a bounds array | ||
| for each coordinate array. | ||
|
|
||
| .. figure:: images/data_structured_grid.svg | ||
| :alt: Diagram of how data is represented on a structured grid | ||
|
|
||
| Data on a structured grid | ||
|
stephenworsley marked this conversation as resolved.
Outdated
|
||
|
|
||
| :download:`full size image <images/data_structured_grid.svg>` | ||
|
|
||
| UGRID Unstructured Meshes | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| UGRID is based on a **mesh** instead of a grid. The most basic element in a | ||
| mesh is the 0-dimensional **node**: a single location in space. Every node in | ||
| the mesh is defined by indexing the 1-dimensional X and Y (and optionally Z) | ||
| coordinate arrays (the ``node_coordinates``) - e.g. ``(x[3], y[3])`` gives the | ||
| position of the fourth node. Since nodes can be anywhere in this space - | ||
| **unstructured** - the position in the array has nothing to do with spatial | ||
| position. | ||
|
|
||
| If data is assigned to node location it must be stored in a 1D array of equal | ||
| length to the coordinate arrays. ``data[3]`` is at the position: | ||
| ``(x[3], y[3])``. | ||
|
pp-mo marked this conversation as resolved.
Outdated
|
||
|
|
||
| Data can also be assigned to higher dimensional elements - **edges**, **faces** | ||
| or **volumes**. These elements are constructed by connecting nodes together | ||
| using a 2-dimensional **connectivity** array. One dimension varies over each | ||
| element, while the other dimension varies over each node that makes up that | ||
| element; the values in the array are the node indices. E.g. we could make 2 | ||
| square faces from 6 nodes using this ``face_node_connectivity``: | ||
| ``[[0, 1, 3, 2], [2, 3, 5, 4]]``. Remember that UGRID is **unstructured**, so | ||
| there is no significance to the order of the faces in the array. Data assigned | ||
| to a higher dimensional location must be stored in a 1D array of equal length | ||
| to that connectivity array, e.g. ``my_data = [0.33, 4.02]`` for our example. | ||
|
|
||
| .. note:: | ||
|
|
||
| Connectivities also exist to connect the higher dimensional elements, | ||
| e.g. ``face_edge_connectivity``. These are optional conveniences to | ||
|
wjbenfold marked this conversation as resolved.
Outdated
|
||
| speed up certain operations and will not be discussed here. | ||
|
|
||
| .. figure:: images/data_ugrid_mesh.svg | ||
| :alt: Diagram of how data is represented on a UGRID unstructured mesh | ||
|
|
||
| Data on a UGRID Unstructured Mesh | ||
|
|
||
| :download:`full size image <images/data_ugrid_mesh.svg>` | ||
|
|
||
| ---- | ||
|
|
||
| UGRID also includes support for edges/faces/volumes to have associated 'centre' | ||
| coordinates - to allow point data to be assigned to these elements. 'Centre' is | ||
| just a convenience term - the points can exist anywhere within their respective | ||
| elements. | ||
|
|
||
| .. figure:: images/ugrid_element_centres.svg | ||
|
wjbenfold marked this conversation as resolved.
Outdated
|
||
| :alt: Diagram demonstrating UGRID face-centred data. | ||
|
|
||
| Data can be assigned to UGRID edge/face/volume 'centres' | ||
|
|
||
| UGRID's Flexibility | ||
| ~~~~~~~~~~~~~~~~~~~ | ||
| Above we have seen how one could replicate data on a structured grid using | ||
| UGRID instead. But the utility of UGRID is the extra flexibility it offers. | ||
| Here are the main examples: | ||
|
|
||
| * Every UGRID node is completely independent - every one can have unique X and | ||
| Y (and Z) coordinate values. | ||
|
|
||
| .. figure:: images/ugrid_node_independence.svg | ||
| :alt: Diagram demonstrating the independence of each node in UGRID | ||
| :align: center | ||
|
|
||
| Every UGRID node is completely independent | ||
|
|
||
| * Faces and volumes can have variable node counts, i.e. different numbers of | ||
| sides. This is achieved by masking the unused 'slots' in the connectivity array. | ||
|
|
||
| .. figure:: images/ugrid_variable_faces.svg | ||
| :alt: Diagram demonstrating UGRID faces with variable node counts | ||
| :align: center | ||
|
|
||
| UGRID faces can have different node counts (using masking) | ||
|
|
||
| * Data can be assigned to lines (edges) just as easily as points (nodes) or | ||
| areas (faces). | ||
|
|
||
| .. figure:: images/ugrid_edge_data.svg | ||
| :alt: Diagram demonstrating data assigned to UGRID edges | ||
| :align: center | ||
|
|
||
| Data can be assigned to UGRID edges | ||
|
|
||
| What does this mean? | ||
| -------------------- | ||
| UGRID can represent much more varied spatial arrangements | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| UGRID's highly specific way of recording location (geometry) and shape | ||
| (topology) allows it to represent essentially **any** spatial arrangement of | ||
| data. There are therefore many applications that wouldn't be possible using a | ||
| structured grid, including: | ||
|
|
||
| * `The UK Met Office's LFRic cubed-sphere <https://hps.vi4io.org/_media/events/2018/sig-io-uk-adams.pdf>`_ | ||
| * `Oceanic model outputs <https://www.researchgate.net/publication/276039140_Advances_in_a_Distributed_Approach_for_Ocean_Model_Data_Interoperability>`_ | ||
|
|
||
| .. todo: | ||
| a third example! | ||
|
|
||
| UGRID 'payload' is much larger than with structured grids | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| Coordinates are recorded per-node, and connectivities are recorded per-element. | ||
| This is opposed to a structured grid, where a single coordinate value is shared | ||
| by every data point/area along that line. | ||
|
|
||
| For example: representing the Earth as a cubed-sphere leads to coordinates and | ||
| connectivities being **~8 times larger than the data itself**, as opposed to a | ||
| small fraction of the data size when using a structured grid. | ||
|
|
||
| This further increases the emphasis on lazy loading and processing of data | ||
| using packages such as Dask. | ||
|
|
||
| .. note:: | ||
|
|
||
| UGRID's large, 1D data arrays are a very different shape to what Iris | ||
| users and developers are used to. It is suspected that optimal | ||
| performance will need new chunking strategies, but at time of writing | ||
| (``Jan 2022``) experience is still limited. | ||
|
|
||
| .. todo: | ||
| Revisit when we have more information. | ||
|
|
||
| Spatial operations on UGRID data are more complex | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| Indexing a UGRID data array cannot be used for: | ||
|
|
||
| #. Region selection | ||
| #. Neighbour identification | ||
|
|
||
| This is because - unlike with a structured data array - relative position in | ||
| UGRID's 1-dimensional data arrays has no relation to relative position in | ||
| space. We must instead perform specialised operations using the information in | ||
| the connectivities present, or by translating the mesh into a format designed | ||
|
lbdreyer marked this conversation as resolved.
Outdated
|
||
| for mesh analysis such as VTK. | ||
|
|
||
| Such calculations can still be optimised to avoid them slowing workflows, but | ||
| the important take-away here is that **adaptation is needed when working UGRID | ||
| data**. | ||
|
|
||
| .. todo: | ||
| mention GeoVista here | ||
|
|
||
|
|
||
| How Iris Represents This | ||
| ======================== | ||
|
|
||
| .. | ||
| Include API links to the various classes | ||
|
|
||
| Include Cube/Mesh printout(s) | ||
|
|
||
| __ CF-UGRID_ | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.