|
88 | 88 | "\n", |
89 | 89 | "A `UXArray.Dataset` consists of multiple `UXArray.UxDataArray`'s and a `UXArray.UxGrid`. Parcels views general circulation model data through the `Field` and `VectorField` classes. A `Field` is defined by its `name`, `data`, `grid`, and `interp_method`. A `VectorField` can be constructed by using 2 or 3 `Field`'s. The `Field.data` attribute can be either an `XArray.DataArray` or `UXArray.UxDataArray` object. The `Field.grid` attribute is of type `Parcels.XGrid` or `Parcels.UXGrid`. Last, the `interp_method` is a dynamic function that can be set at runtime to define the interpolation procedure for the `Field`. This gives you the flexibility to use one of the pre-defined interpolation methods included with Parcels v4, or to create your own interpolator. \n", |
90 | 90 | "\n", |
91 | | - "The first step to creating a `Field` (or `VectorField`) is to define the Grid. For an unstructured grid, we will create a `Parcels.UXGrid` object, which requires a `UxArray.grid` and the vertical layer interface positions." |
| 91 | + "The first step to creating a `Field` (or `VectorField`) is to define the Grid. For an unstructured grid, we will create a `Parcels.UXGrid` object, which requires a `UxArray.grid` and the vertical layer interface positions. Setting the `mesh` to `\"spherical\"` is a legacy feature from Parcels v3 that enables unit conversion from `m/s` to `deg/s`; this is needed in this case since the grid locations are defined in units of degrees." |
92 | 92 | ] |
93 | 93 | }, |
94 | 94 | { |
|
99 | 99 | "source": [ |
100 | 100 | "from parcels.uxgrid import UxGrid\n", |
101 | 101 | "\n", |
102 | | - "grid = UxGrid(grid=ds.uxgrid, z=ds.coords[\"nz\"])\n", |
| 102 | + "grid = UxGrid(grid=ds.uxgrid, z=ds.coords[\"nz\"], mesh=\"spherical\")\n", |
103 | 103 | "# You can view the uxgrid object with the following command:\n", |
104 | 104 | "grid.uxgrid" |
105 | 105 | ] |
|
112 | 112 | "\n", |
113 | 113 | "In Parcels, grid searching is conducted with respect to the faces. In other words, when a grid index `ei` is provided to an interpolation method, this refers the face index `fi` at vertical layer `zi` (when unraveled). Within the interpolation method, the `field.grid.uxgrid.face_node_connectivity` attribute can be used to obtain the node indices that surround the face. Using these connectivity tables is necessary for properly indexing node registered data.\n", |
114 | 114 | "\n", |
115 | | - "For the example Stommel gyre dataset in this tutorial, the `u` and `v` velocity components are face registered (similar to FESOM). Parcels includes a nearest neighbor interpolator for face registered unstructured grid data through `Parcels.application_kernels.interpolation.UXPiecewiseConstantFace`. Below, we create the `Field`s `U` and `V` and associate them with the `UxGrid` we created previously and this interpolation method. Setting the `mesh_type` to `\"spherical\"` is a legacy feature from Parcels v3 that enables unit conversion from `m/s` to `deg/s`; this is needed in this case since the grid locations are defined in units of degrees." |
| 115 | + "For the example Stommel gyre dataset in this tutorial, the `u` and `v` velocity components are face registered (similar to FESOM). Parcels includes a nearest neighbor interpolator for face registered unstructured grid data through `Parcels.application_kernels.interpolation.UXPiecewiseConstantFace`. Below, we create the `Field`s `U` and `V` and associate them with the `UxGrid` we created previously and this interpolation method." |
116 | 116 | ] |
117 | 117 | }, |
118 | 118 | { |
|
128 | 128 | " name=\"U\",\n", |
129 | 129 | " data=ds.U,\n", |
130 | 130 | " grid=grid,\n", |
131 | | - " mesh_type=\"spherical\",\n", |
132 | 131 | " interp_method=UXPiecewiseConstantFace,\n", |
133 | 132 | ")\n", |
134 | 133 | "V = Field(\n", |
135 | 134 | " name=\"V\",\n", |
136 | 135 | " data=ds.V,\n", |
137 | 136 | " grid=grid,\n", |
138 | | - " mesh_type=\"spherical\",\n", |
139 | 137 | " interp_method=UXPiecewiseConstantFace,\n", |
140 | 138 | ")\n", |
141 | 139 | "P = Field(\n", |
142 | 140 | " name=\"P\",\n", |
143 | 141 | " data=ds.p,\n", |
144 | 142 | " grid=grid,\n", |
145 | | - " mesh_type=\"spherical\",\n", |
146 | 143 | " interp_method=UXPiecewiseConstantFace,\n", |
147 | 144 | ")" |
148 | 145 | ] |
|
0 commit comments