Records - Top10

From Cumulus Wiki
Jump to navigationJump to search

Introduction

An interesting feature of any weather website is a Top 10 list of weather parameters like temperatures, pressure, wind speed etc... There existed some lists but they all required SQL, PHP or other techniques and beside that they display all parameters possible which is not a requirement. A top 10 should only display parameters which give a true impression to the viewer of the status of the weather and the possibilities and frequencies of extremes. As a result only 14 variables are in the top 10 list of CumulusUtils.

NOTE: This module is the first one written for CumulusUtils and has first been implemented in C.

Operation

This module is included in the website. When needed as a single output the following command is given:

  utils/bin/cumulusutils.exe Top10

Output

The output is the file: top10Table.txt.

Inifile parameters

   [Top10]
   BackgroundColorHeader=#d0d0d0                       (specification of the background colour of the header for the columns)
   BackgroundColorTable=#f0f0f0                        (specification of the background colour of the table)
   TextColorAccentTable=DarkOrange                     (specification of the text colour is a record is recent - i.e. less than 30 days old)
   TextColorHeader=Green                               (specification of the text colour of the header for the columns)
   NumberOfColumns=3                                   (specification of the number of columns displayed in a row)

The values shown are the defaults used.

Inner working

For each variable the list is sorted and then the ten first entries on the list are taken using the standard C# Linq features. Only three variables which do not have have easy sortable characteristics are sorted through dedicated sorting routines: High Monthly Rain, Longest Dry Period and Longest Wet Period.

When the lists are complete a HTML table with the specified number of columns is created with the parameters from the inifile. The table is displayed at 100% of the viewport and the specified number of columns is evenly spaced over that width making use of the standard HTML algorithms for the width per column.

A new table is created until all columns are displayed.