Field sampling using FieldSet.from_netcdf #1257
-
I want to sample the velocity fields of the particles in my simulation, as well as an additional field, the potential vorticity. I have the PV field for each time saved in the same netCDF file that contains my velocity fields. How can I add this PV field to my fieldset? I have looked at the tutorial on field sampling (https://nbviewer.org/github/OceanParcels/parcels/blob/master/parcels/examples/tutorial_sampling.ipynb?flush_cache=true), but it seems that the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can simply add fields in the dictionary of variables. For example, if you have a field called PV filenames = {'U': fnameU, 'V': fnameV, 'PV': fnamePV}
variables = {'U': 'u', 'V': 'v', 'PV': 'PV'}
dimensions = {'lat': 'lat', 'lon': 'lon'}
set = FieldSet.from_netcdf(filenames, variables, dimensions) The resulting |
Beta Was this translation helpful? Give feedback.
You can simply add fields in the dictionary of variables. For example, if you have a field called PV
The resulting
fset
now has three fields:U
,V
andPV
. You can do this for how many fields you want, and by making dimensions a dict-of-dicts (i.e. a separate dictionary for each variable), you can even combine fields with different dimensions.