|
33 | 33 | "\n", |
34 | 34 | "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", |
35 | 35 | "\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", |
37 | 39 | "\n", |
38 | 40 | "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" |
39 | 41 | ] |
|
71 | 73 | "ufiles = sorted(glob(f\"{example_dataset_folder}/ORCA*U.nc\"))\n", |
72 | 74 | "vfiles = sorted(glob(f\"{example_dataset_folder}/ORCA*V.nc\"))\n", |
73 | 75 | "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", |
74 | 77 | "mesh_mask = f\"{example_dataset_folder}/coordinates.nc\"\n", |
75 | 78 | "\n", |
76 | 79 | "filenames = {\n", |
77 | 80 | " \"U\": {\"lon\": mesh_mask, \"lat\": mesh_mask, \"depth\": wfiles[0], \"data\": ufiles},\n", |
78 | 81 | " \"V\": {\"lon\": mesh_mask, \"lat\": mesh_mask, \"depth\": wfiles[0], \"data\": vfiles},\n", |
79 | 82 | " \"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", |
80 | 84 | "}\n", |
81 | 85 | "\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", |
83 | 92 | "\n", |
84 | 93 | "# Note that all variables need the same dimensions in a C-Grid\n", |
85 | 94 | "c_grid_dimensions = {\n", |
|
92 | 101 | " \"U\": c_grid_dimensions,\n", |
93 | 102 | " \"V\": c_grid_dimensions,\n", |
94 | 103 | " \"W\": c_grid_dimensions,\n", |
| 104 | + " # \"T\": c_grid_dimensions, # Not used in this example\n", |
95 | 105 | "}\n", |
96 | 106 | "\n", |
97 | 107 | "fieldset = parcels.FieldSet.from_nemo(filenames, variables, dimensions)\n", |
|
161 | 171 | "source": [ |
162 | 172 | "## Adding other fields like cell edges\n", |
163 | 173 | "\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" |
165 | 177 | ] |
166 | 178 | }, |
167 | 179 | { |
|
0 commit comments