Skip to content

Instantly share code, notes, and snippets.

@JoFAM
Created March 11, 2019 16:54
Show Gist options
  • Save JoFAM/2a671bac176a4ec7e5753d3dc4d3840a to your computer and use it in GitHub Desktop.
Save JoFAM/2a671bac176a4ec7e5753d3dc4d3840a to your computer and use it in GitHub Desktop.
Quick plot of the hadcrut data.
# Download median of regional timeseries
temp <- readLines("https://www.metoffice.gov.uk/hadobs/hadcrut4/data/current/time_series/HadCRUT.4.6.0.0.monthly_ns_avg.txt")
temp <- data.frame(do.call(rbind, strsplit(temp," ")),
stringsAsFactors = FALSE)
temp[-1] <- lapply(temp[-1], as.numeric)
temp$year <- as.numeric(gsub("/.*","",temp[,1]))
temp$month <- as.numeric(gsub(".*/","",temp[,1]))
temp$time <- temp$year + temp$month/12.5
# Create plot ensemble median
id <- temp$year > 1997
plot(temp$time[id],temp[id,2] + 14, type = "l",
xlab = "time",
ylab = "Median of 100 simulations",
main = "SST bias adjustment simulations of HadCRUT")
# Information on methodology :
# https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2011JD017187
# also explained here with the data format
# https://www.metoffice.gov.uk/hadobs/hadcrut4/data/current/series_format.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment