Problem with adding wind fields to the fieldset #1109
ClaudiaFarris
started this conversation in
General
Replies: 1 comment
-
Hi @ClaudiaFarris, could it be that your wind fields don't have their units converted? See also the UnitConverter tutorial at https://nbviewer.org/github/OceanParcels/parcels/blob/master/parcels/examples/tutorial_unitconverters.ipynb |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm trying to add the wind fields to my fieldset in order to implement the windage; this is the code that I'm using:
data_current = "20180101_h-CMCC--RFVL-MFSe3r1-MED-b20200901_re-sv01.00.nc"
data_wind= "CRMA-WRF_10mwinds_Adriatic_2018010100-2018010123.nc"
filenames_current = {'U': {'lon': data_current, 'lat': data_current, 'data': data_current}, 'V': {'lon': data_current, 'lat': data_current, 'data': data_current}}
variables_current = {'U': 'u', 'V': 'v'}
dimensions_current = {'U': {'lon': 'lon', 'lat': 'lat', 'time': 'time'}, 'V': {'lon': 'lon', 'lat': 'lat', 'time': 'time'}}
filenames_wind = {'Uwind': {'lon': data_wind, 'lat': data_wind, 'data': data_wind}, 'Vwind' :{'lon': data_wind, 'lat': data_wind, 'data': data_wind}}
variables_wind = {"Uwind": "air_u", "Vwind": "air_v"}
dimensions_wind = {'Uwind': {'lon': 'lon', 'lat': 'lat', 'time': 'time'}, 'Vwind': {'lon': 'lon', 'lat': 'lat', 'time': 'time'}}
fieldset = FieldSet.from_netcdf(filenames_current, variables_current, dimensions_current)
fieldset_wind= FieldSet.from_netcdf(filenames_wind, variables_wind, dimensions_wind)
fieldset.add_field(fieldset_wind.Uwind)
fieldset.add_field(fieldset_wind.Vwind)
And this is the advection kernel that I'm using for my first tests:
def Advection2(particle, fieldset, time):
(uc1, vc1 )= fieldset.UV[time, particle.depth, particle.lat, particle.lon]
u1, v1 = fieldset.Uwind[time, particle.depth, particle.lat, particle.lon],fieldset.Vwind[time, particle.depth, particle.lat, particle.lon]
ua1 = u1+uc1
va1 = v1+vc1
particle.lon+= ua1 * particle.dt
particle.lat += va1 * particle.dt
When I run the simulation I get this warning: WARNING: ParticleSet is empty on writing as array at time 7200.
I don't know what the problem could be. I've tried to read the wind fields as currents in order to see if the problem was the lecture of the netcdf file but it has been read correctly and the particles have been advected.
Anyone has an idea how I could solve this problem?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions