This blog is run by Jason Jon Benedict and Doug Beare to share insights and developments on open source software that can be used to analyze patterns and trends in in all types of data from the natural world. Jason currently works as a geospatial professional based in Malaysia. Doug lives in the United Kingdom and is currently Director of Globefish Consultancy Services which provides scientific advice to organisations that currently include the STECF [Scientific, Technical and Economic Committee for Fisheries, https://stecf.jrc.europe.eu/] and ICCAT, https://www.iccat.int/en/

Wednesday, 12 March 2014

2014 has seen drought and forest fires on Penang Island

Key point of post
  •  February 2014 was the driest since 1990 and in the top 5 warmest

     

 2014 and ‘The Pearl of the Orient’ is looking parched. The grass is brown, the epiphytes that normally festoon the ‘rain’ trees in the Youth Park are wilted, and we’ve even had forest fires in the hills behind the main conurbations (see photos below). Last week aircraft were collecting seawater off Gurney Drive to douse the flames and, according to our friends in Penang, the current dry spell is unprecedented.









Further down south on the steep slopes of Bukit Jambul, there are recurring fires at various patches along the hills. The photo below was taken a few nights ago showing the fires on the hills just behind the Bukit Jambul High School and it has yet to cease entirely since this post was created.

 

As we’ve seen in previous post, while there is some ‘predictable’ seasonality in rainfall on Penang, it is also rather erratic or variable. We’ve plotted daily total rainfall at Penang Airport, below, for 7 selected years, and the first 2 months of 2014. These years give an illustration of some typical patterns. Generally speaking December, January and February are indeed quite dry but this is not always true. January 2000 and February 2005 were, for example, quite wet; early February 2005 seeing greater than 50mms rain in one day.



So what about 2014? There was a bit of rain in mid-January (at least at the airport) but none fell at all in February. Total February rainfall (blue line) since 1990 is plotted below, together with average daily air temperatures for February (red line). February 2014 was the driest for nearly 25 years but not by that much. Februaries 1995 and 2001 were also very dry. [Data for further back in time were available but incomplete records and lines of zeros made us suspect their veracity.]



Perhaps then higher temperatures than usual have exacerbated the low rainfall situation and helped stoke the forest fires? Previously we demonstrated that temperatures have been rising in Penang over the last 20 or so years and the hot period of the year now lasts longer than in the past. February 2014 was pretty hot at around 28.5°C, but nothing like as sweltering as 2010 when a mean temperature of around 29°C was recorded, together with also quite low rainfall.

So what of the connection between temperature and rainfall? The average February temperatures and rainfall 1990-2014 are plotted against each other below. There is obviously a negative relationship between the two (the correlation coefficient = -0.4). Wetter Februaries tend to be cooler and vice-versa.

 


February 2014 has been the driest since 1990 but not the hottest (1998, 2002, 2005, 2010 were all warmer). In summary the relationship between rainfall, temperature, and the triggers for forest fires are complex. Other factors that we have not examined such as humidity and wind speed may also have contributed.

Nevertheless we have shown that February 2014 has been the driest since 1990 on Penang Island and is in the Top 5 warmest years.

As usual, we include the R code we have used to produce the plots in this post. The raw data for these plots however was downloaded from the Global Surface Summary of the Day (GSOD) which is a product developed by the National Climatic Data Centre (NCDC) based in the US. The input data used in building these daily summaries are the Integrated Surface Data (ISD), which includes global data obtained from the USAF Climatology Center, located in the Federal Climate Complex with NCDC. The latest daily summary data are normally available 1-2 days after the date-time of the observations used in the daily summaries.

The datasets can be downloaded from NCDC via a normal web interface at the link below
http://www7.ncdc.noaa.gov/CDO/cdoselect.cmd?datasetabbv=GSOD

or through their FTP site at the following link
# Setting work directory
 
setwd("d:\\ClimData")
 
list.files()
 
# Reading and reformatting raw data downloaded from NCDC
 
dat<-read.table("CDO2812586929956.txt",header=F,skip=1)
 
colnames(dat)<-c("stn","wban","yearmoda","temp","tempc","dewp","dewpc","slp","slpc","stp","stpc","visib","visibc","wdsp","wdspc","mxspd","gust","maxtemp","mintemp","prcp","sndp","frshtt")
 
dat$yearmoda <- strptime(dat$yearmoda,format="%Y%m%d")
 
min.date <- min(dat$yearmoda)
max.date <- max(dat$yearmoda)
 
dat$prcp <- as.character(dat$prcp)
dat$prcp1<- as.numeric(substr(dat$prcp,1,4))
dat$prcpflag <- substr(dat$prcp,5,5)
 
dat$rain  <- dat$prcp1*25.4
dat$tempdc <- (dat$temp-32) * (5/9)
 
dat$rain[dat$rain > 1000 ] <- NA
 
dat$year <- as.numeric(format(dat$yearmoda,"%Y"))
dat$month <- as.numeric(format(dat$yearmoda,"%m"))
dat$day <- as.numeric(format(dat$yearmoda,"%d"))
 
# Plotting precipitation for various years in Penang from daily precipitation data
 
library(ggplot2)
library(scales)
 
dat$date<-as.Date(dat$yearmoda)
 
datsub <- subset(dat, year == 1990 | year == 1995 | year == 2000 | year == 2005 | year == 2010 | year == 2012 | year ==2013 | year == 2014)
 
dat1 <- transform(datsub, date = as.Date(paste(2000, month, day, sep="/")))
 
boxplot.title = 'Precipitation in Penang'
boxplot.subtitle = 'Data source : Federal Climate Complex, Global Surface Summary Of Day Data Version 7'
 
g <- ggplot(dat1, aes(date, rain)) +
  geom_line(col="blue", size=0.65) + 
  facet_wrap( ~ year, ncol = 2) +
  xlab("") + ylab("Precipitation (mms)") +
  scale_x_date(label = date_format("%b"), breaks = seq(min(dat1$date), max(dat1$date), "month")) +
  scale_y_continuous(limits = c(0,150)) +
  ggtitle(bquote(atop(.(boxplot.title), atop(italic(.(boxplot.subtitle)), "")))) + theme(plot.title = element_text(face = "bold",size = 16,colour="black")) +
  theme(legend.position = "none") + theme_bw()
g
 
ggsave(g, file="Penang_GSOD_Prcp_Plots.png", width=10, height=7)
 
# Plotting Average monthly temperature and total precipitation
 
avgtemp <- aggregate(tempdc ~ year + month, data = dat, FUN = mean)
totrain <- aggregate(rain ~ year + month, data = dat, FUN = sum)
 
avgtempfeb <- subset(avgtemp, month == 2 & year >= 1990)
totrainfeb <- subset(totrain, month == 2 & year >= 1990)
 
par(mar=c(5,4,4,5)+.1)
plot(avgtempfeb$year,avgtempfeb$tempdc,type="b",col="red",lwd=3,xlab="",ylab="")
par(new=TRUE)
plot(avgtempfeb$year,totrainfeb$rain,,type="b",col="blue",lwd=3,xaxt="n",yaxt="n",xlab="Year",ylab="Temperature (Degree C)",
     main = "Average temperature and total precipitation \n for the month of February in Penang for years 1990-2014")
axis(4)
mtext("Precipitation (mms)",side=4,line=3)
abline(v=1949:2014,lty=3,col='grey70')
legend("topleft",col=c("red","blue"),lwd=3,legend=c("Temperature","Precipitation"))
 
dev.off()
 
# Plot correlation between average temperature and total precipitation
 
png(filename = "Penang_TempPrcp_Correlation_Years_1990-2014.png",height=5,width=10,
    bg = "white",units='in', res = 300, family = "", restoreConsole = TRUE,
    type = "windows")
 
reg <- lm(totrainfeb$rain~avgtempfeb$tempdc)
plot(avgtempfeb$tempdc,totrainfeb$rain,type='n',xlab="Temperature (Degree C)",ylab="Precipitation (mms)",
     main = "Correlation between average temperature and total precipitation \n for the month of February in Penang for years 1990-2014")
 
abline(v=c(27.5,28,28.5,29,29.5,30),lty=3,col='grey70')
abline(h=c(0,50,100,150,200.250,300),lty=3,col='grey70')
text(avgtempfeb$tempdc,totrainfeb$rain,as.character(totrainfeb$year),cex=1.2,col="red")
box(lty = "solid", col = 'black',lwd=3)
 
# Correlation value between total precipitation and temperatures
 
cor(totrainfeb$rain,avgtempfeb$tempdc)
 
dev.off()
Created by Pretty R at inside-R.org

Tuesday, 25 February 2014

Penang: seasonality in air temperature and rainfall


 Key points of post
  • Warmest month in Penang is April

  • Wettest month in Penang is October

  • The warm season is now much longer than it used to be


Living in Penang, a tropical island off the northwest coast of peninsular Malaysia it often feels as if the weather is pretty much the same all year round; ie. hot, sweaty and sticky. Not true, however.

The data Jason and I have been analyzing suggest a different story with both air temperature and rainfall cycling substantially each year. 

The box and whisker plots below show monthly rainfall and air temperatures at Bayan Weather Station, Penang Airport, between 1935 and 2013.  Clearly one can expect a deluge at any time of the year.  Such events, however, are most likely in September and October and least likely in January and February.  Air temperatures, perhaps unsurprisingly, are coolest around the time when rainfall is highest, and hottest when rainfall is lowest





There’s a clear trade-off for the visitor.  If you like it hot, come between February and May, but if you prefer cooler temperatures come between September and November when you should expect some heavy downpours.

These box and whisker plots, however, best summarize the average air temperatures and precipitation over the years 1934 to 2013 and must be interpreted with some caution.  The boxes themselves, together with the whiskers, do give some indication of variability.  In some years, for example, temperatures can be higher in October which is typically the coolest month than temperatures in April, often the hottest month. The problem with the box and whisker plots is that there is no way to tell which years were unusually hot (or cool or wet).

A good way to explore how seasonality changes is to plot the time-series data (monthly averages, see our February 20 2014 post) three-dimensionally, scaling the variable of interest (e.g. temperature) to different colors. We have done this in the plot below for monthly average air temperatures between 1934 and 2013.  Year is along the x-axis and month along the y-axis.  The graph shows the relatively recent expansion (2000 to 2013) of higher temperatures throughout the year. In the 1950s, 1960s, 1970s, and early 1980s the hottest period seemed to be between February and May but now it extends much further into June, July, and August.


 
Hence one is much less likely, nowadays, to experience the relatively cool temperatures (around 26°C between July and December) that visitors in the past would have enjoyed.

The R code used to produce the box and whisker plots as well as the three-dimension temperature plot depicting the seasonality in Penang are shown below. The code continues from the one used in the previous post describing the monthly average temperatures in Penang.

Thursday, 20 February 2014

Historical Temperature Change in Penang


 Key points of post
  • Air temperature has risen in Penang since the mid 1970's

  • Between 1935 and mid 1970's, temperatures did not change substantially


Ever wondered how air temperature has changed in Penang over the last few decades?

Worldwide climate databases are becoming increasingly sophisticated and it is now straightforward to obtain time-series data for many climatic variables (e.g. rainfall, windspeed) for most regions. We at Worldfish are using these data increasingly to provide background for our climate change research for CCAFs (Climate Change Agriculture and Food Security).

Here we have plotted monthly average temperatures for a meteorological station on Penang Island (The Airport) off the northwest coast of Peninsular Malaysia since 1935.

Location of Penang/Bayan GHCN Weather Station


The data are compiled, maintained, and distributed freely by the Global Historical Climatology Network http://www.ncdc.noaa.gov/oa/climate/ghcn-daily/. The blue line is a moving average function that summarizes long-term change over time. The plot shows that temperatures were quite stable between the mid 1930s and early 1960s (around 27°C), after when average temperatures fell slightly to bottom out in the mid-1970s. Note that the outbreak of World War II caused a break in the time-series. Since then average temperatures have risen steadily to around 28°C, although they do seem to have fallen in the most recent years (see the raw data for between 2007 and 2013). There is also some suggestion that variability (the range of average temperatures) may have increased with particularly sultry months being observed in 1984 and 1998 (incidentally 1998 is the year of highest global average temperatures since records began).




Note: All the plots were done using the free package R http://cran.r-project.org/ and the instructions, data source and code for producing this graph are provided below. This enables the interested reader to update the graph at any time in the future.

The data was sourced from the NCDC Global Historical Climatology Network Monthly Version 3 (GHCMNV3) via the CISL Research Data Archive managed by the Data Support Section of the Computational and Information Systems Laboratory (CISL) at the National Center for Atmospheric Research.

The CISL is hosting a copy of the monthly-average surface temperatures in support of UCAR's Global Learning and Observation to Benefit the Environment (GLOBE) program.

More information can be found at the following link - http://rda.ucar.edu/datasets/ds564.1/#!description

The raw temperature data was downloaded in csv format via a Google Earth kml file which can be downloaded at following link - http://rda.ucar.edu/datasets/ds564.1/docs/CISLdata.kmz

The csv file is the read into R and reformatted accordingly to produce the graph. The code below was used to produce the monthly average temperature graph.