Black Seabass Mean Map

Mean sea bass percent larvae contribution.

# load libraries ----
library(tidyverse) # install.packages('tidyverse')
library(raster)
library(leaflet)
select = dplyr::select
stack  = raster::stack

r = raster('G:/Team_Folders/Steph/bsb/mean.tif')

d = data_frame(
  quantity = raster::getValues(r),
  cellid   = 1:length(quantity),
  area_km2 = 8)

d2 = d %>%
  filter(!is.na(quantity)) %>%
  arrange(desc(quantity)) %>%
  mutate(
    pct_quantity     = quantity/sum(quantity)*100,
    cum_pct_quantity = cumsum(quantity/sum(quantity)*100),
    cum_area_km2     = cumsum(area_km2))

#tail(d2) # 7208 km2
#tail(d2$cum_area_km2, 1) # 7208 km2

d3 = d %>%
  left_join(d2, by='cellid')
#summary(d3)

r2 = setValues(r, d3$cum_pct_quantity)

binpal <- colorBin("Spectral", seq(0,100), 10, pretty = FALSE, na.color = "transparent")

leaflet() %>% 
  addTiles() %>%
  addProviderTiles('Esri.OceanBasemap') %>%
  addRasterImage(r2, colors = binpal, opacity = 0.6) %>%
  addMarkers(lat=31.3855157, lng=-80.8843762, popup = "Gray's Reef") %>%
  addLegend(
    pal = binpal, values = seq(0,100),
    title = "cum % larvae")

Black Sea Bass Area Graph

Area Required to Attain Target Percent qunatity of Black Sea Bass Larvae

Red Snapper Mean Map

Mean Red Snapper percent larvae contribution.

# load libraries ----
library(tidyverse) # install.packages('tidyverse')
library(raster)
library(leaflet)
select = dplyr::select
stack  = raster::stack

r = raster('G:/Team_Folders/Steph/rs/mean.tif')

d = data_frame(
  quantity = raster::getValues(r),
  cellid   = 1:length(quantity),
  area_km2 = 8)

d2 = d %>%
  filter(!is.na(quantity)) %>%
  arrange(desc(quantity)) %>%
  mutate(
    pct_quantity     = quantity/sum(quantity)*100,
    cum_pct_quantity = cumsum(quantity/sum(quantity)*100),
    cum_area_km2     = cumsum(area_km2))

#tail(d2) # 7208 km2
#tail(d2$cum_area_km2, 1) # 7208 km2

d3 = d %>%
  left_join(d2, by='cellid')
#summary(d3)

r2 = setValues(r, d3$cum_pct_quantity)

binpal <- colorBin("Spectral", seq(0,100), 10, pretty = FALSE, na.color = "transparent")

leaflet() %>% 
  addTiles() %>%
  addProviderTiles('Esri.OceanBasemap') %>%
  addRasterImage(r2, colors = binpal, opacity = 0.6) %>%
  addMarkers(lat=31.3855157, lng=-80.8843762, popup = "Gray's Reef") %>%
  addLegend(
    pal = binpal, values = seq(0,100),
    title = "cum % larvae")

Scamp Mean Map

Mean Scamp percent larvae contribution.

# load libraries ----
library(tidyverse) # install.packages('tidyverse')
library(raster)
library(leaflet)
select = dplyr::select
stack  = raster::stack

r = raster('G:/Team_Folders/Steph/sp/mean.tif')

d = data_frame(
  quantity = raster::getValues(r),
  cellid   = 1:length(quantity),
  area_km2 = 8)

d2 = d %>%
  filter(!is.na(quantity)) %>%
  arrange(desc(quantity)) %>%
  mutate(
    pct_quantity     = quantity/sum(quantity)*100,
    cum_pct_quantity = cumsum(quantity/sum(quantity)*100),
    cum_area_km2     = cumsum(area_km2))

#tail(d2) # 7208 km2
#tail(d2$cum_area_km2, 1) # 7208 km2

d3 = d %>%
  left_join(d2, by='cellid')
#summary(d3)

r2 = setValues(r, d3$cum_pct_quantity)

binpal <- colorBin("Spectral", seq(0,100), 10, pretty = FALSE, na.color = "transparent")

leaflet() %>% 
  addTiles() %>%
  addProviderTiles('Esri.OceanBasemap') %>%
  addRasterImage(r2, colors = binpal, opacity = 0.6) %>%
  addMarkers(lat=31.3855157, lng=-80.8843762, popup = "Gray's Reef") %>%
  addLegend(
    pal = binpal, values = seq(0,100),
    title = "cum % larvae")

Gag Mean Map

Mean Gag percent larvae contribution.

# load libraries ----
library(tidyverse) # install.packages('tidyverse')
library(raster)
library(leaflet)
select = dplyr::select
stack  = raster::stack

r = raster('G:/Team_Folders/Steph/gg/mean.tif')

d = data_frame(
  quantity = raster::getValues(r),
  cellid   = 1:length(quantity),
  area_km2 = 8)

d2 = d %>%
  filter(!is.na(quantity)) %>%
  arrange(desc(quantity)) %>%
  mutate(
    pct_quantity     = quantity/sum(quantity)*100,
    cum_pct_quantity = cumsum(quantity/sum(quantity)*100),
    cum_area_km2     = cumsum(area_km2))

#tail(d2) # 7208 km2
#tail(d2$cum_area_km2, 1) # 7208 km2

d3 = d %>%
  left_join(d2, by='cellid')
#summary(d3)

r2 = setValues(r, d3$cum_pct_quantity)

binpal <- colorBin("Spectral", seq(0,100), 10, pretty = FALSE, na.color = "transparent")

leaflet() %>% 
  addTiles() %>%
  addProviderTiles('Esri.OceanBasemap') %>%
  addRasterImage(r2, colors = binpal, opacity = 0.6) %>%
  addMarkers(lat=31.3855157, lng=-80.8843762, popup = "Gray's Reef") %>%
  addLegend(
    pal = binpal, values = seq(0,100),
    title = "cum % larvae")

Video

library(vembedr)

embed_youtube(id="wL-nUjYeMXU", width=672, height=480)

Rmarkdown

For more options in knitting this HTML document, see: