Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/user_guide/examples/tutorial_dt_integrators.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"\n",
"$$\n",
"\\begin{aligned}\n",
"\\text{d}t < \\frac{1}{12 * 1.71e-5} = 4.9e3 \\text{ seconds}\n",
"\\text{d}t < \\frac{1}{12 * 1.71 * 10^{-5}} = 4.9* 10^{3} \\text{ seconds}\n",
"\\end{aligned}\n",
"$$\n",
"\n",
Expand Down
38 changes: 20 additions & 18 deletions docs/user_guide/examples/tutorial_interpolation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"metadata": {},
"source": [
"# 🖥️ Using `parcels.interpolators`\n",
"Parcels comes with a number of different interpolation methods for tracer fields, such as temperature. Here, we will look at a few common `parcels.interpolators` for structured (`X`) grids, and how to configure them in an idealised example. For more guidance on the sampling of such fields, check out the [sampling tutorial](./tutorial_sampling).\n",
"\n",
"We first import the relevant modules"
"Parcels comes with a number of different interpolation methods for fields on structured (`X`) and unstructured (`Ux`) grids. Here, we will look at a few common {py:obj}`parcels.interpolators` for tracer fiedls, and how to configure them in an idealised example. For more guidance on the sampling of such fields, check out the [sampling tutorial](./tutorial_sampling)."
]
},
{
Expand All @@ -24,6 +22,14 @@
"import parcels"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Interpolators on structured grids\n",
"We will first look at interpolation schemes which work on tracer fields defined on {py:obj}`parcels.XGrid` objects."
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down Expand Up @@ -53,7 +59,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"From this dataset we create a `parcels.FieldSet`. Parcels requires an interpolation method to be set for each `parcels.Field`, which we will later adapt to see the effects of the different interpolators. A common interpolator for fields on structured grids is (tri)linear, implemented in `parcels.interpolators.XLinear`."
"From this dataset we create a {py:obj}`parcels.FieldSet`. Parcels requires an interpolation method to be set for each {py:obj}`parcels.Field`, which we will later adapt to see the effects of the different interpolators. A common interpolator for fields on structured grids is (tri)linear, implemented in {py:obj}`parcels.interpolators.XLinear`."
]
},
{
Expand Down Expand Up @@ -230,15 +236,11 @@
"\n",
"In the special case where a `parcels.Field` is constant in time and space, such as implementing constant diffusion on a spherical mesh, we can use:\n",
"\n",
"5. `interp_method=parcels.interpolators.XConstantField`: return single value of a Constant Field"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```{note}\n",
"TODO: link to reference API with all `parcels.interpolators`\n",
"5. `interp_method=parcels.interpolators.XConstantField`: return single value of a Constant Field\n",
"\n",
"```{admonition} [..] API reference\n",
":class: seealso\n",
"All available interpolation methods are listed here: {py:obj}`parcels.interpolators`\n",
"```"
]
},
Expand All @@ -249,14 +251,14 @@
"### Interpolation at boundaries\n",
"In some cases, we need to implement specific boundary conditions, for example to prevent particles from \n",
"getting \"stuck\" near land. [This guide](../examples_v3/documentation_unstuck_Agrid.ipynb) describes \n",
"how to implement this in parcels using `parcels.interpolators.XFreeslip` and `parcels.interpolators.XPartialslip`."
"how to implement this in parcels using {py:obj}`parcels.interpolators.XFreeslip` and {py:obj}`parcels.interpolators.XPartialslip`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Interpolation on unstructured grids\n",
"## Interpolators on unstructured grids\n",
"Parcels v4 supports the use of general circulation model output that is defined on unstructured grids. We include basic interpolators to help you get started, including\n",
"- `UxPiecewiseConstantFace` - this interpolator implements piecewise constant interpolation and is appropriate for data that is registered to the face centers of the unstructured grid\n",
"- `UxPiecewiseLinearNode` - this interpolator implements barycentric interpolation and is appropriate for data that is registered to the corner vertices of the unstructured grid faces\n",
Expand All @@ -280,7 +282,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Next, we create the `Field` and `Fieldset` objects that will be used later in advancing particles. When creating a `Field` or `VectorField` object for unstructured grid data, we attach a `parcels.UxGrid` object and attach an `interp_method` to each object. For data that is defined on face centers, we use the `UxPiecewiseConstantFace` interpolator and for data that is defined on the face vertices, we use the `UxPiecewiseLinearNode` interpolator. In this example, we will look specifically at interpolating a tracer field that is defined by the same underlying analytical function, but is defined on both faces and vertices as separate fields."
"Next, we create the `Field` and `Fieldset` objects that will be used later in advancing particles. When creating a `Field` or `VectorField` object for unstructured grid data, we attach a {py:obj}`parcels.UxGrid` object and attach an `interp_method` to each object. For data that is defined on face centers, we use the `UxPiecewiseConstantFace` interpolator and for data that is defined on the face vertices, we use the `UxPiecewiseLinearNode` interpolator. In this example, we will look specifically at interpolating a tracer field that is defined by the same underlying analytical function, but is defined on both faces and vertices as separate fields."
]
},
{
Expand Down Expand Up @@ -494,7 +496,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "test-notebooks",
"language": "python",
"name": "python3"
},
Expand All @@ -508,7 +510,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.11"
"version": "3.13.9"
}
},
"nbformat": 4,
Expand Down
Loading