Records - Top10

From Cumulus Wiki
Revision as of 08:00, 27 March 2021 by HansR (talk | contribs) (Initial edit)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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:

  1. Maximum Temperature
  2. Minimum Temperature
  3. Minimum Humidity
  4. High Pressure
  5. Low Pressure
  6. Average Windspeed
  7. Maximum Gust
  8. Windrun per day
  9. Rain speed
  10. Rain per hour
  11. Rain per day
  12. Rain per month
  13. Longest dry period
  14. Longest wet period

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                       (
   BackgroundColorTable=#f0f0f0
   TextColorAccentTable=DarkOrange
   TextColorHeader=Green
   NumberOfColumns=3

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.