Skip to content

Draft: Index function for diurnal temperature range with threshold (fixes #195)

Replaces !173 (closed).

Added a ThresholdedDiurnalTemperatureRange index function and DifferenceThresholdMixin mixin class to deal with differences (in temperature).

When converting a temperature difference from e.g. Celsius to Kelvin, or Celsius to Fahrenheit, it's not enough to use convert_units on the difference value (as noted in #195 (closed)). The idea in DifferenceThresholdMixin is to convert both the difference value and the zero of the original unit, and then create the difference in the new unit using both converted values. E.g. difference in Celsius of 10 = (10 - 0) gives a difference in Kelvin of (283.15 - 273.15) = 10, or a difference in Fahrenheit of (50 - 32) = 18. I think this should work as long as there is a linear relationship between the two units.

Edited by Joakim Löw

Merge request reports