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

fix: correct conversions for volumes, areas #349

Merged
merged 3 commits into from
Dec 13, 2024

Conversation

etienneguevel
Copy link
Contributor

@etienneguevel etienneguevel commented Nov 27, 2024

The quantities used by the eds.quantities pipeline had some wrong unit conversions when calling them.
Exemples :
image

Description

The problem is for units whose absolute degree is superior to one (eg m3, m2 etc.). To correct that the UnitRegistry way of computing the scale is remade with unit_config["scale"] ** abs(unit_config["degree"]) (dm3 have now a scale of 0.001 instead of 0.1 previously).

The changes also rescale the liter unit such as 1l <=> 1dm3, 1ml <=> 1cm3 and that the scale by 10 between different liter units is kept.

Added tests to check that the pipeline eds.quantities correctly make conversions.

Checklist

  • If this PR is a bug fix, the bug is documented in the test suite.
  • Changes were documented in the changelog (pending section).
  • If necessary, changes were made to the documentation (eg new pipeline).

Copy link
Collaborator

@svittoz svittoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice fix, thanks !

@percevalw
Copy link
Member

Great pull request, thank you !

I took the liberty of re-arranging the units, and shifting the scales to avoid having to power units by 2/3 : ie, 1 cm is the unit scale, 1cm3 is the unit volume = 1ml, therefore 1L = 1000ml, have an absolute volume scale of 1000.

@percevalw percevalw force-pushed the measure branch 2 times, most recently from 1bf5913 to 4eced4e Compare December 13, 2024 16:41
@percevalw percevalw merged commit e58bf26 into aphp:master Dec 13, 2024
14 of 15 checks passed
@percevalw percevalw deleted the measure branch December 13, 2024 17:21
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

Successfully merging this pull request may close these issues.

3 participants