parcels
parcels copied to clipboard
nearest neighbor interpolation is still interpolating via iteration
When nearest neighbor interpolation is specified, parcels still runs an iterative procedure, which deviates if a curved grid is used:
fieldset = FieldSet.from_netcdf(filenames, variables, dimensions, interp_method='nearest')
The logger gives:
Correct cell not found for (7.500000, 54.700001) after 1000000 iterations
Debug info: old particle indices: (yi, xi) 0 0
new particle indices: (yi, xi) 0 0
Mesh 2d shape: 638 1449
Relative particle position: (xsi, eta) nan -1.0000000000000000e+00
Though the interpolation is present in the code, see https://github.com/OceanParcels/parcels/blob/92ab2c007dbf89618daec5160d4c5562230f2194/parcels/include/parcels.h#L198
Maybe the if statements later on are not pulling this through see https://github.com/OceanParcels/parcels/blob/92ab2c007dbf89618daec5160d4c5562230f2194/parcels/include/parcels.h#L531
Hmm, the error is about finding in which cell the particle is located, which is also a required operation for nearest neighbour search.
I think that the error is thrown by
https://github.com/OceanParcels/parcels/blob/92ab2c007dbf89618daec5160d4c5562230f2194/parcels/include/parcels.h#L468-L470
Which links to here (which is also where the error is thrown). So this is still before the else if
that you refer to above.
Hence, I don't think it's unexpected that these errors are thrown, even if you do nearest neighbour search.
I'll be closing this for now @dicaearchus as its not clear if the issue is with the simulation setup or with parcels itself. If you feel that the error is with parcels, please elaborate here (preferably with code we can run) and we can re-open this issue