Skip to content

Commit bd6a09a

Browse files
Merge pull request #1702 from OceanParcels/tutorial_nemo3D_tracer_explanation
Adding explicit explanation how to add tracers in FieldSet.from_nemo()
2 parents f0791c6 + d47cf4c commit bd6a09a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

docs/examples/tutorial_nemo_3D.ipynb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
"\n",
3434
"In the following, we will show how to create the `dimensions` dictionary for 3D NEMO simulations. What you require is a 'mesh_mask' file, which in our case is called `coordinates.nc` but in some other versions of NEMO has a different name. In any case, it will have to contain the variables `glamf`, `gphif` and `depthw`, which are the longitude, latitude and depth of the mesh nodes, respectively. Note that `depthw` is not part of the mesh_mask file, but is in the same file as the w data (`wfiles[0]`).\n",
3535
"\n",
36-
"For the C-grid interpolation in Parcels to work properly, it is important that `U`, `V` and `W` are on the same grid.\n",
36+
"For the C-grid interpolation in Parcels to work properly, it is important that `U`, `V` and `W` are on the same grid. \n",
37+
"\n",
38+
"All other tracers (e.g. `temperature`, `salinity`) should also be on this same grid. So even though these tracers are computed by NEMO on the T-points, Parcels expects them on the f-points (`glamf`, `gphif` and `depthw`). Parcels then under the hood makes sure the interpolation of these tracers is done correctly.\n",
3739
"\n",
3840
"The code below is an example of how to create a 3D simulation with particles, starting in the mouth of the river Rhine at 1m depth, and advecting them through the North Sea using the `AdvectionRK4_3D`\n"
3941
]
@@ -71,15 +73,22 @@
7173
"ufiles = sorted(glob(f\"{example_dataset_folder}/ORCA*U.nc\"))\n",
7274
"vfiles = sorted(glob(f\"{example_dataset_folder}/ORCA*V.nc\"))\n",
7375
"wfiles = sorted(glob(f\"{example_dataset_folder}/ORCA*W.nc\"))\n",
76+
"# tfiles = sorted(glob(f\"{example_dataset_folder}/ORCA*T.nc\")) # Not used in this example\n",
7477
"mesh_mask = f\"{example_dataset_folder}/coordinates.nc\"\n",
7578
"\n",
7679
"filenames = {\n",
7780
" \"U\": {\"lon\": mesh_mask, \"lat\": mesh_mask, \"depth\": wfiles[0], \"data\": ufiles},\n",
7881
" \"V\": {\"lon\": mesh_mask, \"lat\": mesh_mask, \"depth\": wfiles[0], \"data\": vfiles},\n",
7982
" \"W\": {\"lon\": mesh_mask, \"lat\": mesh_mask, \"depth\": wfiles[0], \"data\": wfiles},\n",
83+
" # \"T\": {\"lon\": mesh_mask, \"lat\": mesh_mask, \"depth\": wfiles[0], \"data\": tfiles}, # Not used in this example\n",
8084
"}\n",
8185
"\n",
82-
"variables = {\"U\": \"uo\", \"V\": \"vo\", \"W\": \"wo\"}\n",
86+
"variables = {\n",
87+
" \"U\": \"uo\",\n",
88+
" \"V\": \"vo\",\n",
89+
" \"W\": \"wo\",\n",
90+
" # \"T\": \"thetao\", # Not used in this example\n",
91+
"}\n",
8392
"\n",
8493
"# Note that all variables need the same dimensions in a C-Grid\n",
8594
"c_grid_dimensions = {\n",
@@ -92,6 +101,7 @@
92101
" \"U\": c_grid_dimensions,\n",
93102
" \"V\": c_grid_dimensions,\n",
94103
" \"W\": c_grid_dimensions,\n",
104+
" # \"T\": c_grid_dimensions, # Not used in this example\n",
95105
"}\n",
96106
"\n",
97107
"fieldset = parcels.FieldSet.from_nemo(filenames, variables, dimensions)\n",
@@ -161,7 +171,9 @@
161171
"source": [
162172
"## Adding other fields like cell edges\n",
163173
"\n",
164-
"It is quite straightforward to add other gridded data, on the same curvilinear or any other type of grid, to the fieldset. Because it is good practice to make no changes to a `FieldSet` once a `ParticleSet` has been defined in it, we redefine the fieldset and add the fields with the cell edges from the coordinates file using `FieldSet.add_field()`.\n"
174+
"It is quite straightforward to add other gridded data, on the same curvilinear or any other type of grid, to the fieldset. Because it is good practice to make no changes to a `FieldSet` once a `ParticleSet` has been defined in it, we redefine the fieldset and add the fields with the cell edges from the coordinates file using `FieldSet.add_field()`.\n",
175+
"\n",
176+
"Note that including tracers like `temperature` and `salinity` needs to be done at the f-points, so on the same grid as the velocity fields. See also the section above.\n"
165177
]
166178
},
167179
{

0 commit comments

Comments
 (0)