Skip to content

Commit 054d735

Browse files
Making one of the grids a pentagonal shape
1 parent e2ddeb1 commit 054d735

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

docs/user_guide/examples/tutorial_nestedgrids.ipynb

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
77
"source": [
88
"# 🖥️ Nested Grids\n",
99
"\n",
10-
"In some applications, you may have access to fields on different grids that each cover only part of the region of interest. Then, you would like to combine them all together. You may also have a grid covering the entire region and another one only covering part of it, but with a higher resolution. The set of those grids form what we call nested grids.\n",
10+
"In some applications, you may have access to fields on different grids that each cover only part of the region of interest. Then, you would like to combine them all together. You may for example have one grid covering the entire region and one or more others that cover only part of the region at a finer resolution. The set of those grids form what we call **nested grids**.\n",
1111
"\n",
12-
"In Parcels v4, we can use the new `uxarray` integration to determine in which grid a particle is located. We will demonstrate how to set up a simulation with multiple nested grids, and how to handle particle transitions between these grids.\n",
13-
"\n",
14-
"\n",
15-
"This tutorial shows how to use these Nested Fields with a very idealised example."
12+
"In Parcels v4, we can use the new `uxarray` integration to determine in which grid a particle is located. We will demonstrate how to set up a simulation with multiple nested grids, and how to handle particle transitions between these grids, with a very idealised example."
1613
]
1714
},
1815
{
@@ -69,7 +66,7 @@
6966
"id": "4",
7067
"metadata": {},
7168
"source": [
72-
"Now we create a zonal and meridional velocity field defined on a small grid. Both the zonal (1m/s) and meridional (0 m/s) velocity are uniform."
69+
"Now we create a set of zonal and meridional velocities defined on a small grid. Both the zonal (1m/s) and meridional (0 m/s) velocity are uniform."
7370
]
7471
},
7572
{
@@ -79,7 +76,7 @@
7976
"metadata": {},
8077
"outputs": [],
8178
"source": [
82-
"polygon = np.array([(10, 15), (25, 10), (25, 25), (10, 35)])\n",
79+
"polygon = np.array([(10, 15), (25, 10), (25, 25), (17, 35), (10, 32)])\n",
8380
"grid_polygons.append(polygon)\n",
8481
"\n",
8582
"ds_in.append(setup_nested_ds(polygon))\n",
@@ -92,7 +89,7 @@
9289
"id": "6",
9390
"metadata": {},
9491
"source": [
95-
"Then, we define another set of zonal and meridional velocities on a slightly larger grid. In this case, the meridional velocity is also 1 m/s."
92+
"Then, we define another set of zonal and meridional velocities on a slightly larger grid. In this case, both the zonal and meridional velocity are 1 m/s."
9693
]
9794
},
9895
{
@@ -115,7 +112,7 @@
115112
"id": "8",
116113
"metadata": {},
117114
"source": [
118-
"Finally, we define another set of velocities on an even larger grid. The zonal velocity is the same as for the smaller grids, but the meridional velocity is now a cosine as a function of longitude."
115+
"Finally, we define another set of velocities on an even larger grid. The zonal velocity is again 1 m/s, but the meridional velocity is now a cosine as a function of longitude."
119116
]
120117
},
121118
{
@@ -152,7 +149,7 @@
152149
"n_grids = len(ds_in)\n",
153150
"cmap = ListedColormap([f\"C{i}\" for i in range(n_grids)])\n",
154151
"\n",
155-
"fig, ax = plt.subplots()\n",
152+
"fig, ax = plt.subplots(figsize=(10, 5))\n",
156153
"\n",
157154
"for i in range(n_grids):\n",
158155
" ds = ds_in[i].isel(time=0, depth=0)\n",
@@ -174,7 +171,7 @@
174171
"id": "12",
175172
"metadata": {},
176173
"source": [
177-
"Note, as seen in the plot above, that the dataset domains in this case are rectangular, but the polygons that will later define the nested Grid boundaries don't have to be. So we can even use this method to subset parts of a Grid."
174+
"Note, as seen in the plot above, that the dataset domains in this case are rectangular, but the polygons that will later define the nested Grid boundaries don't have to be. They can have any shape! This means that we can also use this method to subset parts of a Grid, or to define subregions of a domain."
178175
]
179176
},
180177
{
@@ -263,7 +260,7 @@
263260
"metadata": {},
264261
"outputs": [],
265262
"source": [
266-
"fig, ax = plt.subplots()\n",
263+
"fig, ax = plt.subplots(figsize=(10, 5))\n",
267264
"for i in range(n_grids)[::-1]:\n",
268265
" tris = face_tris[face_poly == i]\n",
269266
" ax.triplot(points[:, 0], points[:, 1], tris, label=f\"Grid {i}\", color=f\"C{i}\")\n",
@@ -512,7 +509,7 @@
512509
"metadata": {},
513510
"outputs": [],
514511
"source": [
515-
"fig, ax = plt.subplots(1, 1, figsize=(10, 4))\n",
512+
"fig, ax = plt.subplots(1, 1, figsize=(10, 5))\n",
516513
"\n",
517514
"ds_out = xr.open_zarr(\"nestedgrid_particles.zarr\")\n",
518515
"\n",

0 commit comments

Comments
 (0)