# ALGORITHMS

This page contains details of the core algorithms used in deriving some of the temperature/rainfall analysis plots posted on this website. A sister website (see post DIYMETANALYSIS) contains more details of the algorithms.

Suppose you want to describe how temperature or rainfall has changed at a particular location. Here are some ways NOT to do it:

• Do NOT simply quote the start and end values, as these will probably be dominated by fluctuations in the weather at those times
• Do NOT quote simple averages of segments of data at the start and end of the data, as those simple averages may be distorted by extreme weather fluctuations
• Do NOT quote median values of segments of data at the start and end of the data, as medians have problems for certain short sets of data, as illustrated in the following figure: The median of an odd number of values can only be one of those values, which may well be inappropriate for short sets of data.

I use an extension of the median, which I call “g-median” (generalised median) defined as follows:

• Sort the data
• Average (mean) a central subset of the sorted data, typically the central 50% portion

The g-median gets some of the benefit of averaging, but at the same time reduces the influence of outliers. An alternative name for this algorithm might be “Central Percentiles Average”, it gives the average of the “typical” values.

The procedure used to average multiple temperature records in a region is as follows:

• The moving averages described above are obtained for all records
• The deviations (weather fluctuations) from the moving averages are obtained for all records, and averaged across stations
• The moving averages are averaged over stations using the “First Difference Method”. Changes in temperature from year to year are averaged across stations, excluding years deemed to contain non-climatic perturbations, such as those caused by station moves and equipment changes
• The history of variations of the regional moving average is obtained simply by integration of the interannual temperature changes, starting from zero at an arbitrary reference year
• The regional average deviations (weather fluctuations) are added to obtain the complete history of regional average temperature variations
• Some additional algorithms are used to reduce errors resulting from temperature perturbations at the ends of station records

END OF PAGE