RVIC icon indicating copy to clipboard operation
RVIC copied to clipboard

Robust Units Handeling

Open jhamman opened this issue 10 years ago • 3 comments

Current, RVIC is using an ad hoc input/output units scheme, checking for a few known combinations of unit strings (e.g. 'mm', 'kg m-2 s-1', etc). There are a few Python projects that have wrapped the UDUNITS library that support conversion of a range of units.

Two packages that come to mind:

One of these should be included in read_forcings.py and history.py to handle the units conversion that is currently done in a more sophisticated way.

CC: @bartnijssen, @mrstu related: #55

jhamman avatar Apr 09 '15 17:04 jhamman

@mrstu, have you used either of these projects?

jhamman avatar Apr 09 '15 17:04 jhamman

@jhamman Scitools iris provides a python wrapper for udunits that is now available as a stand alone module called (https://github.com/SciTools/cf_units).

cf-units is similar to cfunits-python python, but better maintained, lager community, and easier to install (no hard coded path, etc). We have conda binaries for Win, OSX and, Linux. (Sorry no python 3 yet!)

Check this out for some examples.

ocefpaf avatar Jun 10 '15 11:06 ocefpaf

Thanks @ocefpaf -

cf_units looks like it will be the best options moving forward. Once there is Python 3 support, I'll give it a try here.

related: https://github.com/SciTools/cf_units/pull/22

jhamman avatar Jun 10 '15 22:06 jhamman