cumsumAtSamplingLocation: Cumulative sum at coordinates

View source: R/CumSumSuite.R

cumsumAtSamplingLocationR Documentation

Cumulative sum at coordinates

Description

Function estimates cumulative sum of all values in a surface below the value at a specified longitude and latitude.

Usage

cumsumAtSamplingLocation(indivraster, Lat, Lon)

Arguments

indivraster

RasterLayer representing normalized probability of origin surface

Lat

Integer latitude

Lon

Integer longitude

See Also

makecumsumSurface

Examples

# Generate example probability surface.
myiso <- raster::rasterFromXYZ(isoscape)
myiso_sd <- rasterFromXYZ(isoscape_sd)
exampleSurface <- isotopeAssignmentModel(
         ID = "A",
         isotopeValue = -100,
         SD_indv = 5,
         precip_raster = myiso,
         precip_SD_raster = myiso_sd,
         nClusters = FALSE
         )
# Calculate odds ratio at specific point.
set.seed(1)
x <- sample( which( !is.na(exampleSurface[]) ), size = 1)
pt <- raster::xyFromCell(exampleSurface, x)
cumsumAtSamplingLocation(indivraster = exampleSurface, Lat = pt[2], Lon = pt[1])


cjcampbell/IsoModAT documentation built on Feb. 21, 2024, 10:27 a.m.