raster_subsetByDistance: Subset a Raster* by distance from a location

Description Usage Arguments Value Examples

View source: R/raster_subsetByDistance.R

Description

This function subsets a raster object just like a round cookie cutter. All cells (up to count) within radius km of the target location are returned.

Usage

1
2
3
4
5
6
7
raster_subsetByDistance(
  raster = NULL,
  longitude = NULL,
  latitude = NULL,
  radius = 50,
  count = NULL
)

Arguments

raster

A Raster* object.

longitude

Target longitude from which the radius will be calculated.

latitude

Target latitude from which the radius will be calculated.

radius

Distance (km) of radius from target location.

count

Number of grid cells within radius to return.

Value

A Raster* object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(AirFireModeling)
setModelDataDir('~/Data/BlueSky')

# Load model data
rasterList <- raster_load(
  modelName = "PNW-4km",
  modelRun = c(2020091300, 2020091400, 2020091500, 2020091600),
  xlim = c(-125, -115),
  ylim = c(42, 50)
)

Portland_area <- raster_subsetByDistance(
  rasterList,
  longitude = -122.68,
  latitude = 45.52,
  radius = 100
)

raster_ggmap(Portland_area)

MazamaScience/AirFireModeling documentation built on March 13, 2021, 12:02 a.m.