Skip to main content

lwbgt

Native CI Wheel CI R package CI PyPI R-universe License

lwbgt is a stable, low-level C/FFI implementation of the Liljegren outdoor wet bulb globe temperature (WBGT) model. It preserves the original scalar binary ABI and legacy WBGT calculations while removing repeated and dead work; the current source corrects the scalar 2 m wind output. Dependency-free Python and R bindings use the same native kernel. SwiftPM exposes the stable C interface as CLWBGT.

Use lwbgt as an auditable numerical backend. It deliberately leaves weather data ingestion, unit conversion, missing-data policy, heat-risk classification, and application defaults to callers. For a higher-level Python workflow, consider pywbgt or thermofeel.

Version: v0.4.3. The 852-case comparison with the retained original C found bit-identical Tg, Tnwb, Tpsy, WBGT, and esat under matched build settings; this is not an all-input guarantee. Direct scalar estimated wind at 2 m is corrected, and the original 1950–2049 year range is retained. See the compatibility policy.

Python

python -m pip install lwbgt
from lwbgt import Input, calculate, calculate_batch, esat

weather = Input(
    year=2024, month=4, day=15, hour=14, minute=30,
    gmt_offset_hours=8, averaging_minutes=60, urban=1,
    latitude_deg_north=1.3521, longitude_deg_east=103.8198,
    solar_w_m2=742.0, pressure_hpa=1008.4,
    air_temperature_c=32.1, relative_humidity_percent=68.0,
    wind_speed_m_s=2.8, wind_height_m=10.0,
    vertical_temperature_difference_c=1,
)

result = calculate(weather)
assert result.status == 0
print(result.wbgt_c)

results = calculate_batch([weather, weather])
print(esat(273.15, phase=0))

Input and Result are immutable typed records. Field names, units, status codes, and failure behaviour are defined by the ABI contract. See the input assumptions before substituting unavailable observations.

R

Install from R-universe:

install.packages("lwbgt", repos = "https://zyf0717.r-universe.dev")

Or install the latest GitHub release from the r/ subdirectory:

install.packages("remotes", repos = "https://cloud.r-project.org")
remotes::install_github("zyf0717/lwbgt/r@*release", upgrade = "never")

The R API provides lwbgt_input(), calculate(), and esat(). It returns ordinary data frames, recycles scalar constructor arguments, and isolates invalid or non-convergent rows. See the R quick start.

SwiftPM

Add the package and its C-library product to a Swift target:

let package = Package(
    dependencies: [
        .package(url: "https://github.com/zyf0717/lwbgt.git", from: "0.4.3"),
    ],
    targets: [
        .target(
            name: "WeatherService",
            dependencies: [
                .product(name: "CLWBGT", package: "lwbgt"),
            ]
        ),
    ]
)
import CLWBGT

CLWBGT exposes lwbgt.h directly; it is not an idiomatic Swift wrapper. SwiftPM builds the canonical C sources without vendoring or generated copies. Linux and macOS downstream consumption are tested in release mode.

Native C

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
ctest --test-dir build --output-on-failure
cmake --install build --prefix /desired/prefix

The install provides static and shared libraries, lwbgt.h, CMake package metadata, and pkg-config metadata. CMake consumers can select lwbgt::static or lwbgt::shared after find_package(lwbgt CONFIG REQUIRED). GCC, Clang/AppleClang, and MinGW GCC are supported. MSVC is unsupported; the numerical target is built in GNU89 mode.

Documentation

Topic Document
Inputs, units, layouts, status codes, and concurrency ABI contract
Numerical compatibility and measured performance Compatibility and performance
Scope and common integration questions FAQ
Package selection lwbgt vs pywbgt vs thermofeel
Source lineage Upstream provenance
Source changes Deviations from original Liljegren C
Release history Changelog
Release procedure Maintainer guide

Licence and attribution

Project-authored files are Apache-2.0 licensed. The retained upstream source and modified derivative remain under the UChicago Argonne Liljegren WBGT v1.1 terms. See LICENSING.md and retain the acknowledgement in NOTICE when redistributing.

This project is not affiliated with or endorsed by the original authors, UChicago Argonne, or the U.S. Department of Energy.

Release files for lwbgt 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lwbgt 0.4.3
File Size Uploaded
lwbgt-0.4.3.tar.gz 111.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for lwbgt 0.4.3
File
lwbgt-0.4.3-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
lwbgt-0.4.3-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details
lwbgt-0.4.3-py3-none-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl Python 3 none Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details
lwbgt-0.4.3-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
lwbgt-0.4.3-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details

Total release size: 222.7 kB

Release files / lwbgt-0.4.3.tar.gz

Download URL lwbgt-0.4.3.tar.gz
Size 111.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e729ea043d6850e012ad38a4eeaa140e0f82767a567bd3472fed63efc3c703b9
BLAKE2b-256 checksum
How to use checksums
f2f2228cbd056e29970eac8572c48c11d72e8b4d8d3d438b2caa49b8818c2765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / lwbgt-0.4.3-py3-none-win_amd64.whl

Download URL lwbgt-0.4.3-py3-none-win_amd64.whl
Size 27.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
6bac564bda63ec807a7e98aa3880644fcb3aa7e5c771997fe28bc04c866e12d8
BLAKE2b-256 checksum
How to use checksums
d00c27356e180514c3d4073223bb1b0e820371c666cd88bf4d8fb3d5b6e3ed5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / lwbgt-0.4.3-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL lwbgt-0.4.3-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 21.7 kB
Tags Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
4edb63d16076f213cadbd53b16d0aaf1ef457950e55bfd2e1d98a2d71c2edfbb
BLAKE2b-256 checksum
How to use checksums
1c1e81962b005cd1553ac0cc07ec33aa2c27a4859050452349f1205d68f9c6ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / lwbgt-0.4.3-py3-none-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL lwbgt-0.4.3-py3-none-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 21.1 kB
Tags Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
47acb975ad42c9256e2fde9a32d260d08e4e70bd16dfafce056ad112a5cdadd3
BLAKE2b-256 checksum
How to use checksums
d9c2dace7e4c867c80a4e1be8daefc47fa6068387cd12ed7ec6b1301df92a350
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / lwbgt-0.4.3-py3-none-macosx_11_0_arm64.whl

Download URL lwbgt-0.4.3-py3-none-macosx_11_0_arm64.whl
Size 20.8 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a647609eb4978b8a5b51803e06460fd72b0d02d31429c9f3cbef403616d69582
BLAKE2b-256 checksum
How to use checksums
bb427c6e81f260d0f3b356190d33b9b4b009b311b97f7f79a40f13dde0df094a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / lwbgt-0.4.3-py3-none-macosx_10_9_x86_64.whl

Download URL lwbgt-0.4.3-py3-none-macosx_10_9_x86_64.whl
Size 20.0 kB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
53077942f33eaf5ea12a749a4f5261ebb4ae353e8ef39e473b064cec4e407778
BLAKE2b-256 checksum
How to use checksums
789aca8ef7dfbfc58adf967cd48201895d6878e9d1a724f302c5c025bbca30c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.0

6 release files

This release

0.4.3 This release

6 release files

0.4.2

6 release files

0.4.1

6 release files

0.4.0

6 release files

0.3.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page