unitsofmeasurement / seshat

Seshat Units of Measurement Implementation
Apache License 2.0
7 stars 3 forks source link

Conversion of °C/h #9

Open lfoppiano opened 6 years ago

lfoppiano commented 6 years ago

Hi, as suggested in https://github.com/unitsofmeasurement/uom-se/issues/202#issuecomment-425394070 I've tested the same behavioiur using seshat.

When I try to parse °C/h I get the exception: The scale of measurement for “°C” unit is not a ratio scale.. What does that means?

I would expect to have something like (x+273.15)*3600 (K/s).

What do you think?

Thank you Luca

desruisseaux commented 6 years ago

The terminology follows the Levels of Measurement: nominal, ordinal, interval and ratio. A ratio scale is a scale without offset. For example m, km, K, N, etc. are ratio scales, but °C is not (it is an interval scale). When computing °C divided by something, there is currently no way to know if the value in °C is a quantity or an interval. In the former case 1°C/h = 374.15 K/h while in the later case 1°C/h = 1 K/h. Current Seshat implementation disable this case for avoiding surprising behavior, but we can revisit that if there is a need for it.

In the longer term, better support of such operations with °C would require an API change in JSR 385 in order to know if we shall interpret the numerator as a quantity or an interval. I think the subject is still on the table.

keilw commented 6 years ago

We hope to do this in Public Review if possible: https://github.com/unitsofmeasurement/unit-api/issues/95 There are two main focus points aside from bugs or improvements over the last version:

Arithmetics and conversions would be "function", formatting or parsing tickets or new features for 2.0 like "Compound Formatting" are under "format".