Skip to content

Create an R Shiny App for NWFSC Survey Grid with SST from IO ERDDAP #7

@eeholmes

Description

@eeholmes

Task: Create an R Shiny App for NWFSC Survey Grid SST Analysis

Overview
A R Shiny application to visualize Mean Sea Surface Temperature (SST) on survey grid points from a data frame with lat/lon

Data Sources
SST Data: Fetch from the NOAA ERDDAP server (https://coastwatch.pfeg.noaa.gov/erddap/) using the rerddap package.
Dataset ID: ncdcOisst21Agg_LonPM180
Variable: sst
Spatial Grid: Use the surveyjoin package to access the nwfsc_grid lat/lon points.
nwfsc_grid is a surveyjoin object (not function) that returns a dataframe of the grid.
surveyjoin::nwfsc_grid returns a data.frame with headers like

          lon      lat        area depth_m      survey survey_domain_year split_state
1   -119.5740 31.97990   0.0000000    1414 NWFSC.Combo               2023           C
2   -119.5529 31.97956   0.0000000    1692 NWFSC.Combo               2023           C
3   -119.5317 31.97922   0.0000000    1508 NWFSC.Combo               2023           C

use survey=="NWFSC.Combo"

Functional Requirements
UI Components:

A leaflet map centered on the WA/OR coast.
A dropdown menu or dateInput to select a specific date (limited to the dates in the ncdcOisst21Agg_LonPM180 dataset). Dates are in metadata that can be accessed from rerddap

> library(rerddap)
> # Fetch metadata for a specific dataset
> info_list <- info('jplMURSST41', url = 'https://coastwatch.pfeg.noaa.gov/erddap/')
> # View the metadata
> print(info_list)
<ERDDAP(TM) info> jplMURSST41 
 Base URL: https://coastwatch.pfeg.noaa.gov/erddap 
 Dataset Type: griddap 
 Dimensions (range):  
     time: (2002-06-01T09:00:00Z, 2026-03-23T09:00:00Z) 
     latitude: (-89.99, 89.99) 
     longitude: (-179.99, 180.0) 
 Variables:  
     analysed_sst: 
         Units: degree_C 
     analysis_error: 
         Units: degree_C 
     mask: 
     sea_ice_fraction: 
         Units: 1 

info_list$alldata$time
   row_type variable_name      attribute_name data_type
1 dimension          time                        double
2 attribute          time _CoordinateAxisType    String
3 attribute          time        actual_range    double
4 attribute          time                axis    String
5 attribute          time       ioos_category    String
6 attribute          time           long_name    String
7 attribute          time       standard_name    String
8 attribute          time         time_origin    String
9 attribute          time               units    String
                                                              value
1 nValues=16254, evenlySpaced=false, averageSpacing=1 day 0h 0m 37s
2                                                              Time
3                                           3.681936E8, 1.7730576E9
4                                                                 T
5                                                              Time
6                                            Center time of the day
7                                                              time
8                                              01-JAN-1970 00:00:00
9                                seconds since 1970-01-01T00:00:00Z

A display area or popup to show the Mean SST and Grid Cell ID when a user clicks a point from the nwfsc_grid data.frame lat/lon
.
Reactivity: Ensure the data fetch and spatial join only trigger when the user changes the date.

Color the lat/lon points based on the SST using the viridis color palette.

Include a color legend.
Required Libraries
shiny, leaflet, rerddap, surveyjoin, viridis. add others as needed

Add a README with instructions for how to run.

The environment .github/workflows/copilot-setup-steps.yml install R and the packages.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions