EcohydrologyTeam / ClearWater-riverine

A 2D water quality transporter model to calculate conservative advection and diffusion of constituents from an unstructured grid of flows
MIT License
6 stars 0 forks source link

Unit Handling #45

Open sjordan29 opened 11 months ago

sjordan29 commented 11 months ago

Need to integrate unit handling in the clearwater-riverine model with the post processing utilities created by @jrutyna.

Decision points

This issue can be closed when the decisions above have been made and the units in clearwater-riverine's transport module and postproc_utils modules are aligned.

aufdenkampe commented 11 months ago

@sjordan29, an approach that @xaviernogueira and I discussed for ClearWater-modules-python was to use the Pint library, which has interfaces for pandas and xarray and a default Pint units definition file that can be customized.

This might be the easiest solution to implement for unit conversions, and could be shared with ClearWater-modules-python. The one drawback for me is that it is not integrated with QUDT.org (Quantities, Units, Dimensions, and Types), which has the most complete ontology for units, along with a URI and API for every unit, such as https://qudt.org/vocab/unit/CentiM. Unfortunately, I haven't found an active Python library that interfaces with QUDT.

Regarding decisions, I'm a fan of converting everything to metric for calculations, then converting back for displays and reporting.

The use of Pint would minimize the need for users to provide conversion information, and it could potentially figure out those unit conversions on the fly from the labels in the RAS output HDF5 file.