Visualising Singapore’s Changing Weather Patterns: 1983–2019

Using a mix of classic and new visualisation libraries like Plotly Express, I try to discover the patterns behind 36.5 years of weather data from the Southeast Asian city state.

Chua Chin Hon
Towards Data Science

--

Animated gif of maximum monthly recorded temperatures in Singapore from 1983 to June 2019.

The lack of seasonal variations lull many into thinking that Singapore’s weather is predictable and unchanging. Nothing is further from the truth, with climate change making the city state’s weather even more unpredictable.

We are beginning to feel the impact of warmer days and more intense storms. At the ground-level, it feels as if Singapore is getting much warmer at an earlier hour.

On many days, the 8am sun that greets me upon stepping out feels more like something I would expect in the late morning. The mid-afternoon blaze has never felt more intense.

In this project, I’ll attempt to illustrate Singapore’s changing weather patterns using classic as well as new visualisation libraries like Plotly Express.

The repo for the project is here. The charts in this Medium post can be found in this notebook, while the data can be found here and here (raw version).

1. DATA PRE-PROCESSING

This dataset is one of the few detailed, multi-year ones that I’ve been able to find in the public domain in Singapore. The charts in this post are derived from four tables, which were lightly processed for a small number of missing values and feature-engineered for additional date-time related columns (see notebook here).

The first table is a set of daily records from the Met Service’s website, from Jan 01 1983 to June 30 2019. While the daily records go back to 1980, those between 1980 and 1982 are mostly incomplete. For consistency’s sake, I’ve set the common start point for all four tables at 1983.

The second, third and fourth tables are monthly aggregate weather data — respectively for maximum monthly temperatures, mean monthly temperatures and monthly rainfall — from the website of the Singapore government’s data agency.

The original sources of the weather data in this project can be found here and here.

2. THE HEAT IS ON — VISUALISING DAILY AND MONTHLY TEMPERATURE RECORDS

According to Singapore’s National Climate Change Secretariat, the country’s annual mean temperatures rose at an average rate of 0.25°C per decade from 1948 to 2016.

The agency projects daily mean temperatures to rise by 1.4°C to 4.6°C in the future, and more warm days-nights from February to September through the rest of this century. A simple set of line charts show where we are headed:

Whichever way you look at it, it’s getting warmer in Singapore, with the trend lines for maximum, minimum, and mean recorded temperatures all pointing upwards.

Details, however, are often lost in line plots, especially when grouped next to each other. Box plots can be useful in this context, giving us insights into the distribution of the median values over the years and where the outliers are.

The horizontal lines at the end of each box (or the “whiskers”) refer to the respective minimum and maximum values that year, while the line in the centre refers to the median value. The black “diamonds” are the outliers.

At a glance, we can tell what’s the range for maximum or mean temperatures for a particular year, and which are the years where higher or lower than normal temperatures were seen.

Another classic way to visualise changing temperatures is by using heatmaps:

The heatmap on the left, for monthly mean temperatures, depicts a clearer trend over the decades, with darker patches towards the right indicating rising average monthly temperatures. The darker patches in the centre also tell you where the hotter months are.

The patterns in the heatmap on the right, for maximum monthly temperatures, are a little harder to read. The darker parts are mostly concentrated around the February-May period, though there’s an interesting patch of deep red for October as well in recent years, starting from 2014.

2.1 EXPERIMENT#1: RIDGELINE PLOTS

With the more sober charts out of the way, let’s see if the more uncommon techniques/libraries might throw up something more interesting.

I’ve always loved the sharp, angular look of the ridgeline plots (or joyplots as they were once known) ever since I first came across them in late 2018. They look awesome, but I’ll honestly say that in this case they don’t necessarily present the temperature trends as clearly as the simpler Seaborn charts.

2.2 EXPERIMENT#2: ANIMATED 3D PLOTS WITH PLOTLY EXPRESS

