Return data.framee or list of raster and df from points. When is data.frame contains cell value, interpolation for lat long based on neighour cells,

xtractor_raster(
  br,
  points,
  times,
  crs_points = 4326,
  tz = "America/Sao_Paulo",
  verbose = TRUE,
  allow.cartesian = TRUE
)

Arguments

br

RasterBrick

points

data.frame, matrix, SpatialPointsDataFrame or sf 'POINTS', with coordinates East-weast (lat), north-south (long) and Station.

times

Character; UTC time (one time for each layer)

crs_points

Integer, crs points.

tz

Character; Time zone

verbose

logical

allow.cartesian

logical (from data.table): prevents joins that would result in more than nrow(x)+nrow(i) rows. This is usually caused by duplicate values in i's join columns, each of which join to the same group in 'x' over and over again: a misspecified join. Usually this was not intended and the join needs to be changed. The word 'cartesian' is used loosely in this context. The traditional cartesian join is (deliberately) difficult to achieve in data.table: where every row in i joins to every row in x (a nrow(x)*nrow(i) row result). 'cartesian' is just meant in a 'large multiplicative' sense, so FALSE does not always prevent a traditional cartesian join.

Value

Return data.framee or list of raster and df

Note

Based on NCL scrip xtractor from DCA/IAG/USP

Examples

if (FALSE) { # do not run # br <- brick("wrfout") data(cetesb) df <- xtractor_raster(br = br, points = cetesb) }