Skip to content
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

UOMs with differing zero points #3

Closed
flipmokid opened this issue Apr 5, 2023 · 1 comment
Closed

UOMs with differing zero points #3

flipmokid opened this issue Apr 5, 2023 · 1 comment

Comments

@flipmokid
Copy link

This looks like a great library to help me with a project I need to complete.

I was wondering how you would represent a conversion between two units with differing zero points (e.g. Celsius to Fahrenheit) using this library?

Also, if a UOM conversion involves some lookup value to be used (e.g. going from volume to mass requires knowing the density of the liquid) is there a suggested approach for doing this.

@2food
Copy link
Contributor

2food commented Apr 11, 2023

Hi @flipmokid

Your first question has now been answered by the FAQ section on the readme.

The answer to your second question is to that you need a unit for density. (which I've just added a couple of in 44cc78b)
Then you define a constant with the density of your liquid. According to google, the density of water is about 997 kg/m³ (at 25°C). So that could be defined like this:

(def water-density-at-25C (b/kilograms-per-cubic-meter 997))

; then you could do your calculations with it
(b/* water-density-at-25C (b/liters 300))
; => #broch/quantity[299.1 "kg"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants