Correct handling of units (as per discussion)
Currently the output units is drawn from the user unit column[of the master table]. This is usually, but not not always correct, and irrespective of which it is an ad hoc solution that should have a more permanent and correct solution. For example the temperature_sum unit should be Kelvin seconds
(in canonical units) but this currently cannot infer this from the input units, which is Kelvin
. As discussed, it seems like that intensive quantities and extensive quantities have to be handled differently. Or, more precisely, if input is an intensive quantity and output is an extensive quantity (as is the case for temperature_sum and some of the indices related to precipitation)
We could use something like [I]/[O]=c[C]
, where [I]
and [O]
is respectively input and output units, c
is a numeric constant having unit [C]
. The input unit is given by the input data file, and the output unit is given by the metadata defining the index.
Now, if [C]=1/s
the aggregation involves a transformation of an intensive quantity to an extensive quantity, and if [C]=s
it is the other way around.
[cf #60 (closed), #81 (closed)]