query_grid: Create a query grid

View source: R/query_grid.R

query_gridR Documentation

Create a query grid

Description

Create a grid of query values for of longitude, latitude, and date.

Usage

query_grid(lon, lat, date)

Arguments

lon

vector of longitudes in the grid

lat

vector of latitudes in the grid

date

vector of dates in the grid

Details

This be used as the second argument to extract() for general 'point-in-time' value extraction.

The ouput is a data frame of the grid expanded, a row for every combination of longitude, latitude, date - so can be quite large (!) so be careful with very fine resolution or long series.

Examples

lon <- c(100, 110, 120)
lat <-seq(-60, -40, by = 5)
dts <- seq(as.Date("2002-03-03"), by = "5 days", length.out = 10)
qd <- query_grid(lon = lon, lat = lat, date = dts)
## use bilinear to ensure we get an interpolate value in the grid
qd$sst <- extract(readsst, qd, method = "bilinear")
## ssha
qd$ssha <- extract(readssh, qd, ssha = TRUE, method = "bilinear")
qd$wind_mag <- extract(readwind, qd, magonly = TRUE, method = "bilinear") 

AustralianAntarcticDivision/raadtools documentation built on Nov. 14, 2024, 4:27 p.m.