Climatic Change At A Glance

Mmm. Lost a planet, Master Obi-Wan has. How embarrassing (Yoda, Attack Of The Clones)

Some time ago I published this post in KDnuggets in which I analyze historical temperatures to show how we are gradually heading toward a warmer planet. Simple data science to obtain a simple (and increasingly accepted) conclusion: the global warming is real. Despite I was criticized I still believe what I said then: you don’t have to be a climatologist to empirically confirm global warming.

This experiment is another example of that. It is still simpler than that since it is only based on visual perception but I think is also quite conclusive. In this case, I represent U.S. temperature outliers from 1964 to 2013; a map per year. Dataset contains station ID, name, min/max temperature, as well as degree coordinates of the recorded weather. Original weather data collected from NOAA and anomalies analysis by Enigma. You can download data here.

Anomalies are divided into four categories: Strong Hot, Weak Hot, Weak Cold and Strong Cold. For each station, I represent difference between number of Cold and Hot anomalies (independently of the strength) so Blue bubbles represent stations where total number of Cold anomalies during the year is greater that total number of Hot ones and Red ones represent the opposite. Size of bubbles is also proportional to this indicator. As an example, following you can see the map of year 1975:

It seems 1975 was hot in the right a cold on the left side. Concretely, in TONOPAH Station (Nevada) were registered 30 anomalies and most of them (26) where due to cold temperatures. This is why bubble is blue. This GIF shows the evolution of all these maps from 1964 to 2013:


Maybe it is just my personal feeling but don’t you see how red bubbles are gradually winning to blue ones? Maybe I am a demagogue.

This code generates a dynamic map by year in html format:

anomalies = fread("")
anomalies %>%
  mutate(year=substr(date_str, 1, 4)) %>%
  group_by(year, longitude, latitude, id, station_name) %>%
    Strong_Hot=sum(str_count(type,"Strong Hot")),
    Weak_Hot=sum(str_count(type,"Weak Hot")),
    Weak_Cold=sum(str_count(type,"Weak Cold")),
    Strong_Cold=sum(str_count(type,"Strong Cold")),
    total=n()) %>%
  mutate(score=sign(-Strong_Hot-Weak_Hot+Weak_Cold+Strong_Cold)) %>%
  mutate(color=ifelse(score==1, "Blue",ifelse(score==0, "White", "Red"))) -> anomalies2
for (i in unique(anomalies2$year))
  anomalies2 %>%
    filter(year==i) %>%
    leaflet() %>%
    fitBounds(-124, 34, -62, 40) %>%
    addProviderTiles("Stamen.TonerLite") %>%
    addCircleMarkers(lng = ~longitude,
                     lat = ~latitude,
                     radius = ~ifelse(total < 20, 2, ifelse(total < 27, 4, 8)),
                     color= ~color,
                     fillOpacity = 0.5,
                     popup = ~paste(sep = "
", paste0("<b>", station_name, "</b>"),
                                    paste0("Strong Hot: ", Strong_Hot),
                                    paste0("Weak Hot: ", Weak_Hot),
                                    paste0("Weak Cold: ", Weak_Cold),
                                    paste0("Strong Cold: ", Strong_Cold))) -> m
    saveWidget(m, file=paste0("m", i, ".html"))

8 thoughts on “Climatic Change At A Glance

  1. How about doing a Runs test (package ‘lawstat’) on the counts of the extremes per year to see if the the fluctuation over the years is non-random?


  2. Hi – I enjoyed this a lot and tried to reproduce it. Unfortunately, I get an error message which seems to have to do with pandoc (apparently invoked somewhere, probably in the leaflet package). It states:
    “Stack space overflow: current size 33624 bytes.
    Use `+RTS -Ksize -RTS’ to increase it.”

    Any idea what I can do or why you don’t seem to have the problem?

    Thanks and best wishes,


    1. Thanks! Do not really know what happens. I didn’t face that problem. Have to tried option `+RTS -Ksize -RTS’ to increase size? Try to Google it. Sorry. Regards, Antonio

    1. Your problem comes when trying to save map in html format. Maybe there is an alternative way avoiding htmlwidgets. If not, remove the line insert code into a shiny app where you cam choose year as input parameter. At least you would visualize maps independently. Sorry.

  3. Hello Thank you fr your post and congratulation
    Do you use of data mining technique for your work or not? also you wrote that used of NOAA image. do you have image analysis?
    how can I have your paper which describe your work in detail.
    Please answer all of questions 🙂

    1. Hello, thanks! No, I just use graphs since is a 100% visualization experiment. I use data from NOAA (National Oceanic and Atmospheric Administration) curated by

Leave a Reply

Your email address will not be published. Required fields are marked *