Plotly Express offers a tonne of interesting features, including the ability to produce interactive, 3D-animated charts like the ones below. Admittedly, this isn’t the clearest or most efficient way to illustrate a trend, but it is visually exciting and adds an interesting new option for presentations when used appropriately:

Medium doesn’t make it easy for interactive charts to be embedded into the posts. For full access to the chart above and below, see the full notebook here.

3. A HARD RAIN’S A-GONNA FALL — VISUALISING DAILY AND MONTHLY RAIN RECORDS

Between Jan 1983 and June 2019, there were 6,399 days of rain and 6,931 dry days — a roughly even-split. With climate change, more intense storms are expected. Again, let’s start with the classic and simpler charts before experimenting with different ways of visualising the daily and monthly rainfall data.

The chart above is as straightforward as it gets, summing up the annual rainfall and grouping them by years. 1997 and 2015 stuck out as the years with lowest amount of annual rainfall, while 2007 saw the highest amount of yearly rainfall in this dataset.

But there aren’t yet persistent signs of a sharp spike, up or down, in terms of total annual rainfall. Let’s take a look at the data at a more granular level.

For the second chart on rainfall records, I decided to break a few minor rules along the way and reversed the y-axis to simulate the look of falling rain. I’m not sure if this is frowned upon in “proper” data visualisation, but I feel that this a visually appealing way to present the data that is also organic to the nature of the data.

At a glance, you can tell where the outliers are in terms of unusual amounts of rain on a daily or monthly level.

Jan 30 2011 had the heaviest single day of rainfall in the last 36 years (chart above, on left). In fact, according to the Met Service’s review of the weather in 2011, that was “the highest ever rainfall in a day for the month of January since records began in 1869”.

Turning to the chart on the right, we see that December 2006 had the heaviest monthly rainfall in this dataset. It is quickly apparent that the lack of interactivity is a problem with charts like these, where you want to be able to call up a specific data point by hovering over it. Annotating the charts would be too messy in this case.

Again, the Plotly Express charts come in handy for such situations:

3.1 EXPERIMENT #3: BAR CHART RACE

Bar chart races have become quite popular on social media of late. I made one for the monthly rain data using a template on Flourish:

I can see why charts like this do well on social media. But it’s questionable as to whether they are really effective in communicating trends. Would you put this in a formal presentation?

4. WHEN THE WIND BLOWS

Wind speeds don’t get much attention in Singapore due to its geographical location, which shields the island from severe storms like tropical cyclones. But it’s still interesting to take a quick look at historical patterns for wind data for signs of potential changes.

The chart on the right suggests that average wind speeds in Singapore haven’t picked up much over the decades. On the left chart, it’s interesting to see a small series of strong wind gusts recorded from 2010.

The strongest wind gust recorded in the last 36 years was on Nov 29 2010, when the maximum wind speed hit 90.7km/h — about 2.6 times the average maximum wind speed recorded in this period.

4.1 WIND & RAIN

We naturally associate strong winds with heavy rain as well. Let’s see how the two conditions vary over the years: The bigger triangles indicate a higher amount of rain, and those with a darker shade are more recent whereas triangles with a lighter shade reflect earlier records.

Here’s the same chart reproduced using Plotly Express so that individual values can be recalled quickly using the interactive features:

5. TIME AFTER TIME: MATRIX PANEL COMPARISON

If you want to break the weather data down into a matrix of panels according to month and day, Plotly Express has a neat feature for that.

I plotted out four such matrices for weather records in 1988, 1998, 2008, and 2018 for a comparison of temperature-rainfall patterns over four decades. The larger and darker circles point to heavier downpours.

I’ve only included screen-captures of the charts here. For the full interactive charts, check out the notebook here where you can hover over individual points for fuller data. To zoom in on a particular area of interest, just click and drag over the chart.

The visualisation possibilities are endless, and this feels like a good time to stop before fatigue sets in. I’ll be curious to see what you come up with using the same dataset. Do share them with me via:

Twitter: @chinhon

LinkedIn: https://www.linkedin.com/in/chuachinhon/

--

--