Wetterturnier Wordpress Plugin¶
This is the documentation for the wetterturnier.de python backend. In combination with the Wetterturnier Wordpress Plugin this is the base for a functional Wetterturnier installation. This repository consists of a python package and a set of configuration files and modules.
What is “Wetterturnier”¶
The “Berliner Wetterturnier” as it has been known as in the beginning was launched in the year 2000 at the Institute of Meteorology at the FU Berlin. Since 2005 five cities in Central Europe are included.
Wetterturnier is a platform where hobby meteorologists, experts and statistical forecast model developer battle against each other. The goal is to predict a set of meteorological variables, such as sunshine duration, wind speed, or temperature as good as possible for the consecutive two days.
This plugin is the frontend core of the whole system providing full wordpress integration (user management, messaging services, forums) and the platform where our users can submit their forecasts/bets. Furthermore this plugin provides live ranking tables, a leader-board, a data archive, and access to a set of important data sets such as observations and forecast maps.
Please note that this is only one part of the system. To get the whole system running the Wetterturnier Wordpress Plugin. For more information please visit the documentation on readthedocs <http://wetterturnier-backend.readthedocs.io/en/latest/overview.html>_.
Wetterturnier Backend¶
This is the repository containing the backend scripts for the new wetterturnier like migration scripts and other things.
Note
I am using a python virtual environment. If you do so as well please keep that in mind.
Warning: there is a virtualenv in this directory. The virtualenv was build without any site packages to be sure to conserve the versions which were running/tested and to avoid auto-updates by the server OS.
Was built like this:
virtualenv --no-site-packages venv
Note
This includes that you activate the correct virtual environment, even for cronjobs. Therefore a cronjob using one of the scripts in here has to look similar to this one:
*/10 * * * * cd /home/retos/WTbackend && source venv/bin/activate && timeout 900 python Observations.py &> /home/retos/cronlog/Observations.log``
Installing necessary packages¶
If your virtualenv is activated (source venv/bin/activate
)
you can try to install the pywetterturnier package. This
is locted within this repository in PythonPackage.
python setup.py install
This should automatically install all necessary dependencies for the pywetterturnier package. However, I had some troubles as a package called astral could not be installed. In this case you can easily install it manually:
pip install astral
Some of the major script files and what they do¶
The documentation is available on read the docs. Please visit the documentation where the different main scripts are ducumented in subsection getting started - The Scripts.
License Information¶
The software in this repository is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License, or (at your
option) any later version. The full LICENSE
file is included in the repository
and/or can be found on gnu.org.
Code of Conduct¶
We care about oterhs, their attitude, and their ideology wherefore we follow the [Contributor Covenant][codhomepage] code of conduct. The full code of conduct is included in the repository. If you wanna share ideas and/or contribute to this repository please follow these rules.
[cochomepage]: http://contributor-covenant.org [cocversion]: http://contributor-covenant.org/version/1/4/
Software Dependencies¶
Tested with a mysql 5.1.73. and a python 2.6.+ installation.
Python package dependency (see python package setup script):
numpy
numerical python (currently on 1.9.1)MySQL-python
database connection (currently on 1.2.3c1)importlib
dynamically import modules (judgingclass
; currently 1.0.3)astral
to compute sunrise/sunset (currently 0.8.1)
Todo
Astral is available on version 1.4, test and update. Also check the other ones on the devel machine, then migrate if all looks good.
Software Overview¶
Known Issues¶
As the <Wetterturnier Wordpress Plugin the backend was kept as generic as possible, however, as this is a very specific application not everything might be fully generic.
Note
- The wetterturnier plugin is designed to forecast the two consecutive days. While parts are ready to decrease/increase this number, others are not (e.g., the database design is not able to do so).
- Currently only deterministic forecasts (e.g., 10 degrees celsius for tomorrow noon) are possible. Would be quite a bit of effort but cool to also allow for probabilistic forecasts/scorings (more state of the art for meteo community)
Full Todo List from The Whole Documentation¶
Full list of all (often duplicated) todos found in the whole documentation.
Todo
Reto just take care of the idea that we cold start two tournaments in a row. Can this method then handle the requests?
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/PythonPackage/pywetterturnier/database.py:docstring of database.database.current_tournament, line 9.)
Todo
Reto the sleepy does not get bets - he just gets points. Maybe I can disable/remove the ‘all’ function if I am not using it anymore.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/PythonPackage/pywetterturnier/database.py:docstring of database.database.get_bet_data, line 32.)
Todo
Would be nice to return cityclass objects or something. However, needs some effort as I have to change a few lines of code.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/PythonPackage/pywetterturnier/database.py:docstring of database.database.get_cities, line 14.)
Todo
Link to repos containing the observation parser.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/docs/class/getobs_getobs.rst, line 10.)
Todo
reference to database required here.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/PythonPackage/pywetterturnier/getobs.py:docstring of getobs.getobs.get_columns, line 9.)
Todo
Reference to database table param.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/PythonPackage/pywetterturnier/getobs.py:docstring of getobs.getobs.prepare, line 30.)
Todo
Document return list format.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/PythonPackage/pywetterturnier/stationclass.py:docstring of stationclass.stationclass.getActiveParams, line 12.)
Todo
Remove in the near future. To keep the feature: move the datelock into the global config.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/docs/configfile.rst, line 27.)
Todo
Remove in the near future.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/docs/configfile.rst, line 37.)
Todo
Remove in the near future.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/docs/configfile.rst, line 41.)
Todo
Could contain a bit more details!
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/PythonPackage/pywetterturnier/mitteltip.py:docstring of mitteltip, line 3.)
Todo
A bug! Input argument what is not in use. Maybe kill it or at least set some defaults.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/PythonPackage/pywetterturnier/utils.py:docstring of utils.inputcheck, line 8.)
Todo
The config.conf.template
and the utils.readconfig()
method
contain some settings and code lines which were only used to migrate the data
from the old Wetterturnier system into the new version. Should be cleaned
somewhen in the near future.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/docs/function/utils_readconfig.rst, line 7.)
Todo
Astral is available on version 1.4, test and update. Also check the other ones on the devel machine, then migrate if all looks good.
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/docs/index.rst, line 29.)
Todo
If I would put all code from the modules into a class the code the scripts would look way smoother and the chain script could be a simple sequential call (obj.dothis,obj.dothat,obj.done).
(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/wetterturnier-backend/checkouts/latest/docs/thescripts.rst, line 14.)