Input data
The main thresholds can be changed in the
$RULES array at the beginning of the file. The decision logic is located in the calculateDCompass() function.