CO_2 Level (Global)

Column

Global CO_2 Level

Temperature Change (Global)

Column

Global Temperature Change

Sea Ice Extent (Global)

Column

Sea Ice Extent Change

Relative Sea Level Trend (Global)

Column

Relative Sea Level Trend at Louisiana

Ocean Warming Sign (Global)

Column

Ocean Warming Sign

Summary

Column

As human society develop rapidly over last century, more and more impacts are imposed on Earth.

Climate Change data are pulled from NASA and NOAA website. The following are the key fields for this project.

  • Carbon Dioxide (Global) between 1958 and 2022

  • Global Temperature Change (Global) between 1880 and 2022

  • Arctic Sea Ice Minimum Extent between 1978 and 2023

  • Ocean Warming Since 1955

  • Relative Sea Level Trend at Louisiana between 1920 and 2020

We are observing a few trends based on the interactive plots.

  • Carbon Dioxide level are increasingly accelerating over time.

  • Global Temperatures are rising slowly

  • The sea ice extends started decreasing slowly.

  • Upward trend in Ocean Warming

  • Sea Level are clearly rising

A further study can be expanded to visualize data at more granular level.

A various kinds of forecasting techniques can be employed to predict the trends.

---
title: "ANLY-512 Lab 2 Climate Change"
author: "Hao Zhang"
output:
  flexdashboard::flex_dashboard:
    orientation: rows
    social: menu
    source_code: embed
    vertical_layout: fill
  html_document:
    df_print: paged
---    



```{r,setup, include=FALSE}
# loading necessary R libraries

library(flexdashboard)

library(dygraphs)
library(ggplot2)

library(dplyr)

library(lubridate)
library(scales)

library(tidyr)

library(rnoaa)

library(BiodiversityR)

library(xts)

library(dygraphs)
library(data.table)
library(readr)
library(xts)
library(hydroTSM)
library(rredlist)


options(noaakey = "CevIzqmNYXJnTfocsDEtSSnPMqfhIzLw")

# reference https://climate.nasa.gov/vital-signs/sea-level/

# Carbon Dioxide 
# Global Temperature
# Arctic Sea Ice Minimum Extent 
# Ice Sheets
# Sea Level 
# Ocean Warming 


# RNOAA resource: https://recology.info/2015/07/weather-data-with-rnoaa/ <Not Very Useful>

# temperature anomalies

# sea level trend

# insects 


```






CO_2 Level (Global)
=====================================

Column {.tabset data-height=550}
-----------------------------------------------------------------------

### Global CO_2 Level
```{r}


# Get sea level data from the NOAA API

carbon_dioxide_data <- read.table("https://gml.noaa.gov/webdata/ccgg/trends/co2/co2_mm_mlo.txt", skip=57,  sep = "")

names(carbon_dioxide_data) <- c("Year", "Month", "Decimal_date", "monthly_average", "de_seasonalized", "days", "st_dev_of_days", "unc_of_mon_means")

carbon_dioxide_data$date <- as.Date(paste0(carbon_dioxide_data$Year, "-", carbon_dioxide_data$Month, "-01"), ) # pick the first date of each month

# remove Nan data due to acronym field - DJF, MAM, JJA, SON.

carbon_dioxide_data <- na.omit(carbon_dioxide_data)

carbon_dioxide_data <- carbon_dioxide_data[c('monthly_average', 'date')]

carbon_dioxide_data_xts <- xts(carbon_dioxide_data[,-2], order.by = carbon_dioxide_data$date) # NOTE: remove date column, always assuming date field at the first place.

names(carbon_dioxide_data_xts) = c("monthly_average") # TODO: Fix this ad-hoc fix

# Plot the CO data using dygraphs
dygraph(carbon_dioxide_data_xts, main = "Monthly Average Carbon Dixocide From 1958 to 2022", ylab = "Monthly CO_2 Amount", xlab = "Year") %>%
  dyRangeSelector()

```


Temperature Change (Global)
=====================================

Column {.tabset data-height=550}
-----------------------------------------------------------------------

### Global Temperature Change
```{r}


# Load the data from NASA's website
temperature_data <- read_csv("https://data.giss.nasa.gov/gistemp/tabledata_v4/GLB.Ts+dSST.csv", skip = 1)

# Clean the data
temperature_data <- melt(setDT(temperature_data), id.vars = "Year", variable.name = "month", value.name = "temperature") # pivot temperature data into longer format
temperature_data$date <- as.Date(paste0(temperature_data$Year, "-", temperature_data$month, "-01"), format = "%Y-%b-%d") # pick the first date of each month

# remove Nan data due to acronym field - DJF, MAM, JJA, SON.

temperature_data <- na.omit(temperature_data)

temperature_data_xts <- xts(temperature_data[,-1], order.by = temperature_data$date) # NOTE: remove date column, always assuming date field at the first place.


# Plot the temperature data using dygraphs
dygraph(temperature_data_xts, main = "Global Surface Temperature Change from 1880 to 2022", ylab = "Change of Temperature (°C)", xlab = "Year") %>%
  dyRangeSelector()


```
Sea Ice Extent (Global)
=====================================

