Climate change is happening now. The change comes from news articles, from research papers, and from our day-to-day life. We not only hear but also feel the world is getting warmer. The global sea level is rising, and the extreme weather events seem to be more frequent and more severe nowadays.
This dashboard provides data exploration and analysis to illustrate evidence of climate change within certain periods in terms of global surface average temperature, global average sea level(mm), and carbon dioxide(ppm).
Additionally, this dashboard provides visualization and analysis of statewide average temperature for all 50 states in the United States for the month of January 2019. Various visualizations of datasets have the capability to generally explain the related/unrelated factors that lead to the climate change.
Data Source: Global Temperature, Global Sea Level, Atmospheric Carbon Dioxide, Statewide Average Temperature
Based on the global visualization, a trend of climate change can be easily observed.
Obeservations
The global average atmospheric carbon dioxide in 2017 was 405.0 parts per million (ppm for short), with a range of uncertainty of plus or minus 0.1 ppm. Carbon dioxide levels today are higher than at any point in at least the past 800,000 years. So people have to admit that it is the increasing human activities caused a rising atmospheric carbon dioxide in recent decades.
Based on the USA statewide average temperature, we can see that Florida has the highest average temperature in January, which is 58.5; while Minnesota owns the lowset average temperature in January, which is 7.4.
When jumping into climate change, it is necessary to intrduce temperature anomaly to observe temperature changes over a base period.
Temperature anomaly
Temperature anomaly means a departure from a reference value or long-term average. A positive anomaly indicates that the observed temperature was warmer than the reference value, while a negative anomaly indicates that the observed temperature was cooler than the reference value.
From the bar chart:
Montana has the highest level of anomaly 8.3, which means Montana was the warmest in the January of 2019 compared to the same period in other years.
Michigan has the lowest level -0.8, which means Michigan was the coldest in the January of 2019 compared to the same period in other years.
The bar chart illustrates that the average temperature of most states in USA are warmer than the period from 1901-2000.
---
title: "ANLY 512 - Data Exploration and Analysis - Lab 2"
author: "Sunny Duggal"
date: "`r Sys.Date()`"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
knitr::opts_chunk$set(echo = TRUE)
library(maps)
library(readr)
library(plotly)
library(dygraphs)
library(ggplot2)
library(lubridate)
```
Introduction
=====================================
### **Climate Change VDE Dashboard**
Climate change is happening now. The change comes from news articles, from research papers, and from our day-to-day life. We not only hear but also feel the world is getting warmer. The global sea level is rising, and the extreme weather events seem to be more frequent and more severe nowadays.
This dashboard provides data exploration and analysis to illustrate evidence of climate change within certain periods in terms of global surface average temperature, global average sea level(mm), and carbon dioxide(ppm).
Additionally, this dashboard provides visualization and analysis of statewide average temperature for all 50 states in the United States for the month of January 2019. Various visualizations of datasets have the capability to generally explain the related/unrelated factors that lead to the climate change.
Data Source: [Global Temperature](http://climate.nasa.gov/system/internal_resources/details/original/647_Global_Temperature_Data_File.txt), [Global Sea Level](http://sealevel.colorado.edu/files/2018_rel1/sl_ns_global.txt), [Atmospheric Carbon Dioxide](ftp://aftp.cmdl.noaa.gov/products/trends/co2/co2_mm_mlo.txt), [Statewide Average Temperature](https://www.ncdc.noaa.gov/cag/statewide/mapping/110-tavg-201807-1.csv)
Global Facts
=======================================================================
Row {.tabset data-width=1000}
-----------------------------------------------------------------------
### Global Surface Temperature
History of Global Surface Temperature since 1880
```{r, echo = FALSE, message = FALSE}
# get data
gmt = read.table("647_Global_Temperature_Data_File1.txt", header = FALSE, col.names = c("Year","Annual_Mean","Five_Year_Mean"),skip = 4, nrows=136)
# reformat date
gmt[,3] = as.numeric(as.character(gmt[,3]))
scaled_gmt = gmt
scaled_gmt[,2] = scale(gmt$Annual_Mean)
scaled_gmt[,3] = scale(gmt$Five_Year_Mean)
scaled_gmt_time_series = ts(scaled_gmt$Five_Year_Mean, frequency = 1, start=c(1880))
# plot
dygraph(scaled_gmt_time_series, main = "Normalized Time Series of Annual 5-Year Mean Temperature Anomalies", xlab = "Year", ylab="Normalized Annual 5-Year Mean Temperature Anomaly")
```
### Global Sea Level
History of Global Sea Level since 1993
```{r, echo = FALSE, message = FALSE}
# get data
gmsl <- read.table("sl_ns_global.txt", header = FALSE, skip = 1)
colnames(gmsl) <- c("year", "msl")
# reformat date
gmsl$datetime <- date_decimal(gmsl$year)
gmsl$date <- as.Date(format(gmsl$datetime, "%Y-%m-%d"), format = "%Y-%m-%d")
# plot
ggplot(gmsl, aes(date, msl)) +
geom_line(color = "pink") +
geom_point(color = "red", size = 1) +
stat_smooth(span = 0.2) +
stat_smooth(method = "lm") +
xlab("Year") +
ylab(expression(paste(Delta, " MSL (mm)"))) +
ggtitle("Global Mean Sea Level") +
theme_bw()
```
### Atmospheric Carbon Dioxide
History of Atmospheric Carbon Dioxide
```{r, echo = FALSE, message = FALSE}
# get data
acd = read.table("ftp://aftp.cmdl.noaa.gov/products/trends/co2/co2_mm_mlo.txt", header = FALSE, col.names = c("Year","Month","Decimal_Date","Average","Interpolated","Trend","Days"), skip = 70)
# reformat date
acd$Average = replace(acd$Average, acd$Average == -99.99, NA)
acd$Days = replace(acd$Days, acd$Days == -1, NA)
scaled_acd = acd
scaled_acd$Interpolated = scale(acd$Interpolated)
scaled_acd_time_series = ts(scaled_acd$Interpolated, frequency = 12, start = c(1958,3))
# plot
dygraph(scaled_acd_time_series, main = "Normalized Time Series Graph of Interpolated Monthly Mean Atmospheric Carbon Dioxide Levels", xlab = "Year", ylab="Normalized Interpolated Monthly Mean Atmospheric Carbon Dioxide Level (standard devations)")
```
Statewide Temperature
=======================================================================
Row {.tabset .tabset-fade}
-----------------------------------------------------------------------
### Jan 2019 Contiguous U.S. Statewide Average Temperature {.no-padding}
```{r, echo = FALSE, message = FALSE, fig.width=8}
# get data
state_avg_temp <- read_csv("110-tavg-201901-1.csv")
names(state_avg_temp) = c("Location.ID", "Location", "Value", "Rank", "Mean","Anomaly")
# reformat date
states = map_data("state")
state_avg_temp$region = tolower(state_avg_temp$Location)
states = merge(states, state_avg_temp, by="region", all.x=T)
h <- ggplot(states, aes(x = long, y = lat, group = group, fill = Value))+
geom_polygon(color = "white")
h <- h + scale_fill_gradient(name = "degrees F", low = "#feceda", high = "#c81f49", guide = "colorbar", na.value="black")
h <- h + labs(title="Jan 2019 Statewide Average Temperature") + coord_map()
# plot
ggplotly(h, height = 675, width = 690)
```
### Jan 2019 Mean Value
```{r, echo = FALSE, message = FALSE}
Max_temp_g=ggplot(state_avg_temp, aes(x = reorder(Location,-Value), y = Value)) +
geom_bar(aes(fill=Location),stat="identity",width = 0.9,
position = position_dodge(1.0)) + theme_minimal() +
xlab("State") + ylab("Mean Temp (degrees F)") +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.background = element_blank()) +
ggtitle("Bar Chart of Mean Temp, Jan 2019")
ggplotly(Max_temp_g)
```
Row {.tabset .tabset-fade}
-----------------------------------------------------------------------
### Jan 2019 Statewide Average Temperature Anomaly {.no-padding}
```{r,echo = FALSE, message = FALSE, fig.height=8}
p <- ggplot(states, aes(x = long, y = lat, group = group, fill = Anomaly))+
geom_polygon(color = "white")
p <- p + scale_fill_gradient(name = "Anomaly", low = "#33ff99", high = "#339999", guide = "colorbar", na.value="black")
p <- p + labs(title="Statewide Average Temperature Anomaly") + coord_map()
ggplotly(p)
```
### Jan 2019 Anomaly (1901-2000 base period)
```{r, echo = FALSE, message = FALSE}
Min_temp_g=ggplot(state_avg_temp, aes(x = reorder(Location,-Anomaly), y = Anomaly)) +
geom_bar(aes(fill=Location),stat="identity",width = 0.9,
position = position_dodge(1.0)) + theme_minimal() +
xlab("State") + ylab("Mean Temp (degrees F)") +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.background = element_blank()) +
ggtitle("Bar Chart of Anomaly based 1901-2000")
ggplotly(Min_temp_g)
```
Observation
=======================================================================
### **Global Fact**
Based on the global visualization, a trend of climate change can be easily observed.
**Obeservations**
1. The global surface temperature is rising.
2. Sea level rise has accelerated from 1.7 mm/year throughout most of the twentieth century to 3.2 mm/year since 1993.
3. The amount of carbon dioxide in the atmosphere has risen by 25% since 1958, and by about 40% since the Industrial Revolution.
The global average atmospheric carbon dioxide in 2017 was 405.0 parts per million (ppm for short), with a range of uncertainty of plus or minus 0.1 ppm. Carbon dioxide levels today are higher than at any point in at least the past 800,000 years. So people have to admit that it is the increasing human activities caused a rising atmospheric carbon dioxide in recent decades.
### **United States Avg. Temperature**
Based on the USA statewide average temperature, we can see that Florida has the highest average temperature in January, which is 58.5; while Minnesota owns the lowset average temperature in January, which is 7.4.
When jumping into climate change, it is necessary to intrduce temperature anomaly to observe temperature changes over a base period.
**Temperature anomaly**
Temperature anomaly means a departure from a reference value or long-term average. A positive anomaly indicates that the observed temperature was warmer than the reference value, while a negative anomaly indicates that the observed temperature was cooler than the reference value.
**From the bar chart:**
1. Montana has the highest level of anomaly 8.3, which means Montana was the warmest in the January of 2019 compared to the same period in other years.
2. Michigan has the lowest level -0.8, which means Michigan was the coldest in the January of 2019 compared to the same period in other years.
The bar chart illustrates that the average temperature of most states in USA are warmer than the period from 1901-2000.