OpenDrift/opendrift

Trouble reading current netcdf files in OceanDrift

Closed this issue · 2 comments

Discussed in #1380

Originally posted by PerharicC August 22, 2024
Hi.

I am trying to run a simulation in OceanDrift, where one of the inputs is a netcdf file containing x and y sea water velocity info. Upon checking the output .nc file I have found, that the velocities at the specified seeding location do not match the ones in the reader at all. In fact they differ by 2 orders of magnitude, thus I am guessing it is not a result of interpolation. Furthermore I have found, that the values in the output match reader values at a completely different location, as if there was some sort of shift in the reader.
Bellow I am providing the current file for the reader and a condensed working example to show the issue.

This is the link to the current file that OceanDrift reads: https://drive.google.com/file/d/1O4_U9SE48injbRvZDvUUE1S-MjgIeIgs/view?usp=sharing

This is the link to a working example of the problem: https://drive.google.com/file/d/1Qx1Y0k-QeaOvXgO5TQ-3DExfHhC7W2Te/view?usp=sharing

Any insight would be much appreciated. Thank you!

Best regards,
Crtomir Perharic

Hi,

This took some time to debug - but turned out to be a dateline issue in reader_netCDF_CF_generic.
Since the dataset has a coarse time resolution (monthly), a quite large buffer is read around the given particle, and this was crossing the dateline. This resulted in non-monotonic longitude in the returned datablock, and thus erroneous interpolation.

This commit should fix the issue:
9621459

Thank you for the bug report, with data and reproducible example.

Dear Knut.

Thank you so much, it indeed works!
I am closing the issue.

Crtomir