Skip to main content

Comprehensive units of measurement dataset — 2,959 units, 121 physical quantities, conversion factors, 11 measurement systems

Project description

Units of Measurement

A comprehensive collection of units of measurement covering 121 physical quantities and 11 measurement systems. Available in both JSON and JSONL formats.

Files

The jsonl/ directory contains three JSONL files (one JSON object per line). The json/ directory contains the same datasets as JSON arrays.

units_of_measurement.jsonl (2,959 entries)

The comprehensive, merged dataset. This is the file most users will want. It combines the SI and UOM datasets below into a single superset with a unified schema covering all fields.

Fields:

Field Type Description
unit string Unit name (e.g., "kilometer", "pound")
canonical_unit string Canonical name using · and / delimiters (e.g., watt/meter²·kelvin)
prefix string or null SI prefix if applicable (e.g., "kilo", "milli")
symbol string Unit symbol (e.g., "km", "lb")
plural string Plural form (e.g., "kilometers", "pounds")
property string Physical quantity measured (e.g., "length", "mass")
quantity string Canonicalized physical quantity label (mirrors property)
dimension object SI base-exponent map (e.g., {"L": 1, "T": -1} for velocity); {} for dimensionless quantities
conversion_factor number Multiplier to convert to the reference unit
conversion_offset number Additive offset for temperature conversions (present only for Celsius and Fahrenheit)
reference_unit string The SI coherent unit that conversion_factor is relative to
alternate_unit array of strings Alternate names for the unit (present only where applicable, e.g., "metre" for "meter")
system string Measurement system (see below)

si_units.jsonl (812 entries)

SI base units, SI derived units with special names, and non-SI units accepted for use with the SI (per the SI Brochure, 9th Edition). Each unit includes full SI prefix expansions (all 24 prefixes from quecto through quetta). Uses US English spellings ("meter", "liter").

Fields: unit, prefix, symbol, property, alternate_unit (optional), system

uom.jsonl (2,660 entries)

Units parsed from the Rust uom crate by Mike Boutin. Covers 117 physical quantities across multiple measurement systems, with conversion factors relative to the SI coherent unit for each quantity.

Fields: unit, symbol, plural, property, conversion_factor, conversion_offset (optional), reference_unit, system

Measurement Systems

System Description
SI International System of Units
Metric Metric units not part of SI (e.g., bar, calorie, liter, tonne)
Imperial British Imperial units (e.g., foot, pound, gallon)
CGS Centimetre-Gram-Second system (e.g., dyne, erg)
Nautical Nautical units (nautical mile, knot)
Astronomical Astronomical units (astronomical unit, light year, parsec)
Atomic/Natural Atomic and natural units (Bohr radius, hartree)
IEC IEC binary prefixes for information (kibibyte, mebibyte, etc.)
Information Information units (bit, byte, shannon, nat)
Ancient Roman Historical Roman units of length, mass, area, and volume
other Units not clearly belonging to a single system

Conversion Factors

Each entry's conversion_factor is the multiplier to convert one unit to the reference_unit for that property. For example:

  • kilometer: conversion_factor: 1000.0, reference_unit: "meter" -- 1 km = 1000 m
  • liter: conversion_factor: 0.001, reference_unit: "cubic meter" -- 1 L = 0.001 m^3
  • pound: conversion_factor: 0.4535924, reference_unit: "kilogram" -- 1 lb = 0.4536 kg

For temperature units with a conversion_offset, the conversion to the reference unit (kelvin) is: value_in_kelvin = value * conversion_factor + conversion_offset.

Dimension

The dimension field encodes each unit's SI base-quantity exponents as an object. The keys correspond to the seven SI base quantities:

Key Base Quantity
L length
M mass
T time
I electric current
Θ thermodynamic temperature
N amount of substance
J luminous intensity

Only non-zero exponents are included. For example, velocity (m/s) is {"L": 1, "T": -1} and power (W = kg·m²/s³) is {"M": 1, "L": 2, "T": -3}.

