Interpolations.jl has support for cases where land points exist, but I didn't manage to use it. Instead I add code that drops NaN points (by setting to zero) and then dividing by the sum of ocean weights so that the interpolation remains a true weighted average.
Ideally we can use built-in Interpolations.jl features instead.
This workaround comes into play for the function sample_observations.
The workaround is correct is in the sense that it does linear extrapolation over a maximum length of one grid cell.
e.g., https://github.com/ggebbie/TMI.jl/blob/e3aa8bba05e2da79213e6e66602b93d1b4f745de/src/TMI.jl#L967
Interpolations.jl has support for cases where land points exist, but I didn't manage to use it. Instead I add code that drops NaN points (by setting to zero) and then dividing by the sum of ocean weights so that the interpolation remains a true weighted average.
Ideally we can use built-in Interpolations.jl features instead.
This workaround comes into play for the function
sample_observations
.The workaround is correct is in the sense that it does linear extrapolation over a maximum length of one grid cell.