Skip to content
KeremozdemirraPublic

About

Catch unit and dimension errors in quantitative models before they ship.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

unitguard

tests

The most expensive errors in quantitative models are not subtle. Someone adds kWh to MWh. Someone reports tonnes of carbon as tonnes of CO2 and is off by a factor of 3.67. Someone divides by an intensity per unit of revenue where the model needed one per unit of output. None of these throw an exception; they produce a number that looks entirely reasonable and is wrong.

unitguard makes dimensions explicit and checks them. Quantities carry units, arithmetic enforces dimensional consistency, and conversions that are genuinely ambiguous raise rather than resolve.

It comes out of energy and emissions modelling, where the unit zoo is worst, but the failure mode is universal.

Each tool lives in its own folder with its own README and its own tests, and leans on the Python standard library unless a dependency genuinely earns its place.

Layout

projects/
  NNN-project-name/
    README.md          what it does, how to run it, what it is not
    <package>/         the implementation
    tests/             python3 -m unittest discover -s tests -t .
    examples/          a working input file
    pyproject.toml     dependencies, if any

Roadmap

See BACKLOG.md.

Runs in the browser

Each project here is also a case study on the author's site, with the method, the assumptions and what it refuses to answer, and a version that runs in the page:

Licence

MIT, per project. See LICENSE.

Contents

# Project What it does
001 dimensions Exact dimension algebra over the seven SI base dimensions, with rational exponents so roots and equality stay reliable.
002 quantity Magnitudes carrying units: exact rational conversion, arithmetic that refuses incompatible dimensions, and affine temperature scales handled rather than pretended away.

About

Catch unit and dimension errors in quantitative models before they ship.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages