You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/get_scenario.R
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
#'
8
8
#' @returns a data frame with columns for id, scenario, year, SLR in meters, and SLR in feet.
9
9
#'
10
-
#' @details Information from <https://sealevel.nasa.gov/task-force-scenario-tool?psmsl_id={gauge}>. Results are SLR in mm and feet for the intermediate low, intermediate, and intermediate high scenarios by default based on recommended scenarios from the Climate Science Advisory Panel. Full options for scenarios are `'Low'`, `'IntLow'`, `'Int'`, `'IntHigh'`, and `'High'`. Values for SLR are relative change from 2020.
10
+
#' @details Information from <https://sealevel.nasa.gov/task-force-scenario-tool?psmsl_id={gauge}>. Results are SLR in meters and feet for the intermediate low, intermediate, and intermediate high scenarios by default based on recommended scenarios from the Climate Science Advisory Panel. Full options for scenarios are `'Low'`, `'IntLow'`, `'Int'`, `'IntHigh'`, and `'High'`. Values for SLR are relative change from 2020.
Copy file name to clipboardExpand all lines: vignettes/figs.Rmd
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@ knitr::opts_chunk$set(
23
23
24
24
```{r setup}
25
25
library(slrcsap)
26
+
library(ggplot2)
26
27
```
27
28
28
29
This vignette provides two figures that support the 2025 update of sea level rise projections for the Tampa Bay region. The report was created by the Climate Science Advisory Panel (CSAP) to update recommendations from @tbep0519.
@@ -31,13 +32,18 @@ The first figure shows mean monthly sea level at the St. Petersburg, FL tide gau
31
32
32
33
```{r sealevelplot, fig.width = 8, fig.height = 3, fig.cap="1947-2025 monthly mean sea level (MSL) in St. Petersburg, FL, NOAA tide gauge 8726520. Seasonal cycle removed."}
33
34
dat <- get_sealevel()
34
-
plot_sealevel(dat)
35
+
plot_sealevel(dat, yrng = c(-1, 1), ybrk = 5)
35
36
```
36
37
37
38
The second figure shows three sea level rise scenarios for St. Petersburg, FL based on regionally corrected NOAA 2022 curves. Download the figure [here](https://tbep-tech.github.io/slrcsap/articles/figs_files/figure-html/scenarioplot.png).
38
39
39
40
```{r scenarioplot, fig.width = 8, fig.height = 4, fig.cap="Graphic relative sea level change (RSLC) scenarios for St. Petersburg, FL, as calculated using the regionally corrected NOAA 2022 curves."}
Copy file name to clipboardExpand all lines: vignettes/refs.bib
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,15 @@
1
+
@techreport{sweet2022,
2
+
title={Global and Regional Sea Level Rise Scenarios for the {U}nited {S}tates: Updated Mean Projections and Extreme Water Level Probabilities Along {U.S.} Coastlines},
3
+
author={Sweet, W.V. and Hamlington, B.D. and Kopp, R.E. and Weaver, C.P. and Barnard, P.L. and Bekaert, D. and Brooks, W. and Craghan, M. and Dusek, G. and Frederikse, T. and Garner, G. and Genz, A.S. and Krasting, J.P. and Larour, E. and Marcy, D. and Marra, J.J. and Obeysekera, J. and Osler, M. and Pendleton, M. and Roman, D. and Schmied, L. and Veatch, W. and White, K.D. and Zuzak, C.},
4
+
year={2022},
5
+
institution={National Oceanic and Atmospheric Administration, National Ocean Service},
Copy file name to clipboardExpand all lines: vignettes/slrcsap.Rmd
+92-4Lines changed: 92 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -36,11 +36,99 @@ library(slrcsap)
36
36
37
37
The package includes two core functions to download data and two core functions to plot data. The two download functions are `get_sealevel()` and `get_scenario()` to download tidal gauge data and sea level rise scenario data, respectively. The corresponding plot functions to view data retrieved from the download functions are `plot_sealevel()` and `plot_scenario()`. The content below demonstrates how to use each function, including the optional arguments that can be used to customize the output.
38
38
39
-
Tidal gauge data is downloaded from the NOAA Tides and Currents website. The data is available for all NOAA tide gauges, but the package is currently set up to download data for the St. Petersburg, FL gauge (NOAA ID 8726520). The data is downloaded as a CSV file and then read into R. The data includes monthly mean sea level (MSL) values from 1947 to the present, including a seasonal correction.
39
+
### Sea level Data
40
+
41
+
Sea level data is downloaded from the [NOAA Tides and Currents](https://tidesandcurrents.noaa.gov){target="_blank} website. The data is available for all NOAA tide gauges and is setup to download data for the St. Petersburg, FL gauge (NOAA ID 8726520) by default. The data is read directly into R from the URL <https://tidesandcurrents.noaa.gov/sltrends/data/8726520_meantrend.txt>. The data includes monthly mean sea level (MSL) values from 1947 to the present, including a seasonal correction.
42
+
43
+
```{r}
44
+
# Download sea level data for St. Petersburg
45
+
spsealevel <- get_sealevel()
46
+
head(spsealevel)
47
+
```
48
+
49
+
Data for alternative stations can be obtained using the `gauge` argument.
50
+
51
+
```{r}
52
+
# Download sea level data for Cedar Key
53
+
cksealevel <- get_sealevel(gauge = 8727520)
54
+
head(cksealevel)
55
+
```
56
+
57
+
The sea level data can be plotted using the `plot_sealevel()` function.
58
+
59
+
```{r, figheight = 3, fig.width = 8}
60
+
# Plot sea level data for St. Petersburg
61
+
plot_sealevel(spsealevel)
62
+
63
+
# Plot sea level data for Cedar Key
64
+
plot_sealevel(cksealevel)
65
+
```
66
+
67
+
Various arguments for `plot_sealevel()` can change the appearance of the plot. Below, the color, units, and x-axis range are modified
68
+
69
+
```{r, fig.height = 3, fig.width = 8}
70
+
# Change arguments for the plot
71
+
plot_sealevel(spsealevel, col = 'tomato1', units = 'm',
72
+
xrng = as.Date(c('2000-01-01', '2023-01-01')))
73
+
```
74
+
75
+
The plot is also a `ggplot()` object and can be modified with additional [ggplot2](https://ggplot2.tidyverse.org/){target="_blank"} functions. Below, the plot is modified to add a title and change the theme.
76
+
77
+
```{r, fig.height = 3, fig.width = 8}
78
+
# Add a title and change the theme
79
+
library(ggplot2)
80
+
plot_sealevel(spsealevel) +
81
+
ggtitle('Monthly Mean Sea Level (MSL) at St. Petersburg, FL') +
82
+
theme_grey()
83
+
```
84
+
85
+
### Sea Level Rise Scenarios
86
+
87
+
Sea level rise scenarios can be downloaded using the `get_scenario()` function. Data are downloaded from the [Interagency Sea Level Rise Scenario Tool](https://sealevel.nasa.gov/task-force-scenario-tool){target="_blank} website. Details of the methods used in this tool are found in the technical report [@sweet2022]. The data are downloaded as an Excel sheet to from the URL <https://sealevel.nasa.gov/task-force-scenario-tool?psmsl_id=520>, set to St. Petersburg, FL by default using regionally corrected NOAA 2022 curves. Emissions scenarios of NOAA Intermediate Low, Intermediate, and Intermediate High are downloaded by default, as recommended by the Climate Science Advisory Panel. The data show relative sea level change (RSLC) from 2020 to 2100 for each scenario in meters and feet.
40
88
41
89
```{r}
42
-
# Download tidal gauge data
43
-
dat <- get_sealevel()
44
-
head(dat)
90
+
# Download sea level rise scenarios for St. Petersburg
91
+
spscenario <- get_scenario()
92
+
head(spscenario)
93
+
```
94
+
95
+
Data for alternative locations and scenarios can be obtained using the `id` and `scenario` arguments, respectively.
The sea level rise scenarios can be plotted using the `plot_scenario()` function.
104
+
105
+
```{r, fig.height = 4, fig.width = 8}
106
+
# Plot sea level rise scenarios for St. Petersburg
107
+
plot_scenario(spscenario)
108
+
109
+
# Plot sea level rise scenarios for Cedar Key
110
+
plot_scenario(ckscenario)
111
+
```
112
+
113
+
Various arguments for `plot_sealevel()` can change the appearance of the plot. Below, the color ramp, units, and x-axis range are modified
114
+
115
+
```{r, fig.height = 4, fig.width = 8}
116
+
# Change arguments for the plot
117
+
plot_scenario(spscenario, cols = c('green', 'blue', 'red'), units = 'm',
118
+
xrng = c(2020, 2150))
119
+
```
120
+
121
+
The plot is also a `ggplot` object and can be modified with additional [ggplot2](https://ggplot2.tidyverse.org/){target="_blank"} functions. Below, the plot is modified to add a title, subtitle, and change the theme.
0 commit comments