Dec 11, 2015 11:34
С помощью библиотеки {akima} можно быстро создавать гриды на основе случайно распределенной сети точек, можно перерасчитывать значения из узлов существующего грида для точек, находящихся между этими узлами, можно перерасчитывать грид с одним шагом в грид с другим шагом.
# extrapolation function does not able to work with NA, it has to be replaces with 0
value_one_time_stamp[!is.finite(value_one_time_stamp)] <- 0
# calculate interpolated grid
akima_bic_grid <- bicubic.grid(lon_x_original, #
lat_y_original,
value_one_time_stamp, # matrix with values
c(min_long, max_long), # xlim
c(min_lat, max_lat), # ylim
0.01, # output grid spacing in x direction
0.01) # output grid spacing in y direction
### extrapolation function does not work with NA, it has to be replaces with 0
# stations have to be far away from coastal areas
value_one_time_stamp[!is.finite(value_one_time_stamp)] <- 0
akima_bic <- bicubic(lon_x_original, # a vector containing the x coordinates of the rectangular data grid
lat_y_original, # a vector containing the y coordinates of the rectangular data grid
value_one_time_stamp, # a matrix containing the z[i,j] data values for the grid points (x[i],y[j]).
coords_POD$x, # vector of x coordinates used to interpolate at
coords_POD$y) # vector of y coordinates used to interpolate at
программирование,
программы,
работа,
r,
карты,
базы данных