EcoCast Plus
  • Home
  • West Coast
    • — Sea Turtles —
    • Leatherback Explorer
    • LBST & CMEMS Data
  • Gulf of America
    • GulfCast: Pelagic Longline Optimization
  • Hawaii
  • South Atlantic

Leatherback CMEMS model

The most recent map products from the model are shown below, in addition to an interactive map of the latest prediction.

Status of environmental products from CMEMS:

for (i in seq_along(badge)) {
  cat("- ")
  cat(paste0(names(badge)[i], ": "))
  cat(paste(badge[[i]], "\n"))
}

Latest Map Products

library(bslib)
library(htmltools)
library(httr)
library(glue)

bs_theme_dependencies(bs_theme(preset = "bootstrap")) |>
  lapply(function(x) {
    if (x$name == "bootstrap") {
      x$name <- "bootstrap-from-bslib"
    }
    x
  }) |>
  htmltools::tagList()


# Find latest products in GH repo
prods <- GET("https://api.github.com/repos/joshcullen/CEG_operationalization/contents/model_prediction/TopPredatorWatch/img")
stop_for_status(prods)
filelist <- unlist(lapply(content(prods), "[", "name"), use.names = F)
prod_dates <- data.frame(idx = seq_along(filelist),
                         date = gsub("^[A-Za-z]+\\_|\\.png$", "", filelist) |> 
                           as.Date()
                         )

latest <- prod_dates |> 
  arrange(desc(date))

# Create tabset panel for latest products
navset_card_tab(
  nav_panel(title = "Latest",
            img(src = glue("https://github.com/joshcullen/CEG_operationalization/blob/main/model_prediction/TopPredatorWatch/img/{filelist[latest$idx[1]]}?raw=true", width = "100%"))),
  nav_panel(title = "Latest - 1",
            img(src = glue("https://github.com/joshcullen/CEG_operationalization/blob/main/model_prediction/TopPredatorWatch/img/{filelist[latest$idx[2]]}?raw=true", width = "100%"))),
  nav_panel(title = "Latest - 2",
            img(src = glue("https://github.com/joshcullen/CEG_operationalization/blob/main/model_prediction/TopPredatorWatch/img/{filelist[latest$idx[3]]}?raw=true", width = "100%"))),
  nav_panel(title = "Latest - 3",
            img(src = glue("https://github.com/joshcullen/CEG_operationalization/blob/main/model_prediction/TopPredatorWatch/img/{filelist[latest$idx[4]]}?raw=true", width = "100%")))
  )

Interactive Map

This example shows both model predictions and environmental covariates used to estimate the models. Change the date and selected variable to explore these relationships in more detail. Only the latest 60 days of data and predictions are shown at the moment.

Download Map Products and Raster Layers

From website

Downloading files…

From GitHub

Clone the repository: https://github.com/joshcullen/CEG_operationalization

From R

library(curl)
library(httr)
library(tidyverse)
library(glue)

download_files_git = function(save_dir, file_type, start_date, end_date){
  
  folder <- switch(file_type,
                   "raster" = "rasters",
                   "image" = "img")
  
  # Find files from repo folder
  prods <- httr::GET(glue("https://api.github.com/repos/joshcullen/CEG_operationalization/contents/model_prediction/TopPredatorWatch/{folder}"))
  httr::stop_for_status(prods)  #check to make sure no errors w/ request (should return nothing to console if working properly)
  filelist <- unlist(lapply(content(prods), "[", "name"), use.names = F)
  prod_df <- data.frame(files = filelist,
                        date = gsub("^[A-Za-z]+\\_|\\.tiff$", "", filelist) |> 
                          as.Date()
  )
  
  # Filter files by date range
  prod_filt <- prod_df |> 
    filter(date >= as.Date(start_date),
           date <= as.Date(end_date)) |> 
    pull(files)
  
  git_url <- glue("https://raw.githubusercontent.com/joshcullen/CEG_operationalization/main/model_prediction/TopPredatorWatch/{folder}/{prod_filt}")
  file_dest <- glue("{save_dir}/{prod_filt}")
  
  curl::multi_download(urls = git_url, destfiles = file_dest)
}

# Download files
download_files_git(save_dir = "~/Downloads",
                   file_type = "raster",
                   start_date = "2025-06-25",
                   end_date = "2025-06-30")
download_files_git(save_dir = "~/Downloads",
                   file_type = "image",
                   start_date = "2025-06-25",
                   end_date = "2025-06-30")