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/

Monday 21 April 2014

Penang: hot nights driving long-term change

 Key points of post
  • It is getting hotter in Penang

  • This change is 'driven' by night-time temperatures


In our previous blog posts (20 and 25 February 2014), we plotted monthly temperature data for Penang International Airport which showed how average air temperatures have increased steadily since the mid-1970s.

Time-series analysis, however, can be a tricky business and interpretations can only be made at the level of temporal aggregation (monthly, quarterly, weekly) initially selected. It is difficult to decide which level of aggregation is ‘best’. A general rule would be that you would want to analyze your time-series at the finest resolution possible. When you do aggregate your series in ‘chunks of time’, you need to make sure that any source of bias or confounding is not being masked or disguised by the aggregation step itself. You might, for example, have a series with missing Januaries at the start and missing Augusts at the end. Clearly it would be possible to plot and analyze the data at a quarterly resolution, but any long-term trends observed would be biased.

 
Here we have plotted the same temperature data that we have seen before, but this time at hourly resolution (for selected years). Plotting the data in this way shows the pronounced difference between night-time and day-time temperatures. Not surprisingly it’s generally a lot warmer during the day (red and orange bands) than it is at night (blue bands). You might also notice the spots and bands in grey at certain sections of the plot which are actually gaps in the hourly temperature data records.

What’s interesting, though, is that it is not the day-time temperatures that have increased over time, but the night-time temperatures. [Note the much bluer banding at night in 1979, 1985, and 1989 than is seen in more recent years (2010 & 2013)].

This demonstrates that the long-term trends in air temperature in Penang that we’ve seen before are not due to warmer day-time temperatures, which have been rather stable, but to warmer nights. It’s always tempting to attribute long-term changes in temperatures to climate change due to global warming. This warming trend, however, could just as easily be an ‘urban heat island’ effect. Penang’s economic development has been rapid over the last four decades and the ‘built environment’ is much larger than it used to be. All this extra concrete might be storing up heat during the day to release at night.

Whatever the cause, for ordinary Penangites it is still hotter, and the average temperatures still higher. As usual the data for this analysis are available freely online and the code to produce the plot is outlined below.

The raw data that was used to produce the hourly temperature 'strip' plot was acquired from the Integrated Surface Database (ISD) maintained by the National Climatic Data Centre at NOAA (http://www.ncdc.noaa.gov/oa/climate/isd/). According to the website, the database comprises over 20,000 stations worldwide, with some having data as far back as 1901, though the data show a substantial increase in volume in the 1940's and again in the early 1970's. Currently there are over 11,000 stations "active" and updated daily. This data is again available to be requested and downloaded without charge from the website.

The above hourly temperature plot was produced with one of the functions as part of an R package called 'Metvurst' (METeorological Visualisation Utilities Using R for Science and Teaching) developed by Tim Salabim and you can find more information and instructions on how to install and use it at the following link - http://metvurst.wordpress.com

The package can also be downloaded via the GitHub page below

http://tim-salabim.github.io/metvurst/


The detailed R code used to produce the plot is as below
# Setting work directory
 
setwd("d:\\ClimData")
 
list.files()
 
# Reading and reformatting raw daily data downloaded from ISD NCDC
 
dat<-read.table("2110827004508dat.txt",header=TRUE,fill=TRUE,na.strings=c("*","**","***","****","*****","******","0.00T*****"))
 
colnames(dat)<-tolower(colnames(dat))
 
# Convert hourly data from UTC to local time zone
 
Sys.setenv(TZ = "UTC")
dat$dates <- as.POSIXct(strptime(dat$yr..modahrmn,format="%Y%m%d%H%M"))  + 8 * 60 * 60
  
# Convert temperatures in Degree Fahrenheit to Degree Celcius
  
dat$tempc <- (dat$temp-32) * (5/9)
 
dat$tempc[dat$tempc<=10] <- NA
dat$tempc[dat$tempc>=40] <- NA 
 
# Extract years and month 
 
dat$year <- as.numeric(format(dat$dates,"%Y"))
 
dat$month <- as.numeric(format(dat$dates,"%m"))
  
# Load metvurst library
 
library(metvurst)
 
 
# Subset data for selected years
 
datsub <- subset(dat,year == 1979 | year == 1985 | year == 1989  | year == 1999 | year == 2001 | year == 2005 | year == 2010 | year == 2013 )
 
png(filename = "Penang_Daily_Temps_Cairo.png",height=8,width=12,
    bg = "white",units='in', res = 600, family = "", restoreConsole = TRUE,
    type = "cairo-png")
 
# Plot hourly air temperatures using the 'strip' function
 
plot.air.temp <- strip(x = datsub$tempc,
                       date = datsub$dates,
                       cond = datsub$year,
                       arrange = "long",
                       colour = colorRampPalette(rev(brewer.pal(11, "Spectral"))),
                       main = "Daily Air Temperature in Penang (Bayan Station) on Selected Years\n\nTemperature [°C]",
                       sub="Data source: Integrated Surface Database (ISD) - National Climatic Data Centre (NCDC)",font.sub=2)
 
print(plot.air.temp)
 
 
dev.off()
Created by Pretty R at inside-R.org

No comments:

Post a Comment