Maybe change the cooling and warming flags to something like:
{% set cooling = out + 1 < in %}
{% set warming = out - 1 > in %}
Maybe change the cooling and warming flags to something like:
{% set cooling = out + 1 < in %}
{% set warming = out - 1 > in %}