Tuesday, January 31, 2017

A guide to the global temperature program TempLS

TempLS is an R program that I have been running for some years at Moyhu. It computes a land/ocean temperature average in the style of Gistemp, HADCRUT or NOAA (see Wiki overview) In this post, I want to collect links to what I have written about it over the years, describe the methods, code and reporting, and something about the graphics. I'll then promote it to a maintained page. I'll start with a Table of Contents with links:

Introduction - reporting cycle

TempLS is a program which works by least squares fitting (LS) of a statistical model for temperature. The basic data used comes from GHCNGHCN V3 monthly unadjusted, and ERSST V4 monthly. GHCN is updated most days, and ERSST early in each month. I run TempLS whenever there is new data, and report as soon in each month that there is enough data for a reliable average. I have a general page for updated data here; TempLS is reported among the other indices, and with interactive graphics. There is a dedicated report slot, with the latest numbers, a global map, a breakdown plot showing how much regions are contributing to the global average, and a map or which stations have reported so far this month. Updated TempLS also appears in the Trend Viewer, and there is a rather elaborate interactive globe graphics presentation of global anomalies here, which is the best way to see the latest (or past) month's results.

TempLS comes in various flavours, depending on the integration scheme. Most prominent in reports is "mesh", based on a global triangular mesh. It most closely resembles GISS. The other regularly reported is the older "grid", which works like HADCRUT and NOAA.

Each month, on about the 8th, when all the main regions have reported, I post a discussion of results, including a map based on a spherical harmonics fit. This map is designed to match that of GISS, and when this comes out a week or so later, I report on that with comparison of numbers and maps. I have been doing this since July 2011.

Summary, methods and code

TempLS does a least squares fit to a linear model for point temperatures v
Here L is a local offset for station month (like a climate normal), G is a global temperature function (the desired result) and ε an error term. Suffices (station, month, year) show what each item depends on. G+ε is the anomaly.

There is a general discussion of methods here, with more here, and an earlier stage here.

The average is formed by area-weighting, which I prefer to think of as a spatial integration method. I discuss some advanced methods here, with a TempLS survey here.

I will discuss past versions in the History section, but the current version is set out starting here, with part 2 and part 3. Each section walks through a part of the code, with data used. The last section gives the complete code (about 250 lines). The code allows options for using unadjusted or adjusted GHCN data, and various integration (weighting) methods, including the "mesh" and "grid", but also spherical harmonics and an advanced grid version which both work very well.


TempLS started when there was a flurry of blogging activity in early 2010, described here. My contribution at that stage was a grid-based program, initially based on GHCN V2, lnd only, but extended to include SST. A focus was on breaking down into regions and sub-groups, and there is a summary post of this stage here. Version 2, when it , incorpoated a spatial representation (spherical harmonics). The math basis is probably the most thorough math description of TempLS. Emphasis moved away from working on subsets and sub-regions. There is a review of the V2 and earlier period here.

A side enterprise that TempLS made possible was the search for ways of using much reduced (eg 60) subsets of stations. An early version is here, with much more complete versions here and here.

Graphics and other output

As I developed TempLS I learnt more about Javascript and WebGL. I have mentioned the interactive Trend Viewer, which includes latest TempLS results. And there are Google Earth style interactive globe plots of monthly anomalies and time trends. The style here is a shaded triangle mesh, appearing continuous, in which the color at each station is correct, and shaded in between on each triangle. You can show the nodes and mesh, and click to get data points.

Tests and comparisons

I post occasionally tests of how well TempLS compares with other indices. A general recent comparison is here. Some early ones are here and here.

Another thing TempLS can be used for is testing the effects of homogenisation, since it can be run with and without. I showed here that it had little effect, and what effect it has was broken into regions and types here.

A test of spatial integration methods is here.


  1. Out of curiousity, why not update to using GHCNv4 now?

  2. Zeke,
    I guess my first excuse is that GISS doesn't use v4, nor, AFAIK, NOAA. I wrote a post over a year ago comparing coverage - the gain with V4 semed fairly small.

    The main thing that holds me back is practicality. I'd want to select a subset, and would it b the same subset every time? Tempting but tricky to vary. At present, V3 is a subset which aligns with the submission of CLIMAT forms, which in terms of early month timing, might be close to what I'd end up with anyway.

    Bottom line - I'll probably change when the others do.