Getting Started

To install the nybem package, install from GitHub using the remotes package:

remotes::install_github(repo = "MVR-GIS/nybem")

Load Required Packages

library(nybem)
library(raster)

List the NYBEM Models

The nybem package contains the models created for the ecological modeling section of the NTBEM feasibility study. Notice that the nybem::nybem_submodels list contains a pair of data frames for each submodel in the study. Each pair of dataframes is named for the submodel it represents (i.e., NYBEM.fresh.tid = Freshwater Tidal Zone habitat model). The first data frame contains the habitat variables and their matching suitability index values, while the second data frame (*_labels) contains the labels used in plotting.

# Load the model data
nybem_submodels <- nybem::nybem_submodels

# View the available submodels
names(nybem_submodels)

View the Suitability Index data frame

# View the Freshwater Tidal model
# View table of habitat variables and their suitability index values 
nybem_submodels$NYBEM.fresh.tid

View the Suitability Index model labels

nybem_submodels$NYBEM.fresh.tid_labels

Plot the Suitability Index Values

# Freshwater, Tidal
nybem::HSIplotter(nybem_submodels$NYBEM.fresh.tid,
                  xlab = nybem_submodels$NYBEM.fresh.tid_labels$label,
                  ylab = nybem_submodels$NYBEM.fresh.tid_labels$variable)

Create Site Observations

# Single numeric site observations
salinity   <- 40
veg.cover  <- 100
deposition <- 0
obs_1 <- list(salinity, veg.cover, deposition)
obs_1
# Raster site observations
salinity_ras   <- raster::raster(ncol = 2, nrow = 2, vals = rep_len(40, 4))
veg.cover_ras  <- raster::raster(ncol = 2, nrow = 2, vals = rep_len(100, 4))
deposition_ras <- raster::raster(ncol = 2, nrow = 2, vals = rep_len(0, 4))

obs_2 <- list(salinity_ras, veg.cover_ras, deposition_ras)
obs_2

Calculate Suitability Index Values

# Suitability Index value for single numeric site observations
siv_fresh.tid_obs_1 <- nybem::SIcalc(SI = nybem_submodels$NYBEM.fresh.tid,
                                 input_proj = obs_1)
siv_fresh.tid_obs_1
# Suitability Index value for raster site observations
siv_fresh.tid_obs_2 <- nybem::SIcalc(SI = nybem_submodels$NYBEM.fresh.tid,
                                 input_proj = obs_2)
siv_fresh.tid_obs_2

Calculate Habitat Suitability Index

# Calculate HSI for single numeric site observations
hsi_fresh.tid_obs_1 <- nybem::HSIcalc(si_list = siv_fresh.tid_obs_1)
hsi_fresh.tid_obs_1
# Calculate HSI for raster site observations
hsi_fresh.tid_obs_2 <- nybem::HSIcalc(si_list = siv_fresh.tid_obs_2)
hsi_fresh.tid_obs_2


MVR-GIS/nybem documentation built on Feb. 9, 2023, 7:03 a.m.