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: v1.0.0. 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. When wind is measured at 2 m, the scalar function now writes the supplied speed, rounded to float, to its wind output; the original left that output unwritten. The original 1950–2049 year range is retained. The v1 calculation remains the default; future numerical revisions require explicit versioned APIs. 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: "1.0.0"),
    ],
    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 1.0.0

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 1.0.0
File Size Uploaded
lwbgt-1.0.0.tar.gz 111.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for lwbgt 1.0.0
File
lwbgt-1.0.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
lwbgt-1.0.0-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-1.0.0-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-1.0.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
lwbgt-1.0.0-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details

Total release size: 222.0 kB

Release files / lwbgt-1.0.0.tar.gz

Download URL lwbgt-1.0.0.tar.gz
Size 111.1 kB
Tags Source
SHA-256 checksum
How to use checksums
40fba802ba6cfea40d90df5be9aefca0d41da5c273474129ebd61020b7bc61a6
BLAKE2b-256 checksum
How to use checksums
960d3f2da09042a827d770d8904a49af0744851c13ea971193b4ff4109bf312a
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 25, 2026.

Transparency log

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

Download URL lwbgt-1.0.0-py3-none-win_amd64.whl
Size 27.6 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
04f4f20fc7faaf4300e3fdea4d8154758e87efca40d9b8c53690d9ea6bc2a5db
BLAKE2b-256 checksum
How to use checksums
7b75a9153836f7f3d775af7602bd653a26ad25fb21b8b293ddd78fb0bf0fc173
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 25, 2026.

Transparency log

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

Download URL lwbgt-1.0.0-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
958a53ce1628c398d21a7ea0075573c092780b13673e3e63b6bb294cab5c350c
BLAKE2b-256 checksum
How to use checksums
e4a115a89c2f70ba85d2d39ba73ab98ffcd481262d3eaee516e4d47126b6b01d
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 25, 2026.

Transparency log

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

Download URL lwbgt-1.0.0-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
bd0a2fa5a9ddb865c30c4e19b33eda27476ba71e7e30a2ecef958e3feea1af00
BLAKE2b-256 checksum
How to use checksums
f2a4bc40515dc3fee276bd00601d048462204e85fad793118ef047d20c33bd53
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 25, 2026.

Transparency log

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

Download URL lwbgt-1.0.0-py3-none-macosx_11_0_arm64.whl
Size 20.6 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
41c3aa6f3b77229675b8cbae2d0e064a74711d57bef2053d94cf3b16d383db67
BLAKE2b-256 checksum
How to use checksums
69b36662daba4df9c2d513223f73d981fee7b30a589efb2df81ddec144fb737e
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 25, 2026.

Transparency log

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

Download URL lwbgt-1.0.0-py3-none-macosx_10_9_x86_64.whl
Size 19.9 kB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
16f2343957d6c77f8f4a2abca622245c23f82c1312403d2e8e5adb171e426232
BLAKE2b-256 checksum
How to use checksums
c5e6b1567af4551208757ed2baedbcf47d94c8d1cefb6c2348e69307bf060d95
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 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

6 release files

0.4.3

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