You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was interpolation a high-res field and I had to stop the computation after one hour because it was still running... I took the occasion to better analyse the difference between akima::interp and fields::interp.surface.grid. Apparently, the former is faster with smaller grids, the latter becomes significantly faster when the grid has more than 10k points. Here a reproducible example to compare the performances:
##
library(akima)
library(fields)
library(microbenchmark)
SIZE = 50
## test data
x = seq(0, 1, length.out = SIZE)
y = seq(0, 1, length.out = SIZE)
df = expand.grid(x = x, y = y)
df$z = rnorm(nrow(df))
z_matrix = matrix(df$z, ncol = length(y), nrow = length(x))
xo = seq(0, 1, length.out = SIZE*10)
yo = seq(0, 1, length.out = SIZE*10)
mb = microbenchmark(
i1 <- akima::interp(df$x, df$y, df$z, xo, yo),
i2 <- fields::interp.surface.grid(list(x = x, y = y, z = z_matrix),
list(x = xo, y = yo)), times = 10
)
This is very important to help the user to choose the best bilin.method.
UPDATE: We have a problem. I did a small benchmark with a real NetCDF with loadGridData + interpGrid and... the fields version took a few seconds while the akima is still running...(five minutes now). Can someone trying something similar?
2nd UPDATE: Switching all my code to fields has really improved the execution time, unbelievable. I'd suggest also considering the inclusion of bicubic.grid from akima that seems faster than both.
The text was updated successfully, but these errors were encountered:
Hi Matteo, thanks for reporting. Certainly relevant information to better inform the users. Regarding nearest neighbours (by far the most advisable method in most climate applications...), I am right now looking at a faster Rcpp-based implementation. To be updated soon -hopefully-.
Thanks @jbedia, I am rather surprised by your statement about nearest neighbours...I have never used it, normally I use interpolation to match two grids, for example increasing the resolution of a climate forecast to the grid of observations (for example, System4 to E-OBS). Do you think in this case I should use NN?
It depends on the characteristics of your study of course, but in most cases I'd rather opt for NN in order to preserve the original data and avoid spurious gradients, particularly when the difference in resolution between both datasets is large.
Hi, I was interpolation a high-res field and I had to stop the computation after one hour because it was still running... I took the occasion to better analyse the difference between
akima::interp
andfields::interp.surface.grid
. Apparently, the former is faster with smaller grids, the latter becomes significantly faster when the grid has more than 10k points. Here a reproducible example to compare the performances:This is very important to help the user to choose the best
bilin.method
.UPDATE: We have a problem. I did a small benchmark with a real NetCDF with
loadGridData
+interpGrid
and... thefields
version took a few seconds while theakima
is still running...(five minutes now). Can someone trying something similar?2nd UPDATE: Switching all my code to fields has really improved the execution time, unbelievable. I'd suggest also considering the inclusion of
bicubic.grid
fromakima
that seems faster than both.The text was updated successfully, but these errors were encountered: