Skip to content

Commit aa16654

Browse files
Further clean-up of tutorial
1 parent c9f63cc commit aa16654

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

docs/user_guide/examples/tutorial_unitconverters.ipynb

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"cell_type": "markdown",
2424
"metadata": {},
2525
"source": [
26-
"Let's first import the relevant modules, and generate a simple dataset on a 2D spherical mesh, with `U`, `V` and `temperature` data arrays, with the velocities 1 m/s and the temperature 20C.\n"
26+
"Let's first import the relevant modules, and generate a simple dataset on a 2D spherical mesh, with `U`, `V` and `temperature` data arrays, with the velocities 1 m s<sup>-1</sup> and the temperature 20°C.\n"
2727
]
2828
},
2929
{
@@ -67,7 +67,7 @@
6767
"When using a `FieldSet` method for a specific dataset, such as `from_copernicusmarine()`, the grid information is known and parsed by Parcels, so we do not have to add the `mesh` argument.\n",
6868
"```\n",
6969
"\n",
70-
"Plotting the `U` field indeed shows a uniform 1 m/s eastward flow.\n"
70+
"Plotting the `U` field indeed shows a uniform 1 m s<sup>-1</sup> eastward flow.\n"
7171
]
7272
},
7373
{
@@ -107,7 +107,7 @@
107107
"However, printing the velocites directly shows something perhaps surprising. Here, we use the square-bracket field-interpolation notation to print the field value at (5W, 40N, 0m depth) at time 0. \n",
108108
"\n",
109109
"```{note}\n",
110-
"Sampling a velocity in Parcels is done by calling the `fieldset.UV` VectorField; see the [Field Sampling tutorial](https://docs.oceanparcels.org/en/latest/examples/tutorial_sampling.html#Sampling-velocity-fields) for more information._\n",
110+
"Sampling a velocity in Parcels is done by calling the `fieldset.UV` VectorField; see also the section \"Sampling U and V separately\" below.\n",
111111
"```\n"
112112
]
113113
},
@@ -133,17 +133,17 @@
133133
"cell_type": "markdown",
134134
"metadata": {},
135135
"source": [
136-
"While the temperature field indeed is 20C, as we defined, these printed velocities are much smaller.\n",
136+
"While the temperature field indeed is 20°C, as we defined, these printed velocities are much smaller.\n",
137137
"\n",
138-
"This is because Parcels converts under the hood from m/s to degrees/s.\n"
138+
"This is because Parcels converts under the hood from m s<sup>-1</sup> to degrees s<sup>-1</sup>."
139139
]
140140
},
141141
{
142142
"attachments": {},
143143
"cell_type": "markdown",
144144
"metadata": {},
145145
"source": [
146-
"Indeed, if we multiply the value of the U field with 1852 \\* 60 \\* cos(lat) (the number of meters in 1 degree of longitude), we get the expected 1 m/s.\n"
146+
"Indeed, if we multiply the value of the U field with 1852 \\* 60 \\* cos(lat) (the number of meters in 1 degree of longitude), we get the expected 1 m s<sup>-1</sup>.\n"
147147
]
148148
},
149149
{
@@ -196,6 +196,30 @@
196196
")"
197197
]
198198
},
199+
{
200+
"cell_type": "markdown",
201+
"metadata": {},
202+
"source": [
203+
"## Don't sample U and V separately"
204+
]
205+
},
206+
{
207+
"cell_type": "markdown",
208+
"metadata": {},
209+
"source": [
210+
"Sampling `U` and `V` separately will _not_ convert to degrees s<sup>-1</sup>, so these velocities cannot be used directly for advection on spherical coordinates. This is one of the main reasons to always use the `UV` VectorField for velocity sampling in Parcels.\n"
211+
]
212+
},
213+
{
214+
"cell_type": "code",
215+
"execution_count": null,
216+
"metadata": {},
217+
"outputs": [],
218+
"source": [
219+
"for fld in [fieldset.U, fieldset.V]:\n",
220+
" print(f\"{fld.name}: {fld.eval(time, z, lat, lon)}\")"
221+
]
222+
},
199223
{
200224
"cell_type": "markdown",
201225
"metadata": {},

0 commit comments

Comments
 (0)