calc_full_extent: Calculates spatial extent of non-zero data from Raster*...

Description Usage Arguments Value Examples

View source: R/ebirdst-mapping.R

Description

After loading a RasterStack of results, there are lots of NA values and plots of individual raster layers will display at the full extent of the study extent. To show an ideal extent, this function trims away 0 and NA values and checks to make sure it returns a reasonable extent for plotting. The returned Extent object can then be used for plotting. To access a pre-calculated extent for the full annual cycle use load_fac_map_parameters().

Usage

1

Arguments

x

Raster* object; either full RasterStack or subset.

Value

raster Extent object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# simple toy example
r <- raster::raster(nrow = 100, ncol = 100)
r[5025:5075] <- 1
raster::extent(r)
calc_full_extent(r)
## Not run: 
# download and load example abundance data
sp_path <- ebirdst_download("example_data")
abd <- load_raster("abundance", sp_path)

# calculate full extent
plot_extent <- calc_full_extent(abd)

# plot
raster::plot(abd[[1]], axes = FALSE, ext = plot_extent)

## End(Not run)

ebirdst documentation built on Jan. 16, 2021, 5:16 p.m.