Get Seascape Dataset information

ERDDAP dataset info and date ranges for two available datasets: global_monthly and global_8day.

# SeaScape dataset info
ss_gl_mo <- get_ss_info() # default: dataset = "global_monthly"
ss_gl_8d <- get_ss_info("global_8day")
ss_gl_mo
#> <ERDDAP info> noaa_aoml_4729_9ee6_ab54 
#>  Base URL: https://cwcgom.aoml.noaa.gov/erddap 
#>  Dataset Type: griddap 
#>  Dimensions (range):  
#>      time: (2003-01-15T12:00:00Z, 2024-01-15T12:00:00Z) 
#>      latitude: (-89.975, 89.975) 
#>      longitude: (-179.975, 179.975) 
#>  Variables:  
#>      CLASS: 
#>          Units: None 
#>      P: 
#>          Units: Punits
ss_gl_8d
#> <ERDDAP info> noaa_aoml_seascapes_8day 
#>  Base URL: https://cwcgom.aoml.noaa.gov/erddap 
#>  Dataset Type: griddap 
#>  Dimensions (range):  
#>      time: (2002-08-29T12:00:00Z, 2024-01-25T12:00:00Z) 
#>      latitude: (-89.975, 89.975) 
#>      longitude: (-179.975, 179.975) 
#>  Variables:  
#>      CLASS: 
#>          Units: None 
#>      P: 
#>          Units: Punits

# SeaScape date ranges
get_ss_dates(ss_gl_mo)
#> [1] "2003-01-15" "2024-01-15"
get_ss_dates(ss_gl_8d)
#> [1] "2002-08-29" "2024-01-25"

Show Information on Seascape Classes

# show dataset of Seascape Global Classes information
ss_gl_classes
#> # A tibble: 33 × 13
#>    CLASS NAME          `SST (°C)` `SSS (psu)` `ADT (m)` `ICE (%)` `CDOM (m^-1^)`
#>    <dbl> <chr>              <dbl>       <dbl>     <dbl>     <dbl>          <dbl>
#>  1     1 NORTH ATLANT…       5.08        34.2     -0.37         0           0.01
#>  2     2 SUBPOLAR TRA…      12.2         34.4      0.5          0           0.01
#>  3     3 TROPICAL SUB…      24.1         35.3      0.68         0           0.01
#>  4     4 WESTERN WARM…      28.2         34.4      1.1          0           0   
#>  5     5 SUBTROPICAL …      24.0         35.9      0.71         0           0   
#>  6     6 ACC, NUTRIEN…       1.38        34.0     -1            0           0.01
#>  7     7 TEMPERATE TR…      13.0         34.7      0.37         0           0.01
#>  8     8 INDOPACIFIC …      25.1         34.5      0.99         0           0   
#>  9     9 EQUATORIAL T…      28.0         33.8      0.86         0           0.01
#> 10    10 HIGHLY OLIGO…      23.8         35.6      0.87         0           0   
#> # ℹ 23 more rows
#> # ℹ 6 more variables: `CHLA (mg m^-3^)` <dbl>,
#> #   `NFLH (W m^-2^ µm^-1^ sr^-1^)` <dbl>, `NFLH:CHL` <dbl>, LATITUDE <chr>,
#> #   `DOMINANT HEMISPHERE` <chr>, `DOMINANT SEASON` <chr>

# setup paths for plots generated in tables below
dir_svg  <- here::here("inst/svg")
web_svg  <- "../svg"

# show table for Seascape Class 1
tbl_ss_class(1, dir_svg, web_svg)
Variable Class Avg Relative to All Classes All Min All Max
SST (°C)
sea surface temperature in degrees Celsius
5.08 0.15 28.25
SSS (psu)
sea surface salinity in Practical Salt Units
34.18 27.74 38.14
ADT (m)
absolute dynamic topography in meters
-0.37 -1.15 1.10
ICE (%)
ice as percent cover
0.00 0.00 90.00
CDOM (m-1)
colored dissolved organic matter per square meter
0.01 0.00 0.07
CHLA (mg m-3)
Chlorophyll a per cubic meter
0.21 0.04 2.09
NFLH (W m-2 µm-1 sr-1)
normalized fluorescence line height
0.08 0.01 0.24
NFLH:CHL
normalized fluorescence line height chlorophyll component
0.37 0.05 0.79
  • CLASS: 1
  • NAME: NORTH ATLANTIC SPRING, ACC TRANSITION
  • LATITUDE: SUBPOLAR
  • DOMINANT HEMISPHERE: SOUTH
  • DOMINANT SEASON: SPRING-AUTUMN

