Skip to content

Field sampling using FieldSet.from_netcdf #1257

Answered by erikvansebille
MiriamSterl asked this question in Q&A
Discussion options

You must be logged in to vote

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 fset now has three fields: U, V and PV. 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.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MiriamSterl
Comment options

MiriamSterl Oct 13, 2022
Collaborator Author

Answer selected by MiriamSterl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants