knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

xytract

The goal of xytract is to provide a generic basis for matching locations in time to raster data.

The interface is the xytract function, with required arguments

It doesn't matter what projection the raster files are in, it's assumed that the query points are longlat and these will be projected to the projection of the raster data.

It's assumed that inputfiles are in order of date.

TODO

Installation

You can install the dev version of xytract from GitHub with:

devtools::install_github("mdsumner/xytract")

Example

This is a basic example which shows you how to match a set of locations with time to raster data.

WIP

library(xytract)
files_db <- get_example_data()

## define a function to read 
read_ice <- function(date, ...) {
  if (missing(date)) return(raster::raster(files_db$fullname[1]))
  catch <- list(...)
  stopifnot(length(date) == 1L)
  idx <- findInterval(date, files_db$date)
  raster::raster(files_db$fullname[idx])
}

xyt <- tibble::tibble(x = seq(-180, 175, by = 5), y = 84, t = seq(min(files_db$date), max(files_db$date), length = length(x)))
xyt$conc <- xytract(read_ice, xyt)


mdsumner/xytract documentation built on May 21, 2019, 12:21 p.m.