Climate Change by US Climate Division

The previous post presented a choropleth map of the rise in annual mean temperature for each of the lower 48 US States over the period 1901-2012 based on data produced by Berkeley Earth. The map shows that over the period in question, the northern states experienced the largest rise in mean temperature. However, since statewide averages tend to smooth out changes that occur over smaller areas, my next objective was to develop a similar map for all 3,108 counties in the lower 48 States. Though such data likely exists (and could be generated using the Berkeley Earth software), I was unable to find it online. I did however find another interesting dataset with temperatures on a smaller scale: the NOAA/NCDC Climate Division data.

US Climate Divisions

The National Oceanic and Atmospheric Administration/National Climatic Data Center (NOAA/NCDC) divides the lower 48 States into 344 different climate divisions, and reports weather data for each one on a monthly basis. Each State is divided into between 1 to 10 divisions depending on its size (for example Rhode Island has a single division, while Texas has 10). The record for each division consists of temperature and precipitation averages for each month going back to January 1895. This historical data was produced from daily readings using a statistical process which, while not identical, had the same objectives as the process used by Berkeley Earth: to correct for changes in station location, elevation, instrumentation, and observation time, and to produce true spatial averages for each division.

The data used in this post are all available here. The first thing that is required is the shapefile for the climate divisions, which are contained in the file This unzips into eight separate files, but only one of them was necessary: GIS.OFFICIAL_CLIM_DIVISIONS.shp.

The monthly average temperatures are contained in climdiv-tmpcdv-v1.0.0-20170306 (note that the file name changes as data are added to it, so it will have a different name after March 2017). After downloading it I renamed it to climdiv.txt because Windows 10 doesn’t seem to like files that have no file extension.

Although I’m sure it doesn’t make much of a difference, for this exercise I decided to bite the bullet and account for leap years. So now the weighted averages are correct for every year.

My code is below. It’s long!



delT <- function(tSeries) {
  ySer <- 1895:2016
  smoothed <- loess(tSeries ~ ySer)
  newT <- predict(smoothed,data.frame(ySer=c(1901,2012)),se=FALSE)
  degF <- newT[2] - newT[1]

isLeapYear <- function(x) {
  flag <- ifelse(x %% 400 == 0,
    TRUE, ifelse(x %% 4 == 0,
    ifelse(x %% 100 == 0,FALSE,TRUE),FALSE))

regYr <- c(31,28,31,30,31,30,31,31,30,31,30,31)
lpYr <- regYr; lpYr[2] <- lpYr[2] + 1

climdiv <- readShapeSpatial("GIS.OFFICIAL_CLIM_DIVISIONS.SHP")
climdiv <- as.tbl(tidy(climdiv,region="CLIMDIV"))

tHist <- read_tsv("climdiv.txt",col_names=FALSE,
    col_types = cols(col_character(),col_double(),col_double(),

tHist %<>% mutate(id = str_sub(X1,1,str_length(X1)-6),
    yr=as.integer(str_sub(X1,str_length(X1)-3,str_length(X1)))) %>%
  filter(as.integer(id) < 5000,yr<2017) %>%
  mutate(leap = isLeapYear(yr))

tHist %<>%
  rowwise() %>%
  mutate(avg = ifelse(leap,
    weighted.mean(c(X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13),regYr))) %>%
  select(id,yr,avg) %>%
  group_by(id) %>% summarise(rise = delT(avg))

comb <- left_join(climdiv,tHist)

us <- map_data("state")

gtitle <- expression("Rise in Annual Mean Temperature
  1901-2012 in US Climate Divisions "  ( degree*F))

p <- ggplot()+
    color="NA",size=0.25) + coord_map() +
    color="gray76",fill="NA",size=0.25) +
  theme_nothing(legend=TRUE) +
  theme(plot.title = element_text(hjust = 0.5)) +
  ggtitle(gtitle) +
    scale_fill_continuous(low='cadetblue2', high='red',guide='colorbar')

Lines 1-30 are the preliminaries: I set my directory to the location of the data, load in the necessary libraries, and define a couple of functions. delT (lines 12-18) calculates the loess fit for the temperature time series in each division and finds the temperature difference between 2012 and 1901. isLeapYear (lines 20-25) tests whether a given year is a leap year (this could also be done with a list). In lines 27 and 28 I define the number of days per month for regular and leap years, respectively. These are used to find the annual means.

After that it’s just reading in the data and performing manipulations. Note (lines 38 and 43) that I’m using the compound pipe now. Hadley Wickham doesn’t like this but I think it makes a lot of sense, and saves quite a few keystrokes.

For the figure, I draw the division shapes (lines 59-60) and shade them by the temperature rise, then overlay the shapes of the US States (lines 61-62). This looked a little better to me. I also decided to change the base color from thistle2 to cadetblue because it seems to provide better contrast. The problem is that the blue implies (to my eye at least) that temperatures in these regions have not increased, when they actually have. Another problem is that the large temperature rise in the Uinta Basin of Utah makes the rise everywhere else look small by comparison. What’s going on there?

In any case, the figure indicates that not only has the temperature increased more in the northern states, but the increase has been particularly large in the northern portions of those states.

Leave a Reply

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

You are commenting using your 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