Transposed fields in FieldSet from NetCDF #1239
-
I'm trying to create a FieldSet from a NetCDF file:
When I then do |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Its a bit difficult to diagnose the problem without having the file If you plot by loading the dataset in xarray, do you get the same problem? import xarray as xr
ds = xr.load_dataset('test.nc')
ds.u.plot(x='LON', y='LAT') # LON and LAT here are the dimensions, not the meshgrid variables lon and lat If yes, then the issue was with how fieldset = FieldSet.from_netcdf(filenames,variables,dimensions,mesh='flat',allow_time_extrapolation=True, transpose=True) or by using xarray to transpose and save back to Feel free to upload the dataset to WeTransfer and post the link if you'd like me to look at the dataset. |
Beta Was this translation helpful? Give feedback.
Its a bit difficult to diagnose the problem without having the file
output_layer1.nc
to look at. From my understanding, thetranspose=True
flag is mainly to do with the internal ordering of the dataset (ie. how the NetCDF file appears on disk). Parcels is sensitive to this ordering in that it needs to be["time", "y", "x"]
as mentioned here in the documentation. Normally incorrect ordering is picked up by parcels on read-in, spitting back an informative error message, but your domain could be perfectly square and hence snuck through.If you plot by loading the dataset in xarray, do you get the same problem?