Skip to content

Commit

Permalink
Added examples for remaining functions. Note several had implementati…
Browse files Browse the repository at this point in the history
…on problems preventing examples from being added (e.g.,) or from working as expected (e.g., DO concentration not fully implemented), mass_to_moles works for tests but throws a dimensionalityError)
  • Loading branch information
jbousquin committed Sep 11, 2023
1 parent d09f2a9 commit 90a37a5
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions harmonize_wq/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,9 @@ def DO_saturation(val,
-------
pint.Quantity
Value in mg/l.
Examples
--------
"""
p, t = pressure, temperature
if p == 1 & (t == 25):
Expand Down Expand Up @@ -531,7 +533,9 @@ def DO_concentration(val,
-------
float
Dissolved Oxygen as saturation (dimensionless).
Examples
--------
"""
# TODO: switch to kelvin?
# https://www.waterontheweb.org/under/waterquality/oxygen.html#:~:
Expand Down Expand Up @@ -584,6 +588,26 @@ def conductivity_to_PSU(val,
exploring water quality monitoring data. R package v0.4.4.
See the wq::ec2pss function.
Function: https://github.com/jsta/cond2sal_shiny/blob/master/helpers.R
Examples
--------
PSU (Practical Salinity Units) is not a standard Pint unit and must be added to a unit registry
first:
>>> import pint
>>> ureg = pint.UnitRegistry()
>>> for definition in domains.registry_adds_list('Salinity'):
... ureg.define(definition)
Build units aware input, as string
>>> input_conductivity = '111.0 uS/cm'
Convert to Practical Salinity Units
>>> convert.conductivity_to_PSU(input_conductivity)
0.057 dimensionless
"""
# Units wrapper returns magnitude only (faster)
p, t = pressure, temperature
Expand Down

0 comments on commit 90a37a5

Please sign in to comment.