RClimate Script: NINO 3.4 SST Anomaly Trends

This RClimate Script lets users retrieve and plot the weekly NOAA NINO 3.4 SST  anomaly data for 1990 to the most recent value.  Links to the NOAA data file and my RClimate script are included. Users can run my script with a simple R source() statement.

NINO 3.4 SST Anomaly

I’ve discussed ENSO and NINO 3.4 in this earlier post.

SST’s in 4 equatorial Pacific zones are closely monitored to assess the status of El Nino – Southern Oscillation (ENSO).

NINO 3.4 SST anomaly provides a quick and effective indication of ENSO conditions. NOAA updates the NINO 1,2,3,3.4 and 4 SST and SSTA series weekly.

Here’s theweekly NINO 3.4 trend from 1990 to the most recent weekly reading. Click image to enlarge.

Here is the Data Link.

Here is the R script that I used to generate this chart.

## set link & read data
 #link <- "http://www.cpc.noaa.gov/data/indices/wksst.for"
link <- "http://www.cpc.ncep.noaa.gov/data/indices/wksst8110.for"
 nino_34 <- read.fwf(link, widths=c(10,-31,4,4,-17),skip = 4, header=F)
 names(nino_34) <- c("cdt", "sst", "ssta")

## calc yr_frac
 dt <- as.Date(nino_34$cdt, format="%d%b%Y")
 yr <- as.numeric(format(dt, format="%Y"))
 mo <- as.numeric(format(dt, format="%m"))
 dy <- as.numeric(format(dt, format="%d"))
 yr_frac <- as.numeric(yr + (mo-1)/12 + (dy/30)/12)
 nino_34 <- data.frame(dt,yr_frac, nino_34[,2:3])

## Determine Month, Year for last reading
 c <- nrow(nino_34) # Find number of data rows
 ldt <- nino_34[c,1]
 ldt_c <- paste(mo[c],"/", dy[c],"/", yr[c],sep="")
 l_yr_frac <- nino_34[c,2]
 l_nino_34 <- nino_34[c,4]
 lp_note <- paste(ldt_c, " @ ",l_nino_34,"C",sep="")

## subset data to add color for LaNina & El Nino cnditions
 la_nina <- subset(nino_34, ssta < 0)
 el_nino <- subset(nino_34, ssta>= 0)

## Plot titles
 title = "NINO 3.4 SST Anomaly Trend (Baseline: 1950-1979) \n NOAA: Weekly Data Centered on Wed"
 y_lab <- expression(paste("SST Anomaly ",degree,"C (1950-1979)", sep=""))

p_fun <- function() {
## set plot pars
 par(ps=10); par(las=1); par(oma=c(3.5,1,0,1)); par(mar=c(2,4,2,0))

plot(nino_34$yr_frac, nino_34$ssta, type = "n", main=title, xlab="", ylab = y_lab,
 cex.main=0.95, cex.lab=0.95)
 points(la_nina$yr_frac, la_nina$ssta, col = "blue", type = "h")
 points(el_nino$yr_frac, el_nino$ssta, col = "red", type = "h")
 points(l_yr_frac, l_nino_34, pch=19, col = "black",cex=0.75)
 points(1991.5, -2, pch=19, col="black", cex=0.75)
 text (1992, -2, lp_note, adj=0, cex=0.8)

## Generate and add bottom footer KOD, source, System date notes
 source_note <- paste("Data Source: ", link)
 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)
 mtext(source_note, 1,0,adj=0.5, cex=0.8, outer=T)

8 responses to “RClimate Script: NINO 3.4 SST Anomaly Trends

  1. Pingback: Volcanic Solar Dimming, ENSO and Temperature Anomalies | Climate Charts & Graphs

  2. Pingback: The Blackboard » R Plotting Questions

  3. Pingback: The Blackboard » How Strong Was the 2007 El Nino?

  4. Hi Kelly,
    Thanks for this. The online text file has a small bug. I cahnged:

    points(la_nina$yr_frac, lanina$ssta, col = “blue”, type = “h”)
    points(el_nino$yr_frac, elnino$ssta, col = “red”, type = “h”)

    points(la_nina$yr_frac, la_nina$ssta, col = “blue”, type = “h”)
    points(el_nino$yr_frac, el_nino$ssta, col = “red”, type = “h”)

  5. Pingback: Checking Do-It-Yourself Climate Science | Climate Charts & Graphs

  6. Pingback: Area Plots with Intensity Coloring ~ el nino SST anomalies w/ ggplot2 « mind of a Markov chain

  7. Pingback: RClimate Script: NINO 3.4 SST Anomaly Trends « Climate Charts amp; Graphs « Script

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s