# show table for Seascape Class 15
tbl_ss_class(15, dir_svg, web_svg)
Variable Class Avg Relative to All Classes All Min All Max
SST (°C)
sea surface temperature in degrees Celsius
25.35 0.15 28.25
SSS (psu)
sea surface salinity in Practical Salt Units
35.40 27.74 38.14
ADT (m)
absolute dynamic topography in meters
0.51 -1.15 1.10
ICE (%)
ice as percent cover
0.00 0.00 90.00
CDOM (m-1)
colored dissolved organic matter per square meter
0.02 0.00 0.07
CHLA (mg m-3)
Chlorophyll a per cubic meter
0.32 0.04 2.09
NFLH (W m-2 µm-1 sr-1)
normalized fluorescence line height
0.06 0.01 0.24
NFLH:CHL
normalized fluorescence line height chlorophyll component
0.20 0.05 0.79
  • CLASS: 15
  • NAME: TROPICAL SEAS
  • LATITUDE: TROPICAL/SUBTROPICAL
  • DOMINANT HEMISPHERE: BOTH
  • DOMINANT SEASON: WINTER

# show table for Seascape Class 33
tbl_ss_class(33, dir_svg, web_svg)
Variable Class Avg Relative to All Classes All Min All Max
SST (°C)
sea surface temperature in degrees Celsius
NA 0.15 28.25
SSS (psu)
sea surface salinity in Practical Salt Units
NA 27.74 38.14
ADT (m)
absolute dynamic topography in meters
NA -1.15 1.10
ICE (%)
ice as percent cover
90 0.00 90.00
CDOM (m-1)
colored dissolved organic matter per square meter
NA 0.00 0.07
CHLA (mg m-3)
Chlorophyll a per cubic meter
NA 0.04 2.09
NFLH (W m-2 µm-1 sr-1)
normalized fluorescence line height
NA 0.01 0.24
NFLH:CHL
normalized fluorescence line height chlorophyll component
NA 0.05 0.79
  • CLASS: 33
  • NAME: PACK ICE
  • LATITUDE: SUBPOLAR POLAR
  • DOMINANT HEMISPHERE: BOTH
  • DOMINANT SEASON: YEAR ROUND

Map Seascapes as image tiles

Get interactive map of Seascape classes:

map_ss_wms(ss_gl_mo)

Note that the image tiles produces by the Web Map Server (WMS) do not contain the data, just tiled image.

Define polygon for extraction of Seascapes

You can use any sf polygon object. This package has a couple helper functions to get polygons of interest, either a National Marine Sanctuary or a simple bounding box.

# bounding box for Florida Keys area
lon = -81.3; lat = 24.5; w = 1.2
ply <- bbox_ply(lon - w, lat - w, lon + w, lat + w)
map_ss_wms(ss_gl_mo, ply)
# setting variables and paths allows for caching data files
sanctuary = "fknms" # or see: ?get_url_ply
dir_data  = here::here("data_ss")
dir_ply   = glue::glue("{dir_data}/ply")
dir_ply
#> /Users/bbest/Github/marinebon/seascapeR/data_ss/ply

# get sanctuary polygon
ply <- get_url_ply(
  sanctuary = sanctuary, 
  dir_ply   = dir_ply)
# show files
fs::dir_tree(dir_ply)
#> /Users/bbest/Github/marinebon/seascapeR/data_ss/ply
#> ├── fknms_py2
#> │   ├── FKNMS_py.sbn
#> │   ├── FKNMS_py.sbx
#> │   ├── fknms_py.dbf
#> │   ├── fknms_py.kml
#> │   ├── fknms_py.prj
#> │   ├── fknms_py.shp
#> │   ├── fknms_py.shp.htm
#> │   ├── fknms_py.shp.xml
#> │   ├── fknms_py.shx
#> │   └── fknms_py.xml
#> ├── fknms_py2.zip
#> ├── mbnms_py2
#> │   ├── mbnms_py.dbf
#> │   ├── mbnms_py.html
#> │   ├── mbnms_py.kml
#> │   ├── mbnms_py.prj
#> │   ├── mbnms_py.sbn
#> │   ├── mbnms_py.sbx
#> │   ├── mbnms_py.shp
#> │   ├── mbnms_py.shp.htm
#> │   └── mbnms_py.shx
#> └── mbnms_py2.zip
# map image tiles with polygon
map_ss_wms(ss_gl_mo, ply)

Get Seascape grids within polygon

# variables and paths
ss_dataset  = "global_8day" # or "global_8day"
ss_var      = "CLASS"       # or "P"
date_beg    = "2022-10-16"
date_end    = "2023-02-10"
dir_grd     = glue::glue(
  "{dir_data}/{sanctuary}_{ss_dataset}")

ss_info <- get_ss_info(dataset = ss_dataset)

# get SeaScape grids from polyon for date range 
grds <- get_ss_grds(
  ss_info, ply, 
  ss_var    = ss_var, 
  date_beg  = date_beg, 
  date_end  = date_end,
  dir_tif   = dir_grd, 
  verbose = T)
#> Found 16 dates between 2022-10-16 and 2023-02-10.
#> Found 16 matching tifs of 16 dates.
#> Reading existing grids ([dir_tif]/grd_CLASS_[date].tif) vs fetching fresh data via ERDDAP.

# show files
fs::dir_tree(dir_grd)
#> /Users/bbest/Github/marinebon/seascapeR/data_ss/fknms_global_8day
#> ├── grd_CLASS_2022.10.16.tif
#> ├── grd_CLASS_2022.10.24.tif
#> ├── grd_CLASS_2022.11.01.tif
#> ├── grd_CLASS_2022.11.09.tif
#> ├── grd_CLASS_2022.11.17.tif
#> ├── grd_CLASS_2022.11.25.tif
#> ├── grd_CLASS_2022.12.03.tif
#> ├── grd_CLASS_2022.12.11.tif
#> ├── grd_CLASS_2022.12.19.tif
#> ├── grd_CLASS_2022.12.27.tif
#> ├── grd_CLASS_2023.01.01.tif
#> ├── grd_CLASS_2023.01.09.tif
#> ├── grd_CLASS_2023.01.17.tif
#> ├── grd_CLASS_2023.01.25.tif
#> ├── grd_CLASS_2023.02.02.tif
#> └── grd_CLASS_2023.02.10.tif

Map Seascape grid with polygon

# get first grid, a raster layer in the raster stack grds
grd <- raster::raster(grds, 1)

# map SeaScape grid
map_ss_grd(grd)

Summarize Seascape grids into a time series table

ts_csv = glue::glue(
  "{dir_data}/{sanctuary}_{ss_dataset}_{ss_var}.csv")

tbl <- sum_ss_grds_to_ts(grds, ts_csv = ts_csv)
tbl
#> # A tibble: 105 × 3
#>    date       cellvalue n_cells
#>    <date>         <dbl>   <dbl>
#>  1 2022-10-16         3       4
#>  2 2022-10-16        11      20
#>  3 2022-10-16        13       3
#>  4 2022-10-16        15     103
#>  5 2022-10-16        21      99
#>  6 2022-10-16        23       1
#>  7 2022-10-16        27      19
#>  8 2022-10-16        NA    1487
#>  9 2022-10-24         3       3
#> 10 2022-10-24        11       2
#> # ℹ 95 more rows

Plot Seascapes over time

# plot SeaScape time series
plot_ss_ts(tbl)