haqlLabs

haql-units · Free library

The wrong unit is a hidden error.

A column labelled "volume" is not a unit. Every production export mixes Sm³, BBL, MCF and rates with different time bases — and a factor of 1,000 quietly lands in a filing. haql-units converts with explicit definitions, declared time bases and round-trip checking, so a mismatch becomes an error you catch instead of a surprise you inherit. Free, MIT-licensed, no cloud, no account.

Try it now: pip install haql-units — seconds to first conversion.

Read the public guide: what it does, what it checks and what it does not do →

units with a paper trail
# install
pip install haql-units

# convert a volume with an explicit definition and time base
from haql_units import Unit, convert  # import shape shown as an example

convert(1000, "Sm3", "BBL", time_base="day")
6290 BBL/day

# round-trip check before you trust it downstream
convert(convert(1000, "Sm3", "BBL"), "BBL", "Sm3")
1000.0 ✓ round-trips

The conversions that power the haql suite are the same conversions you get in the library — one definition to trust, everywhere. Every factor also carries its source (NIST SP 811, BIPM SI Brochure, SPE), so the conversion is an argument, not a claim.

Why you need it

The factor-of-ten seats in a column nobody questions.

The silent factor

One export in Sm³, one in BBL. The aggregation code multiplies by the wrong constant, the mismatch is under the summary's resolution, and it ships.

The ambiguous rate

A "daily" well rate is not the same as a rate on a 28-day assumed month. The denominator is a choice — and should be a declaration.

The unreviewable spreadsheet

Conversion formulas sit inside cells, inherited from the person who left in 2019, and nobody can say what base they assume.

The QC gap

QC only works if the units feeding the check are the units you think they are. haql-units is that guarantee, shared across the suite.

How it works

Convert with a definition, not a magic number.

Every conversion carries its own definition, time base and citation. If the library cannot state the conversion, it errors instead of inventing a constant — the failure mode you want, up front.

1

Declare

State the unit and the time base it implies. The column name is never trusted.

2

Convert

The conversion is defined from first principles — not a constant pasted from a search result.

3

Prove

convert_explained() returns the factor plus the standard and citation (NIST, BIPM, SPE) that define it.

4

Guard

Quantity refuses to add bbl to ft — dimension mismatches raise TypeError before they reach a filing.

Free, MIT

Use it on the next export you convert by hand.

No license manager, no seat count, no telemetry. It is the foundation of the suite and it is free on purpose — because the suite is only as trustworthy as the units it is handed.

github.com/haql-lab