Created
October 28, 2018 07:14
-
-
Save priscian/4843f7f08d5275f6fc66a730cbb6bc49 to your computer and use it in GitHub Desktop.
Plotting Current Instrumental Temp. Series against the Exxon 1982 Projections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#jjmisc::reload_all("climeseries", redocument = FALSE) | |
library(climeseries) # devtools::install_github("priscian/climeseries") | |
library(png) | |
pngFileName <- system.file("inst/images/1982-Exxon-Memo-to-Management-About-CO2_edited.png", package = "climeseries") | |
img <- readPNG(pngFileName, info = TRUE) | |
info <- attr(img, "info") | |
## N.B. Change this to a directory where you'd like to store the image. | |
setwd("C:/Users/priscian/Downloads/images/climate") | |
#png("1982-Exxon-Memo-to-Management-About-CO2+instrumental.png", width = info$dim[1], height = info$dim[2], units = "px", res = 300) | |
dev.new(width = info$dim[1], height = info$dim[2], units = "px") | |
op <- par(no.readonly = TRUE) | |
## Remove all margins & borders from the plot region. | |
par(mar = c(0, 0, 0, 0), | |
pin = c(4, 2), | |
pty = "m", | |
xaxs = "i", | |
xaxt = "n", | |
xpd = FALSE, | |
yaxs = "i", | |
yaxt = "n" | |
) | |
plot(1943:2120, seq(-0.4, 4.1, length.out = length(1943:2120)), type = "n", main = "") | |
usr <- par("usr") | |
rasterImage(img, usr[1], usr[3], usr[2], usr[4]) | |
series <- c("GISTEMP Global", "NCEI Global", "HadCRUT4 Global", "Cowtan & Way Krig. Global", "BEST Global (Air Ice Temp.)") | |
d <- get_climate_data(download = FALSE, baseline = FALSE) | |
g <- recenter_anomalies(oss(d, series, range = c(1960, NA)), baseline = 1960:1970) | |
#h0 <- remove_exogenous_influences(d, series = series, start = 1960, end = NULL, max_lag = 12) | |
#h <- recenter_anomalies(h0, baseline = 1960:1970) | |
series_adj <- paste(series, "(adj.)") | |
plot_climate_data(g, series, yearly = TRUE, add = TRUE, lwd = 1) | |
#plot_climate_data(h, series_adj, yearly = TRUE, add = TRUE, lwd = 1) | |
#dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment