FieldSet.from_netcdf
when the NetCDF files have depth
dimension
#1959
-
Parcels version3.1.2 DescriptionI'm trying to update from OceanParcels v2.3.0 to v3.1.2. I was following the example to create a However, my files do have a Otherwise, they have a similar structure to the example ones: However, when trying to create a
I tried the suggestion of using And that seems to work:
I'm not sure if this is a bug, but this same code used to work in OceanParcels v2.3.0 with both Code sampleI know that to run the example you need the data files. If required, I can try and upload them somewhere, because they are too big to be attached directly in Github. fieldset = parcels.FieldSet.from_netcdf(
{
"U": ["./test/data/uv/2020-03-20.nc", "./test/data/uv/2020-03-21.nc"],
"V": ["./test/data/uv/2020-03-20.nc", "./test/data/uv/2020-03-21.nc"],
},
variables={"U": "uo", "V": "vo"},
dimensions={
"time": "time",
"depth": "depth",
"lat": "latitude",
"lon": "longitude",
},
)
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I would need to have a better look at the actual datasets that you're using in order to get a better idea. Would you be able to provide me the data files so that I can have a look? (via https://wetransfer.com/ perhaps) I think it might be something to do with the time dimension, but that's all I can gather without the data files to look at. PS: Just migrating this to a Q&A since this is more of a usage question than a bug :) |
Beta Was this translation helpful? Give feedback.
-
@VeckoTheGecko Thanks, here you have the data. I labelled it a bug because it used to work, but maybe it needs to be changed in newer versions: (I reduced the lat/lons so it fits here compressed) |
Beta Was this translation helpful? Give feedback.
-
This is weird. With exactly the same data files, this works:
But this doesn't
I (maybe incorrectly) assume that both things should be equivalent, right? |
Beta Was this translation helpful? Give feedback.
Hmm, yes this is a bug. For some reason having the depth dimension there is causing an issue.
Yes, these both should be equivalent.
Internally in v3 of Parcels we don't use mf_dataset to open the NetCDF files. In v4 we will be working very closely with xarray for fieldset loading. Going to make an issue so that we can track this. I think it would be good if you go ahead with using
from_xarray_dataset
for the timebeing.Thanks for the report and minimal examples!