How to use Field Sampling with a Field on different grid than U,V ? #1719
-
QuestionQuestionHi, Is it possible to have a Field on a different grid (and even with different time values)? Let s say that U and V read their "longitude" and "latitude" from the "uvfile" netcdf file while the Field SSS read its "longitude_sss" and "latitude_sss" from the "sssfile" netcdf file. Supporting code/error messagesfilenames = {
"U": {"lon": uvfile, "lat": uvfile, "data": uvfile},
"V": {"lon": uvfile, "lat": uvfile, "data": uvfile},
"SSS": {"lon": sssfile, "lat": sssfile, "data": sssfile},
}
variables = {'U': 'u',
'V': 'v',
'SSS': 'sss'}
dimensions = {'U': {'time':'time',
'lon': 'longitude',
'lat': 'latitude'},
'V': {'time':'time',
'lon': 'longitude',
'lat': 'latitude'},
'SSS': {'time':'time_sss',
'lon': 'longitude_sss',
'lat': 'latitude_sss'}}
fieldset = FieldSet.from_netcdf(filenames, variables, dimensions,
allow_time_extrapolation=False, transpose=False, mesh='spherical')
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @VincentIMEDEA, a simple answer to your question is: "Yes, absolutely!" The An example of this is in the Typically, you won't call Happy to answer any other questions! Cheers :) |
Beta Was this translation helpful? Give feedback.
Hi @VincentIMEDEA, a simple answer to your question is: "Yes, absolutely!"
The
FieldSet
object has a nice functionsadd_field()
that allows you to add different fields with different grids and temporal resolutions very easily.An example of this is in the
plasticparcels
project, where we combine 1/12th degree daily ocean model output with 6 hourly wind/wave data (on a different grid), and weekly averaged biogeochemical model data, all in one fieldset.Typically, you won't call
from_netcdf()
(or other associated methods) just once, rather, incrementally build your fieldset. Starting with your hydrodynamic data, you can createfieldset
. Then you can create your SSS fieldset, sayfieldset_sss
,…