Skip to contents

MAMU comes with the radar_cone function, originally designed to interpolate data points around radar stations where birds may be flying. For a given (x,y) spatial point, heading, and radius, radar_cone produces a conical gradient raster.

library(MAMU)

# Generate a dummy point of data somewhere in British Columbia
pt <- sf::st_point(c(-126, 53)) %>%
  sf::st_sfc(crs = 4326) %>%
  sf::st_transform(crs = 3005)

# Set our radius, flight heading, and raster resolution parameters
radius <- 30000
heading <- 45
res <- 500

# Create a set of maximum raster values
max_values <- c(1, 5, 10)

# Create a set of pie chunks to interpolate around
# to demonstrate what the 'theta' parameter does in the function
thetas <- c(0, 30, 90, 120)

# Now create a few sets of interpolated cones!
# For each value of theta, run the radar_cone function
# with our above parameters.
cones_max1 <- mapply(radar_cone,
       theta = thetas,
       MoreArgs = list(pt = pt, 
                       radius = radius,
                       res = res, 
                       heading = heading,
                       invert = TRUE,
                       maxvalue = max_values[[1]]))

cones_max5 <- mapply(radar_cone,
       theta = thetas,
       MoreArgs = list(pt = pt, 
                       radius = radius,
                       res = res, 
                       heading = heading,
                       invert = TRUE,
                       maxvalue = max_values[[2]]))

cones_max10 <- mapply(radar_cone,
       theta = thetas,
       MoreArgs = list(pt = pt, 
                       radius = radius,
                       res = res, 
                       heading = heading,
                       invert = TRUE,
                       maxvalue = max_values[[3]]))