[This article was first published on Climate Charts & Graphs I » RClimate Script, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
NOAA has released their December, 2014 global anomaly data, allowing us to examine the 1880 – 2014 global temperature anomaly trend.
This R script trend charts shows the annual and average decadal temperature anomalies for the NOAA data series.
NOAA’s data, like NASA GISS’s and the Japan Meteorological Agency, show that the global mean annual temperature continues to rise. 2014 was the warmest year in the warmest decade for all 3 global temperature data series.
Here is my R script for those who would like to reproduce my chart:
############## RClimate Script: NOAA Annual Temperature Anomaly Trend ################## ## 1/16/15 Retrieve daa from NOAA's and plot annual - decadal trends ## ############################################################################################# library(plyr); library(reshape); library(RCurl) NOAA_ann_link <- "http://www.ncdc.noaa.gov/cag/time-series/global/globe/land_ocean/ytd/12/1880-2014.csv" n <- read.table(NOAA_ann_link, skip = 2, sep = ",", dec=".", row.names = NULL, header = T, as.is = T, colClasses = rep("numeric",2), col.names = c("yr", "anom") ) ## Find last report year and last anomaly value num_rows <- nrow(n) NOAA_last_yr <- as.integer(n[num_rows,1]) NOAA_last_anom <- signif(n[nrow(n),2],2) # Decade calculations dec_mean<- as.numeric(14) dec_st <- as.numeric(14) dec_end <- as.numeric(14) base_yr <- 1880 n$dec_n <- (as.numeric((n$yr - base_yr) %/% 10) * 10) + base_yr # df <- data.frame(df, dec_n) for (i in 1:13) {dec_st[i] = base_yr+ i*10 dec_sub <- subset(n, dec_n == dec_st[i], na.rm=T) dec_mean[i] <- mean(dec_sub$anom) } dec_st[14] <- 2020 # Need to have for last step line across decade dec_mean[14] <- dec_mean[13] dec<- data.frame(dec_st, dec_mean) # Trend chart function plot_func<- function() { par(las=1); par(ps=12); par(oma=c(2.5,1,1,1)); par(mar=c(2.5,4,2,1)) p_xmin <- 1880; p_xmax <- n[num_rows,1] title <- paste("NOAA Land and Sea Temperature Annual Anomaly Trend n", p_xmin, " to ", NOAA_last_yr, sep="") plot(n$yr, n$anom, type = "l", col = "grey", xlim = c(p_xmin, p_xmax), ylab = "Temperature Anomaly - u00B0C (1951-1980 Baseline)", xlab="", main = title,cex.main = 0.85) points(NOAA_last_yr, NOAA_last_anom, col = "red", pch=19) last_pt <- paste( NOAA_last_yr, " @ ", NOAA_last_anom, " u00B0C",sep="") points(dec$dec_st, dec$dec_mean, type="s", col="blue") ## add legend legend(1882,0.6, c("Decadal Avg Anomaly" ,"Annual anomaly", last_pt), col = c("blue", "grey", "red"), text.col = "black", lty = c(1,1,0),pch=c(0,0,16),pt.cex=c(0,0,1), merge = F, bg = "white", bty="o", cex = .75, box.col="white") out <- paste("NOAA Annual Temperature Anomaly nData updated through: " , NOAA_last_yr, sep="") t_pos <- p_xmin + 0.5*(p_xmax-p_xmin) text(t_pos, -0.55, out, cex = 0.7, adj = 0) data_source <- paste("Data Source: ", NOAA_ann_link, sep="") # Plot Annotation mtext(data_source,1,0, cex = 0.75, adj=0.5, outer=T) mtext("D Kelly O'Day - https://chartsgraphs.wordpress.com", 1,1, adj = 0, cex = 0.8, outer=TRUE) mtext(format(Sys.time(), "%m/%d/ %Y"), 1, 1, adj = 1, cex = 0.8, outer=TRUE) } ########################################################################################## plot_func()
Filed under: Citizen Climate Science, Global Warming, RClimate Script, Time Series Charts Tagged: Climate Trends, R scripts
To leave a comment for the author, please follow the link and comment on their blog: Climate Charts & Graphs I » RClimate Script.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.