Historic data indicates that the occurrence and intensity of cyclonic storms (Hurricanes, Typhoons and Tornados) increases with the increased earth temperature. For this assignment you will need to tell this story to a non-technical audience (eg: a high-school earth science class). Notes: Source historic data for a period of at least 25 years on a measure of the earth’s temperature. Source data on the occurrence and intensity of hurricanes, typhoons and tornados for the same historic period. Perform the data analysis to establish the correlations between earth temperature and storm occurrence and intensity. Tell the story of this data and your analysis using data visualizations and other illustrations (eg: pictures of storm damage) in a presentation that will be accessible to a high-school earth science class. This assignment is due at the end of the week ten of the semester.
library(rvest)
library(dplyr)
library(kableExtra)
library(tidyverse)
library(plotly)
library(readr)
library(ggplot2)
df <- read.csv("https://data.giss.nasa.gov/gistemp/tabledata_v4/GLB.Ts+dSST.csv", skip = 1, na.strings = "***")
# Remove rows with missing or non-finite values
df <- df[complete.cases(df), ]
ggplot(df, aes(x = Year, y = `J.D`, color = "Annual Mean")) +
geom_line(linetype = "solid", linewidth = 0.5) +
geom_point(color = "gray", shape = 21) +
geom_smooth(method = "lm", formula = y ~ x, se = FALSE, aes(color = "Linear Regression"), linetype = "solid", linewidth = 0.5) +
scale_x_continuous(breaks = seq(1880, 2023, 20), expand = c(0,0)) +
scale_y_continuous(limits = c(-0.5, 1.5), expand = c(0,0)) +
scale_color_manual(name = "Legend", values = c("Annual Mean" = "gray", "Linear Regression" = "blue"),
labels = c("Annual Mean", "Linear Regression")) +
theme_light() +
labs(x = "Year", y = "Temperature Anomaly (Celsius)",
title = "GLOBAL LAND-OCEAN TEMPERATURE INDEX",
subtitle = "Data source: NASA's Goddard Institute for Space Studies (GISS).\nCredit: NASA/GISS") +
theme(legend.position = c(0.2, 0.85),
plot.title = element_text(color = "red", face = "bold")) This graph illustrates the rise of global surface temperature from the long-term average spanning from 1881 to 2023. The Earth experienced its higher average surface temperature on record since 2005 (source: NASA/GISS). The findings from NASA’s analysis generally align with those from independent analyses conducted by the National Oceanic and Atmospheric Administration (NOAA) and other research entities. Overall, Earth’s temperature in 2023 surpassed the late 19th-century (1850-1900) preindustrial average by approximately 2.45 degrees Fahrenheit (or about 1.36 degrees Celsius). Notably, the ten most recent years represent the warmest on record.
Data Source: ACE (Accumulated Cyclone Energy) Information - Yearly (obtained from Wikipedia - https://en.wikipedia.org/wiki/Accumulated_cyclone_energy)
ACE Data - Yearly: Scraping from Wikipedia
To perform web scraping from Wikipedia, the rvest package was used. The first step entails reading the Wikipedia page and storing it in an object named wbpg using the read_html() function. Subsequently, any table information is extracted into the tbl object. Then, I’ll specifically parse the table related to the Accumulated Cyclone Energy - Atlantic using the grep function and store it in a data.frame.
url <- "https://en.wikipedia.org/wiki/Accumulated_cyclone_energy"
# Read HTML page into wbpg object
wbpg <- read_html(url)
# Read table information from wbpg object into tbl object
tbl <- html_nodes(wbpg, "table")
# Read required table and save to storms_df data.frame
storms_df <- html_table(tbl[grep("Accumulated Cyclone Energy - Atlantic\n",tbl,ignore.case = T)],fill = T)[[1]]
colnames(storms_df)[1]<-"Year"
storms_df$TS <- as.numeric(storms_df$TS)
storms_df$HU <- as.numeric(storms_df$HU)
storms_df$MH <- as.numeric(storms_df$MH)
# Add Minor Tropical Storms column by calculating it from Tropical Storms, Hurricanes & Major Hurricanes
storms_df$MTS <- storms_df$TS-storms_df$HU--storms_df$MH
storms_df <- storms_df[-c(1:30), ]
# Display data table
storms_df %>% slice(1:5) %>%
kbl(caption = "Cyclonic Storms Intensity (Yearly)") %>%
kable_paper("hover", full_width = F, position = "center") %>%
row_spec(0,color="black",background = "white")| Year | ACE | TS | HU | MH | Classification | MTS |
|---|---|---|---|---|---|---|
| 1881 | 59.25 | 7 | 4 | 0 | Below normal | 3 |
| 1882 | 59.4675 | 6 | 4 | 2 | Below normal | 4 |
| 1883 | 66.7 | 4 | 3 | 2 | Below normal | 3 |
| 1884 | 72.06 | 4 | 4 | 1 | Below normal | 1 |
| 1885 | 58.3 | 8 | 6 | 0 | Below normal | 2 |
There are 144 observations and six variables such as Year, ACE (Accumulated Cyclone Energy), TS (Tropical Cyclone), HU (Hurricane), MH (Major Hurricane) and MTS (Minor Tropical Storm) in stroms_df data frame.
ACE (Accumulated Cyclone Energy) serves as a fundamental metric for quantifying the activity of a hurricane season. It measures the total energy generated by tropical cyclones during a specific period. ACE is calculated for individual storms by squaring the storm’s maximum sustained wind speed in knots, dividing it by 10,000, and summing these values over each advisory issued for the storm. In essence, ACE reflects the combined intensity and duration of all tropical storms and hurricanes within a given season, providing a comprehensive measure of tropical cyclone activity.
# Font Descriptions to use for Plot.
t1 <- list(family = "Arial, sans-serif", size = 13, color = "black")
t2 <- list(family = "Arial, sans-serif", size = 12, color = "black")
#Creating a DF with Mean_ACE & Mean_Tropical Storms for use in plot
hz_line_mean <- data.frame("Year"= storms_df$Year,"Mean_TS"=rep(mean(storms_df$TS),nrow(storms_df)),"Mean_ACE"=rep(mean(storms_df$ACE),nrow(storms_df)))
fig.1 <- plot_ly(storms_df)
# Adding Tropical Storms as bar chart
fig.1 <- fig.1 %>% add_trace(data=storms_df,x=~Year,y=~MTS,type="bar",name="Minor Cyclonic Storms",marker = list(color = 'rgb(158,202,225)'))
# Adding Hurricanes as line chart
fig.1 <- fig.1 %>% add_trace(x=~Year, y=~HU, name = 'Hurricanes',type="scatter",mode="lines",line=list(width=4))
# Adding Major Hurricanes as line chart
fig.1 <- fig.1 %>% add_trace(x=~Year, y=~MH, name = 'Major Hurricanes',type="scatter",mode="lines",line=list(width=4))
#Adding Mean Tropical Storms Line to Plot
fig.1 <- fig.1 %>% add_trace(x=hz_line_mean$Year,y=hz_line_mean$Mean_TS,name="Mean Total Cyclonic Storms",
type="scatter",mode="lines",line=list(width=3,dash='dash',color='blue'))
fig.1 <- fig.1 %>% layout(title="Annually Occourance of Storms - Atlantic Basin",
yaxis = list(title = 'Count of Cyclonic Storms & Hurricanes',titlefont=t1,tickfont=t2,showgrid=F,showline = T),
annotations = list(text = "Increase in ACE since 2005", font=t1, x = 2010, y = 20,showarrow=FALSE ),
shapes = list(list(type = "rect", fillcolor = "grey", line = list(color = "grey"), opacity = 0.25,
x0 = 2000, x1 = 2020, xref = "x",
y0 = 0, y1 = 30, yref = "y")),
barmode = 'group',
legend = list(orientation = 'v',x=0.05,y=0.9),
xaxis=list(autotick=FALSE, dtick=5,title="Year",titlefont=t1,tickfont=t2,showgrid=F))
fig.1# Remove rows with missing values
storms_df <- storms_df[complete.cases(storms_df), ]
# Fit loess models
ACE_y_smooth <- loess(storms_df$ACE ~ storms_df$Year, span = 0.05)
# Make predictions
ACE_Pred <- predict(ACE_y_smooth, se = TRUE)
fig.2 <- plot_ly(storms_df)
# Add trace with correct mode
fig.2 <- fig.2 %>%
add_trace(data = storms_df, x = ~Year, y = ACE_Pred$fit, type = "scatter", mode = "lines", name = "ACE-Smoothed Span=0.05", line = list(color = "red", width = 4))
# Set layout
fig.2 <- fig.2 %>% layout(
title = "Accumulated Cyclone Intensity - Atlantic Basin",
yaxis = list(title = 'Intensity (10^4 kn^2)', titlefont = t1, tickfont = t2, showgrid = F, showline = T, side = 'left', zeroline = F),
legend = list(orientation = 'v', x = 0.45, y = 0.9),
xaxis = list(autotick = FALSE, dtick = 5, title = "Year", titlefont = t1, tickfont = t2, showgrid = F, showline = T, zeroline = F, range = c(1880, 2023)),
margin = list(l = 80, r = 80, b = 80, t = 80)
)
fig.2 We observe a notable rise in the frequency and intensity of tropical storms in the Atlantic Ocean from 2005 to 2023.
# select Year and J.D temperature data from df
selected_df <- df[, c("Year", "J.D")]
# Merge the two data frames by the Year column
combined_df <- merge(storms_df, selected_df, by = "Year", all = TRUE)
combined_df$ACE <- as.numeric(combined_df$ACE)
# Create the scatter plot
scatter_plot <- plot_ly(data = combined_df, x = ~TS, y = ~ACE, z = ~J.D, color = ~Year,
colors = c("#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999"),
marker = list(size = 10),
type = "scatter3d", mode = "markers", text = ~paste("Year: ", Year),
hoverinfo = "text") %>%
layout(
title = "Relationship between Storms Frequency, Intensity , and Earth Temperature",
scene = list(
xaxis = list(title = "Storms Occurence"),
yaxis = list(title = " Cyclone Intensity"),
zaxis = list(title = "Temperature")
)
)
# Display the plot
scatter_plotWhen the earth’s surface temperatures is getting warmer than (26 degrees Celsius), the occurrence and intensity of tropical cyclones is pretty higher. Inversely, the frequency and energy of tropical cyclones has an impact on rise of earth’s surface temperature, while individual cyclones cannot be directly linked to global warming. The intensity needed for tropical cyclones that there may be an increase in the frequency of intense tropical cyclones in a warmer land and ocean temperature. As global temperatures rise, there is the potential for tropical cyclones to become more powerful.