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.1. 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.

Metadata

Release files for lwbgt 1.0.1

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.1
File Size Uploaded
lwbgt-1.0.1.tar.gz 111.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for lwbgt 1.0.1
File
lwbgt-1.0.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
lwbgt-1.0.1-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.1-py3-none-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details
lwbgt-1.0.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
lwbgt-1.0.1-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-1.0.1.tar.gz

Download URL lwbgt-1.0.1.tar.gz
Size 111.8 kB
Tags Source
SHA-256 checksum
How to use checksums
82d51d6b55396569f222535613e678e3aaf5f1e146abdfe6b01ff2831c626234
BLAKE2b-256 checksum
How to use checksums
6c74f632cacacccb497701fe8e8cc3569dd5bbcf1b5842018139d8377d3179c6
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 Oct 1, 2026.

Transparency log

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

Download URL lwbgt-1.0.1-py3-none-win_amd64.whl
Size 27.6 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
adf168de5a322d1d01b9b3a81b9d3cd7926d39afcc7da1ab21ecf546cad2f834
BLAKE2b-256 checksum
How to use checksums
285e5b7017c5e994e992d642ec7f923285bee7ecabd304f43e1e7e596700de25
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 Oct 1, 2026.

Transparency log

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

Download URL lwbgt-1.0.1-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
5cd07cfff06ab979e80ed7807ba60e278bf6eac7deec10a3e6ef52f42a2983e3
BLAKE2b-256 checksum
How to use checksums
8b5cadaccdc28a28f819574adeb02884526b1abcb1a9e6ecf54779d7001b4fa3
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 Oct 1, 2026.

Transparency log

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

Download URL lwbgt-1.0.1-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
2f3b86e6cf365fa1dbd31dd586f4b79152659f75d354878adc10fa1a7af79adc
BLAKE2b-256 checksum
How to use checksums
97c22fb6f0df0659ee462764c0f75cad170bcfa44744b0e80b0e17c9ffed2b21
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 Oct 1, 2026.

Transparency log

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

Download URL lwbgt-1.0.1-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
581830e01cf04d620383dc79bc205a513d70e003e828040bf66999d1229eade2
BLAKE2b-256 checksum
How to use checksums
b49b5bf01decae011fdb0ea4f319c20b67bcd0a50dac4b706f3ba5715c3e31ca
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 Oct 1, 2026.

Transparency log

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

Download URL lwbgt-1.0.1-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
2102a802ba97982046fe586612f3689c6500d4076b37e9a23c1a4a1629313198
BLAKE2b-256 checksum
How to use checksums
094e395547fc415893551b9a5792024cfd0bf0b6c2488a676332e9ccc358f8dc
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 Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

1.2.1

6 release files

1.2.0

6 release files

1.1.0

6 release files

This release

1.0.1 This release

6 release files

1.0.0

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