Dimensionless quantities — angle, solid angle, ratio, logarithmic ratio, and information — have an empty object {}. This follows SI convention: the radian and steradian are dimensionless derived units (dimension 1), and information units (bit, byte) fall outside the SI dimensional framework.

Usage

Install

npm install units-of-measurement   # Node.js
pip install units-of-measurement   # Python

Python

from units_of_measurement import load

units = load()  # 2,959 entries from the merged dataset

# Find all length units
length_units = [u for u in units if u["property"] == "length"]

# Convert 5 miles to meters
mile = next(u for u in units if u["unit"] == "mile")
meters = 5 * mile["conversion_factor"]  # 8046.72

# Canonical name & dimension vector for an acceleration unit
accel = next(u for u in units if u["unit"] == "meter per second squared")
accel["canonical_unit"]  # 'meter/second²'
accel["dimension"]       # {'L': 1, 'T': -2}
accel["quantity"] == accel["property"]  # True

# List all measurement systems
systems = sorted(set(u["system"] for u in units))

# Load a specific dataset
si = load("si_units")   # 812 SI entries
uom = load("uom")       # 2,660 uom entries

JavaScript

const { load } = require('units-of-measurement');
// or: import { load } from 'units-of-measurement';

const units = load(); // 2,959 entries from the merged dataset

// Find all mass units
const massUnits = units.filter(u => u.property === 'mass');

// Convert 10 pounds to kilograms
const pound = units.find(u => u.unit === 'pound' && u.property === 'mass');
const kg = 10 * pound.conversion_factor; // 4.535924

// Canonical representation + dimension vector
const accel = units.find(u => u.unit === 'meter per second squared');
console.log(accel.canonical_unit); // 'meter/second²'
console.log(accel.dimension);      // { L: 1, T: -2 }
console.log(accel.quantity === accel.property); // true

// Load a specific dataset
const si = load('si_units');
const uom = load('uom');

Raw Data (no package needed)

# Download as JSON array
curl -LO https://raw.githubusercontent.com/duncanscott/units-of-measurement/main/json/units_of_measurement.json

# Download as JSONL
curl -LO https://raw.githubusercontent.com/duncanscott/units-of-measurement/main/jsonl/units_of_measurement.jsonl

# Query JSON with jq — all Imperial length units
jq -c '.[] | select(.property == "length" and .system == "Imperial")' json/units_of_measurement.json

# Query JSONL with jq
jq -c 'select(.property == "length" and .system == "Imperial")' jsonl/units_of_measurement.jsonl

Data Sources

  • SI Brochure (9th Edition, 2019) -- Bureau International des Poids et Mesures (BIPM). Source for SI base units, derived units, and non-SI units accepted for use with the SI.
  • uom -- Units of Measurement Rust crate by Mike Boutin, licensed under MIT / Apache-2.0. Source for conversion factors, plurals, and extended unit coverage across multiple measurement systems. See THIRD-PARTY-LICENSES for the full license text.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

units_of_measurement-1.2.0.tar.gz (127.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

units_of_measurement-1.2.0-py3-none-any.whl (130.6 kB view details)

Uploaded Python 3

File details

Details for the file units_of_measurement-1.2.0.tar.gz.

File metadata

  • Download URL: units_of_measurement-1.2.0.tar.gz
  • Upload date:
  • Size: 127.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for units_of_measurement-1.2.0.tar.gz
Algorithm Hash digest
SHA256 adefac862f6d12fe47414cc34986b4651f9492910923c68245be9367c006da72
MD5 0bc478f63fcceff9ebe86c6c96f7f9a6
BLAKE2b-256 148543e2db34465b5d558e193eb33c9aa6d46b963da0fa49b09b66de2e30ecd6

See more details on using hashes here.

File details

Details for the file units_of_measurement-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for units_of_measurement-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4719610bc56a8bdbf18bcf1d2a3a993c2e10e1e8589280f4ed5ae04f13165f69
MD5 c160b32193da8ed0116e87706ab9aa43
BLAKE2b-256 a7a6f2dd85e775a895901d6bba4564e739998216d0462c9e8b6a2a01aef79660

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page