Average temperature

= Cumulus approach =
Please see Meteorological day for discussion about WMO standard way to calculate average temperature from sum of minimum in previous 12 hours and maximum in subsequent 12 hours, divided by two.
== Calculation ==
The average temperature for the day, is calculated by Cumulus 1 using samples of the temperature taken at 1-minute intervals (sometimes called the 'integration method'). (This assumes Cumulus is running continuously, if it has just been restarted, for some station types Cumulus will use the temperatures stored at the console logging interval for the period since Cumulus previously ran). Each minute the new measurement is added onto the accumulator Total and increments by one the counter Samples in the today.ini log file.
For MX, the sampling may be every second.
== Cumulus outputs ==
At rollover, the AvgTemp field in yesterday.ini holds the final integrated mean calculated by the quotient of Total over Samples in the previous today.ini and the same average is written to the daily log file line representing that last complete day. The integrated mean temperature for each day is also output to the monthly NOAA style report row for the last line (which is yesterday's date). For past days they are found in the dayfile.txt. Integrated average temperatures are also made available as webtags for today (<#avgtemp>) and yesterday (<#avgtempY>).
=== Monthly NOAA report ===
This report shows the figures taken from daily summary log file for each day, so in the "Mean Temp" column it is reporting the same integrated average temperature (not the average of daily maximum and daily minimum). The value at the bottom of the column is the monthly average and that is in accordance with WMO guidance that says a monthly mean is calculated as "The mean of the daily values throughout the month". Obviously, prior to the end of the month it is mean-so-far! Providing Cumulus is in continuous operation, so the number of measurements in the daily calculation is the same for every day, the average of integrated daily means over month-so-far or whole past month is mathematically the same as an integrated mean calculated from all readings read by Cumulus whether this is for a part current month or for a whole past month. 
=== Annual NOAA report ===
Each monthly line
This report shows temperature in its first table, each line shows values calculated from daily summary log file,with columns for lowest, average, and highest of those integrated daily mean. For each month line, looking at the corresponding monthly table you can find the same figures. Another column gives the departure from normal; the normal mean temperature is defined for each month on the NOAA setup part of the Cumulus initial configuration, and the annual report takes the immediate preceding (mean) column, subtracts the figure you entered as the normal and shows the difference. Since the monthly mean is calculated in accordance with WMO guidelines, and the normal figure should be, the difference is also in compliance.
Annual summary line:
The WMO guidlines say that for a climatic normal over an annual or seasonal period, the mean you quote should be the average of the monthly means you calculated for international exchanged products, but allow "National Meteorological and Hydrological Services [to] weight monthly normals by the number of days in the month when calculating the multi-month normal". In other words, within a nation you can report annual averages calculated using integrated daily means. If you are calculating climate norms for international publication you average the individual months. Put another way, within a nation you can add all the daily average temperature values you have and divide by the number of days (part or full year); for publishing climate norms you add all the monthly average temperatures you have for a past year and divide by 12.
For Cumulus users looking at complete past years the difference between the two approaches just sometimes shows small discrepancies, and those are partly because of the way Cumulus does its rounding of each daily figure, rather than just rounding final figure. For the current year, (or any past year if you have missing days in that year) especially in Northern Hemisphere Spring, the difference between approaches is seen because February and April have fewer days than January, March, and May, and when you look at a report the current month may have even fewer days. e.g. on 7 March one approach divides by 3, the other by 66 in a non-leap year (31+28+6 completed days, if none missing) leading to discrepancies, but in the same year on 1 April the first approach is still dividing by 3, but the second approach is dividing by 90. The latter shows little discrepancy because 30 (the 90 quoted divided by the 3 quoted) days is a reasonable average length for a month. So for good practical reasons, annual averages calculated from daily averages are good for Cumulus web pages as they are not skewed by missing days nor by incomplete months.
From Cumulus Version 3.4.4 - Build 3068 onwards the figures shown at the bottom of the columns in this first table on the annual report shows the more accurate annual average calculated from adding all the daily averages and dividing by number of days. For Cumulus 1.9.4 (and Cumulus MX up to and including build 3067), the annual averages shown at the bottom of the annual NOAA report do not use these integrated daily means, instead the yearly average is calculated by adding all the months and then dividing by the number of months.
== Alternatives ==
An alternative average temperature figure, sometimes seen, is the simple mean of the highest and lowest temperatures of the day. The intregated mean using all measurements can give a 'better' average especially in cases where the high or low temperature occurred for a relatively short period, so could skew the simpler extremity-based average. To compare the two, select This period from the view menu and by default it will show both the integrated mean and simple extremity-based mean temperatures for one day, yesterday, when you click Update display.
Note that statistically, a median temperature could be used to avoid such skewing, this would require holding all the individual measurements for a day, ranking them in order of magnitude and quoting the central value in that list - Cumulus does not retain the every minute (timing can vary by weather station type) individual values and cannot calculate median. If you wanted to compare daily median and daily mean, you would need to analyse the monthly log file with an external package. Medians are not used by meteorologists.
Category:Terminology