|
6 | 6 | "metadata": {}, |
7 | 7 | "source": [ |
8 | 8 | "# 🖥️ Using `parcels.interpolators`\n", |
9 | | - "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", |
10 | | - "\n", |
11 | | - "We first import the relevant modules" |
| 9 | + "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)." |
12 | 10 | ] |
13 | 11 | }, |
14 | 12 | { |
|
24 | 22 | "import parcels" |
25 | 23 | ] |
26 | 24 | }, |
| 25 | + { |
| 26 | + "cell_type": "markdown", |
| 27 | + "metadata": {}, |
| 28 | + "source": [ |
| 29 | + "## Interpolators on structured grids\n", |
| 30 | + "We will first look at interpolation schemes which work on tracer fields defined on {py:obj}`parcels.XGrid` objects." |
| 31 | + ] |
| 32 | + }, |
27 | 33 | { |
28 | 34 | "attachments": {}, |
29 | 35 | "cell_type": "markdown", |
|
53 | 59 | "cell_type": "markdown", |
54 | 60 | "metadata": {}, |
55 | 61 | "source": [ |
56 | | - "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`." |
| 62 | + "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`." |
57 | 63 | ] |
58 | 64 | }, |
59 | 65 | { |
|
230 | 236 | "\n", |
231 | 237 | "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", |
232 | 238 | "\n", |
233 | | - "5. `interp_method=parcels.interpolators.XConstantField`: return single value of a Constant Field" |
234 | | - ] |
235 | | - }, |
236 | | - { |
237 | | - "cell_type": "markdown", |
238 | | - "metadata": {}, |
239 | | - "source": [ |
240 | | - "```{note}\n", |
241 | | - "TODO: link to reference API with all `parcels.interpolators`\n", |
| 239 | + "5. `interp_method=parcels.interpolators.XConstantField`: return single value of a Constant Field\n", |
| 240 | + "\n", |
| 241 | + "```{admonition} [..] API reference\n", |
| 242 | + ":class: seealso\n", |
| 243 | + "All available interpolation methods are listed here: {py:obj}`parcels.interpolators`\n", |
242 | 244 | "```" |
243 | 245 | ] |
244 | 246 | }, |
|
249 | 251 | "### Interpolation at boundaries\n", |
250 | 252 | "In some cases, we need to implement specific boundary conditions, for example to prevent particles from \n", |
251 | 253 | "getting \"stuck\" near land. [This guide](../examples_v3/documentation_unstuck_Agrid.ipynb) describes \n", |
252 | | - "how to implement this in parcels using `parcels.interpolators.XFreeslip` and `parcels.interpolators.XPartialslip`." |
| 254 | + "how to implement this in parcels using {py:obj}`parcels.interpolators.XFreeslip` and {py:obj}`parcels.interpolators.XPartialslip`." |
253 | 255 | ] |
254 | 256 | }, |
255 | 257 | { |
256 | 258 | "cell_type": "markdown", |
257 | 259 | "metadata": {}, |
258 | 260 | "source": [ |
259 | | - "## Interpolation on unstructured grids\n", |
| 261 | + "## Interpolators on unstructured grids\n", |
260 | 262 | "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", |
261 | 263 | "- `UxPiecewiseConstantFace` - this interpolator implements piecewise constant interpolation and is appropriate for data that is registered to the face centers of the unstructured grid\n", |
262 | 264 | "- `UxPiecewiseLinearNode` - this interpolator implements barycentric interpolation and is appropriate for data that is registered to the corner vertices of the unstructured grid faces\n", |
|
280 | 282 | "cell_type": "markdown", |
281 | 283 | "metadata": {}, |
282 | 284 | "source": [ |
283 | | - "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." |
| 285 | + "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." |
284 | 286 | ] |
285 | 287 | }, |
286 | 288 | { |
|
494 | 496 | ], |
495 | 497 | "metadata": { |
496 | 498 | "kernelspec": { |
497 | | - "display_name": "Python 3 (ipykernel)", |
| 499 | + "display_name": "test-notebooks", |
498 | 500 | "language": "python", |
499 | 501 | "name": "python3" |
500 | 502 | }, |
|
508 | 510 | "name": "python", |
509 | 511 | "nbconvert_exporter": "python", |
510 | 512 | "pygments_lexer": "ipython3", |
511 | | - "version": "3.12.11" |
| 513 | + "version": "3.13.9" |
512 | 514 | } |
513 | 515 | }, |
514 | 516 | "nbformat": 4, |
|
0 commit comments