Judgingclass

The judgingclass is the class containing the judgment rules: how much points a forecast gets given the forecasted and observed values. As these rules might change over time the judgingclass can be defined within the Configfile.

Note

This here is the example of the judingclass20021206 containing the rules as used since 2002-12-06 on Wetterturnier.de.

class judgingclass20021206.judging(quiet=False)[source]

This is a judgingclass - a class used to compute the points a user gets on a specific weekend. Please note that it is possible that the rules change somewhen and that there is a second judgingclass.

The class contains public attributes tdate_min and tdate_max as a safety-instrument. As soon as you would like to compute points for a specific tournament which falls outside this limits the script will stop in the operational mode not to re-compute old bets with a wrong judgingclass.

Parameters:quiet (bool) – Default False, can be set to True to procude some more output.
_prepare_for_database_(userID, cityID, paramID, tdate, betdate, values)[source]

Prepares ID/value pairs for database. Creates a tuple list which can be used with database.database.executemany. Used later with the method ‘points_to_database’ within this class to update the bets table.

Parameters:
  • userID (list) – List containing int, numeric user ID.
  • cityID (list) – List containing int, numeric city ID.
  • paramID (list) – List containing int, numeric parameter ID.
  • tdate (list) – List containing int, numeric tournament date, days since 1970-01-01.
  • betdate (list) – List containing int, numeric betdate, days since 1970-01-01.
  • values (list) – List containing the values (points).
Returns:

Re-structures the inputs to a list. The list has the same length as the input lists but each list element is a tuple containing the inputs. This object is then used for the executemany statement (write data to database).

Return type:

list of tuples

get_points(obs, what, data, special=None, tdate=None)[source]

Compute the points. This is a generic function which is used to compute the points for all required parameters. The inputs define what has to be computed.

Parameters:
  • obs () – Observations
  • what (str) – Which parameter, this defines the method to be called (internally).
  • special (float) – Some rules have ‘special’ sub-rules. This speical is a float observation required to compute the points.
  • (obj (tdate) – int): tournament date, days since 1970-01-01 or None. Used to test whether or not it is allowed to compute the points for this specific tournament date with this judginclass. Second level securety check not to use the wrong judgingclass for a specific date.
Returns:

Returns a np.ndarray with the points rounded to one digit.

Return type:

np.ndarray with floats

points_to_database(db, userID, cityID, paramID, tdate, betdate, values)[source]

Updates the bets database. All inputs are lists and have to be of the same length. (userID, cityID, paramID, tdate, betdate) define the unique ID in the wetterturnier_bets database. Argument values is a list as well containing the compute points.

Parameters:
  • userID (list) – List containing int, numeric user ID.
  • cityID (list) – List containing int, numeric city ID.
  • paramID (list) – List containing int, numeric parameter ID.
  • tdate (list) – List containing int, numeric tournament date, days since 1970-01-01.
  • betdate (list) – List containing int, numeric betdate, days since 1970-01-01.
  • values (list) – List containing the values (points).