Column {.tabset data-height=550}
-----------------------------------------------------------------------

### Sea Ice Extent Change
```{r}
# Reference data: https://www.ncei.noaa.gov/access/monitoring/snow-and-ice-extent/

# Load the data from NASA's website
sea_ice_data <- read.csv("https://www.ncei.noaa.gov/access/monitoring/snow-and-ice-extent/sea-ice/G/12/data.csv", skip = 3)

# Clean the data

sea_ice_data$date_field <- as.Date(paste0(as.character(sea_ice_data$Date), "-01", "-01"), format = "%Y-%m-%d") # pick the first date of each month

sea_ice_data <- sea_ice_data[c("Value", "Anomaly", "date_field")]

sea_ice_data_filtered <- sea_ice_data %>% filter(Value != -9999) # NOTE: remove outlier value

sea_ice_data_xts <- xts(sea_ice_data_filtered[,-3], order.by = sea_ice_data_filtered$date_field) #


# Plot the Sea Ice Extent data using dygraphs
dygraph(sea_ice_data_xts, main = "Global Sea Ice Extent Change from 1979 to 2022", ylab = "Million Km^2", xlab = "Year") %>%
  dyRangeSelector()


```

Relative Sea Level Trend (Global)
=====================================

Column {.tabset data-height=550}
-----------------------------------------------------------------------

### Relative Sea Level Trend at Louisiana
```{r}


# Read in the Relative Sea Level data

# reference: https://tidesandcurrents.noaa.gov/sltrends/sltrends_station.shtml?id=8761724

sea_level_data <- read.csv("https://tidesandcurrents.noaa.gov/sltrends/data/8761724_meantrend.csv", row.names=NULL)

names(sea_level_data) <- c("Year", "Month", "Monthly_MSL", "Linear_Trend", "High_Conf", "Low_Conf", "Un_Used_field")

sea_level_data$date <- as.Date(paste0(sea_level_data$Year, "-", sea_level_data$Month, "-01"), format="%Y-%m-%d") # pick the first date of each month


# Clean the data
sea_level_data <- sea_level_data[c("Monthly_MSL", "Linear_Trend", "High_Conf", "Low_Conf", "date")]


sea_level_data_xts <- xts(sea_level_data[,-5], order.by = sea_level_data$date) # NOTE


# Plot the Sea Level data using dygraphs
dygraph(sea_level_data_xts, main = " Relative Sea Level at Louisiana Since 1947 (NOAA)", ylab = "Meters", xlab = "Year") %>%
  dyRangeSelector()

```


Ocean Warming Sign (Global)
=====================================

Column {.tabset data-height=550}
-----------------------------------------------------------------------

### Ocean Warming Sign
```{r}

# https://climate.nasa.gov/vital-signs/ocean-warming/

# Read in the Ocean-Warming data

ocean_data <- read.table("https://www.ncei.noaa.gov/data/oceans/woa/DATA_ANALYSIS/3M_HEAT_CONTENT/DATA/basin/pentad/pent_h22-w0-2000m.dat", skip = 1)

names(ocean_data) <- c("YEAR", "WO",  "WOse", "NH", "NHse", "SH", "SHse")

ocean_data$date <- as.Date(paste0(ocean_data$YEAR, ".01"), format="%Y.%m.%d") # pick the first date of each month

# Clean the data
ocean_data <- ocean_data[c("WO",  "WOse", "NH", "NHse", "SH", "SHse", "date")]


ocean_data_xts <- xts(ocean_data[,-7], order.by = ocean_data$date) # NOTE


# Plot the ocean warming data using dygraphs
dygraph(ocean_data_xts, main = " Yearly OCEAN Heat Content Change Since 1955 (NOAA)", ylab = "zettajoules", xlab = "Year") %>%
  dyRangeSelector()

```




Summary 
=====================================


Column {data-width=600}
-------------------------------------

###
As human society develop rapidly over last century, more and more impacts are imposed on Earth.

Climate Change data are pulled from NASA and NOAA website. The following are the key fields for this project.

* Carbon Dioxide (Global) between 1958 and 2022

* Global Temperature Change (Global) between 1880 and 2022

* Arctic Sea Ice Minimum Extent between 1978 and 2023

* Ocean Warming Since 1955

* Relative Sea Level Trend at Louisiana between 1920 and 2020

We are observing a few trends based on the interactive plots.

* Carbon Dioxide level are increasingly accelerating over time.

* Global Temperatures are rising slowly

* The sea ice extends started decreasing slowly.

* Upward trend in Ocean Warming

* Sea Level are clearly rising


A further study can be expanded to visualize data at more granular level. 

A various kinds of forecasting techniques can be employed to predict the trends.