Skip to content

Commit 34419e4

Browse files
committed
Account for ppb unit conversion
1 parent d8ba5a5 commit 34419e4

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

backend/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
MILLIGRAMS_PER_LITER = "mg/L"
3636
MICROGRAMS_PER_LITER = "ug/L"
3737
PARTS_PER_MILLION = "ppm"
38+
PARTS_PER_BILLION = "ppb"
3839
TONS_PER_ACRE_FOOT = "tons/ac ft"
3940
FEET = "ft"
4041
METERS = "m"

backend/transformer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from backend.constants import (
2424
MILLIGRAMS_PER_LITER,
2525
PARTS_PER_MILLION,
26+
PARTS_PER_BILLION,
2627
FEET,
2728
METERS,
2829
TONS_PER_ACRE_FOOT,
@@ -181,6 +182,7 @@ def convert_units(
181182
mgl = MILLIGRAMS_PER_LITER.lower()
182183
ugl = MICROGRAMS_PER_LITER.lower()
183184
ppm = PARTS_PER_MILLION.lower()
185+
ppb = PARTS_PER_BILLION.lower()
184186
tpaf = TONS_PER_ACRE_FOOT.lower()
185187
ft = FEET.lower()
186188
m = METERS.lower()
@@ -210,7 +212,7 @@ def convert_units(
210212
conversion_factor = 0.004427
211213
elif input_units == "pci/l":
212214
conversion_factor = 0.00149
213-
elif input_units == ugl:
215+
elif input_units in (ugl, ppb):
214216
conversion_factor = 0.001
215217
elif input_units == tpaf:
216218
conversion_factor = 735.47

0 commit comments

Comments
 (0)