AssertionError when using FieldSet with no variations in velocity field with time #1585
Closed
mathildejutras
started this conversation in
General
Replies: 1 comment
-
|
If someone every gets the same error, it turns out that inversing the order of the lon and lat dimensions in the dataset works. |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am trying to launch particles from a list using a constant velocity field, so without any time component. I was able to do it with other velocity data in the same format and with pretty much the same script, so I don't understand what is causing my error.
I get this error :
AssertionError: Field U expecting a data shape of [tdim, ydim, xdim]. Flag transpose=True could help to reorder the data.But I don't have a time dimension. I would expect the algorithm simply uses the velocities as fixed in time in that case (as they did in the past for me).
Here's my script:
`file = '../../Subdatasets/SO_netcdf/Vel_SO.nc'
#Setting up the fieldset we will create using our datafile_names ={'U':file,'V':file}variables = {'U':'ugeo','V':'vgeo'}dimensions = {'lat':'lat','lon':'lon'}print('Create particle set')fset = FieldSet.from_netcdf(file,variables,dimensions)Here's what file content looks like:
<xarray.Dataset>Dimensions: (lon: 360, lat: 65)Coordinates:* lon (lon) float32 0.5 1.5 2.5 3.5 4.5 ... 355.5 356.5 357.5 358.5 359.5* lat (lat) float32 -64.5 -63.5 -62.5 -61.5 -60.5 ... -3.5 -2.5 -1.5 -0.5Data variables:ugeo (lon, lat) float64 nan nan nan nan ... 0.008358 -0.01001 nanvgeo (lon, lat) float64 nan nan nan nan nan nan ... nan nan nan nan nanBeta Was this translation helpful? Give feedback.
All reactions