You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* putting just the `lfric_rh` variable at the end triggers notebook printing output
106
+
* the effect of `print(lfric_rh)` is different -- ***try this***
114
107
115
-
lfric_rh
116
-
```
117
108
118
109
```python
119
110
120
111
```
121
112
122
-
## What you initially notice about "mesh cubes"
113
+
## What is notable about "mesh cubes"
123
114
124
-
The cube printout has a "Mesh" section, which displays the mesh info.
115
+
In the cube printout above, _compared to regular UM-style data_, you can see that it has an additional section in the cube printout called "Mesh", which displays the mesh-specific info.
125
116
126
-
The cube itself now has some extra properties : `cube.mesh`, `cube.location` and `cube.mesh_dim()`
127
-
(these are otherwise all `None`)
117
+
The cube itself also now has some extra properties : `cube.mesh`, `cube.location` and `cube.mesh_dim()`
118
+
(which are otherwise all `None`)
128
119
129
-
```python
130
-
print("cube.mesh :")
131
-
print(lfric_rh.mesh)
132
-
print("\n-------")
133
-
print("cube.location = ", lfric_rh.location)
134
-
print(lfric_rh.mesh_dim())
135
-
print("\n-------")
136
-
help(lfric_rh.mesh_dim)
137
-
print("cube.mesh_dim() = ", lfric_rh.mesh_dim())
138
-
```
120
+
Cubes with a mesh are known in Iris as "unstructured cubes" or "mesh cubes.
121
+
They also always have a specific "mesh dimension": In the above example it is the _last_ cube dimension.
139
122
140
-
```python
141
-
142
-
```
143
-
144
-
<!-- #region tags=[] -->
145
-
---
146
-
147
-
## Exercise: identifying mesh data
148
-
**How, in your code, could you check whether a cube has structured or mesh-based data ?**
149
-
150
-
---
151
-
152
-
<details><summary><b>Sample code solution :</b> "check whether cube has structured data ?" <b>click to reveal</b></summary>
***Try this code**, by pasting it into a code cell + running ...
180
-
* try it also with the 'lfric_rh' cube
181
-
</details>
182
-
<!-- #endregion -->
183
125
184
-
```python
185
-
# (space for user commands)
186
-
# . . .
187
126
```
188
127
189
-
## Question : what is `cube.mesh_dim` for ?
190
-
191
-
192
-
<details><summary><b>Sample Answer :</b> what is cube.mesh_dim for ? <b>click to reveal</b></summary>
193
-
It is a function which you call, returning an integer.
194
-
<br/>The result tells you which cube dimension is the mesh dimension -- that is, the cube dimension which indexes the individual elements of the mesh
195
-
196
-
See [Iris API docs for `Cube.mesh_dim`](https://scitools-iris.readthedocs.io/en/latest/generated/api/iris/cube.html#iris.cube.Cube.mesh_dim)
197
-
198
-
</details>
199
-
200
-
201
-
## Question : what does `cube.location` mean ?
202
-
203
-
<details><summary>Sample answer : <b>click to reveal</b></summary>
204
-
It returns a string, "node", "edge" or "face", indicating the type of mesh element which the cube data is mapped to.
205
-
206
-
See in [Iris "Mesh Support" docs](https://scitools-iris.readthedocs.io/en/latest/further_topics/ugrid/data_model.html?highlight=location#the-basics)
207
-
208
-
</details>
209
-
210
-
211
-
## Additional questions to consider ...
212
-
213
-
* what does `cube.mesh_dim` do when a cube *has* no mesh ?
214
-
<details><summary>Sample answer : <b>click to reveal</b></summary>
215
-
It returns `None`.
216
-
</details>
217
-
* what happens if there is more than one mesh, or mesh dimension ?
218
-
<details><summary>Sample answer : <b>click to reveal</b></summary>
219
-
A bit of a "trick question" !
220
-
</br>In UGRID, a data-variable can have at most <i>one</i> location and mesh. Therefore, since each Iris cube represents a CF data-variable, it can only have one mesh, and one mesh dimension -- that of its location in the mesh.
221
-
</details>
222
-
223
-
```python
224
-
225
-
```
128
+
## Next notebook
129
+
See the next section : [02 - Mesh concepts and Meshes in Iris](./Sec_02_Meshes.ipynb)
This produces a PyVista ["PolyData" object](https://docs.pyvista.org/api/core/_autosummary/pyvista.PolyData.html#pyvista-polydata).
139
-
Which is a thing we can plot, by simply calling its `.plot()` method.
180
+
### Question : what is `cube.mesh_dim` for ?
140
181
141
182
142
-
---
183
+
<details><summary>Sample Answer : <b>click to reveal</b></summary>
184
+
It is a function which you call, returning an integer.
185
+
<br/>The result tells you which cube dimension is the mesh dimension -- that is, the cube dimension which indexes the individual elements of the mesh
143
186
144
-
**Call the `plot` routine of the PolyData object. An output should appear.**
187
+
See [Iris API docs for `Cube.mesh_dim`](https://scitools-iris.readthedocs.io/en/latest/generated/api/iris/cube.html#iris.cube.Cube.mesh_dim)
188
+
189
+
</details>
190
+
191
+
192
+
### Question : what does `cube.location` mean ?
193
+
194
+
<details><summary>Sample answer : <b>click to reveal</b></summary>
195
+
It returns a string, "node", "edge" or "face", indicating the type of mesh element which the cube data is mapped to.
196
+
197
+
See in [Iris "Mesh Support" docs](https://scitools-iris.readthedocs.io/en/latest/further_topics/ugrid/data_model.html?highlight=location#the-basics)
198
+
199
+
</details>
145
200
146
-
```python
147
-
pv.plot()
148
-
```
149
201
150
-
**NOTES**:
151
-
* this plot is interactive -- try dragging to rotate, and the mouse scroll-wheel to zoom
152
-
* this obviously causes some clutter and uses up some space (e.g. you can't easily scroll past it)
153
-
* To ***remove*** a plot output, use "Clear Output" from the "Edit" menu (or from right-click on the cell)
154
-
* alternatively, set the keyword `jupyter_backend='static'` in the command, for output as a plain image
202
+
### Additional questions to consider ...
155
203
156
-
There are a lot more keywords available to [the `PolyData.plot()` method](https://docs.pyvista.org/api/core/_autosummary/pyvista.PolyData.plot.html), but it is not ideal to overcomplicate these calls.
157
-
Finer control is better achieved in a different ways : See more detail on plotting in [the Plotting section](./Sec_03_Plotting.ipynb).
204
+
* what does `cube.mesh_dim` do when a cube *has* no mesh ?
205
+
<details><summary>Sample answer : <b>click to reveal</b></summary>
206
+
It returns `None`.
207
+
</details>
208
+
* what happens if there is more than one mesh, or mesh dimension ?
209
+
<details><summary>Sample answer : <b>click to reveal</b></summary>
210
+
A bit of a "trick question" !
211
+
</br>In UGRID, a data-variable can have at most <i>one</i> location and mesh. Therefore, since each Iris cube represents a CF data-variable, it can only have one mesh, and one mesh dimension -- that of its location in the mesh.
0 commit comments