-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"300 degC" wrongly converted to "300 K" by toSI()
#3097
Comments
I mean the whole situation is super complicated by whether a given units quantity is a specific temperature, or a difference in temperatures. I can't keep straight in my head the convention we were heading to between what units to use for which; I think maybe it was that degC should only be used for specific temperatures, and K for either specific temperature or differences? If so, then yes, using the offset when converting should happen. So sounds like this is a bug. The real best way to handle these things would be to get the modularization with respect to a separate Unit package done, and then put the energy into fixing that Unit package... sorry not to be of more help. |
Thanks for your inputs Glen. I think the issue here is that the behavior of math.unit("300 degC").toSI().toString() // "300 K"
math.unit("300 degC").to("K").toString() // "573.15 K" Maybe |
Note this result is consistent between the two methods: math.unit("300 degC^-1").to("K^-1").toString() // "300 K^-1"
math.unit("300 degC^-1").toSI().toString() // "300 K^-1" I prefer the behavior of the existing |
Reusing that logic would be nice indeed. |
This issue has been fixed now in |
The problem is related to #2499 but it was not fixed by the corresponding PR.
When we convert units from
degC
toK
in SciCat they are wrongly converted bytoSI()
i.e. without adding the offset (SciCatProject/scicat-backend-next#926 ).In physics you never use Celsius to describe a difference of two various temperatures by always Kelvin
so during conversion from
degC
toK
the offset should be always added.You can workaround the problem using twice
unit()
,to()
andtoSi()
but it looks complicated.Is this behavour expected?
To Reproduce
The text was updated successfully, but these errors were encountered: