Sum of temperature values with Unitful.jl

Hello,

is there a way to calculate the (cumulative) sum of temperature values in °C with Unitful.jl?

I know this does not have a direct physical meaning. Nonetheless, it would be nice to keep the °C unit attached to my calculated values. I want to use the yearly cumulative temperature values in an ecological system model to account for changes in growth rates of plants over the year. I think the concept is similar to growing degree days:

When I want to calculate the sum of °C values, I get an AffineError as expected, see:
https://docs.sciml.ai/Unitful/stable/temperature/

Is there a way to overrride this behaviour and just use the temperature unit °C similiar to a length or weight unit?

Best
Felix

1 Like

You can use K (Kelvin) instead of C. They are the same “degrees” and K addition works.

4 Likes

thanks, maybe this is the easiest solution!

We follow the rule that measured (“absolute”) temperature can be in °C (or K) while temperature differences have to be in K, and it works well enough. So indeed growing degree days should be in K.