---
title: "ANLY 512 - Lab 2"
author: "ByoungJun Jo"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(dplyr)
library(dygraphs)
library(rnoaa)
```
Global Temperature
=====================================
Inputs {.sidebar}
-------------------------------------
### Question 1
What is happening with the global temperature?
The GISS Surface Temperature Analysis provides the global temperature anomaly data. It is an estimate of global surface (land and ocean) temperature change from 1880 to 2021.
From the Global Land and Ocean Temperature Anomalies chart, we can see that the global temperature is increasing. We can see the highest point is around 2021 alhouthg there was a dip in 2020. This might be due to COVID-19 pandemic, which caused stopping of running factories and people didn't drive to work much. Also, around the early 20th Century we can see the lowest point (about 0.5°C lower than the average degrees (°C) of the 20th century.
Column
-------------------------------------
### Global Temperature Change 1880 - 2021
```{r}
globalTemp <- read.table("https://data.giss.nasa.gov/gistemp/graphs/graph_data/Global_Mean_Estimates_based_on_Land_and_Ocean_Data/graph.txt", header = FALSE, col.names = c("Year","No_Smoothing","Lowess(5)"),skip = 5)
smoothing <- ts(globalTemp$Lowess.5., frequency = 1, start=c(1880))
annualMean <- ts(globalTemp$No_Smoothing, frequency = 1, start=c(1880))
temp <- cbind(smoothing, annualMean)
dygraph(temp, main = "Global Temperature Anomaly From 1880 To 2021", xlab = "Year", ylab="Temperature Anomaly") %>%
dyRangeSelector() %>%
dyLegend(width = 500, show = "onmouseover") %>%
dyOptions(drawGrid = FALSE) %>%
dyOptions(colors = RColorBrewer::brewer.pal(3, "Set1"))
```
Sea Ice Coverage
=====================================
Inputs {.sidebar}
-------------------------------------
### Question 2
What is happening with sea ice extent in both the northern and southern hemisphere?
The Sea Ice Index is from National Snow & Ice Data Center. The data shows the sea ice extent, which is a measure of the surface area of the ocean covered by sea ice. Also the data is available from 1979–2018 for both the northern and southern hemisphere.
From the charts, we can see that the northern hemisphere sea ice extent is decreasing, about 2 to 3 millions of square km decrease compared to 1979. On the other hand, the southern hemisphere sea ice extent is about the same although there a slight decrease for the past decade.
But why is this? Let's look into the global average carbon dioxide emission.
Column {data-height=650 .tabset .tabset-fade}
-------------------------------------
### Northern Hemisphere {data-width=700}
```{r}
northIce <- read.csv(url("https://www.ncdc.noaa.gov/snow-and-ice/extent/sea-ice/N/8.csv"),skip=3)
ggplot(northIce, aes(x = Date, y = Value)) +
geom_area(position = "jitter", alpha = 0.2, fill= "red")+
scale_y_continuous(breaks=c(0,2,4,6,8,10,12,14))+
theme_minimal() +
ylab("Extent (in millions of square kilometers)") +
ggtitle("Northern Hemisphere Sea Ice Extent in Every August (1979-2021)")
```
### Southern Hemisphere {data-width=700}
```{r}
southIce <- read.csv(url("https://www.ncdc.noaa.gov/snow-and-ice/extent/sea-ice/S/8.csv"),skip=3)
ggplot(southIce, aes(x = Date, y = Value)) +
geom_area(position = "jitter", alpha = 0.2, fill= "blue")+
scale_y_continuous(breaks=c(0,2,4,6,8,10,12,14))+
theme_minimal() +
ylab("Extent (in millions of square kilometers)") +
ggtitle("Southern Hemisphere Sea Ice Extent in Every August (1979-2021)")
```
### NH in August (2015 - 2020)
```{r}
dat <- sea_ice(year = 2015:2020, month = 'Aug', pole = 'N')
df <- bind_rows(dat, .id = "x")
ggplot(df, aes(long, lat, group = group)) +
geom_polygon(fill = "steelblue") +
theme_ice() +
facet_wrap(~ x)
```
### SH in August (2015 - 2020)
```{r}
dat <- sea_ice(year = 2015:2020, month = 'Aug', pole = 'S')
df <- bind_rows(dat, .id = "x")
ggplot(df, aes(long, lat, group = group)) +
geom_polygon(fill = "steelblue") +
theme_ice() +
facet_wrap(~ x)
```
Global CO2
=====================================
Inputs {.sidebar}
-------------------------------------
### Question 3
How about the global CO2 emission? What's the trend here?
The data comes from the Global Monitoring Division of NOAA/Earth System Research Laboratory. The lab has measured carbon dioxide and other greenhouse gases for several decades at a globally distributed network of air sampling sites.
The chart shows annual mean carbon dioxide globally averaged over marine surface sites. As we can see, the emission of carbon dioxide keeps increasing since 1960.
Column
-------------------------------------
### Global Annual CO2 Emission
```{r}
co2 <- read.csv("co2_annmean_gl.csv")
ggplot(co2, aes(year, mean)) +
geom_point(color = "blue") +
ggtitle("Global Average Cardon Dioxide Emission from 1960 - 2021") +
labs(x= "Year", y= "Mean")
```
REDTI
=====================================
Inputs {.sidebar}
-------------------------------------
### Question 4
What about the Annual Residential Energy Demand Temperature Index [REDTI]?
The Residential Energy Demand Temperature Index is calculated on a seasonal basis. It explains year-to-year fluctuations in energy demand for residential heating and cooling.
We can see that energy consumption increases as the number of heating and cooling degree days increases and falls as the number of heating and cooling degree days falls. Because of this strong relationship, seasonal changes in the REDTI can provide a good indication of the nation's fluctuating energy demands.
Column
-------------------------------------
### Annual Residential Energy Demand Temperature Index [REDTI]
```{r}
REDTI_data = read.csv(url("https://www.ncei.noaa.gov/access/monitoring/redti/USA/jan/year-to-date/data.csv"),skip=1)
ggplot(REDTI_data,aes(x=Date,y=REDTI)) +
geom_area(color = "black" ,fill = "gray")+
scale_y_continuous(limits = c(0, 100))+
geom_smooth(method='lm',se=FALSE)+
labs(title="REDTI, Contiguous U.S. (1895 - 2022)",x="Year",y="REDTI")
```