Package {lwbgt}


Type: Package
Title: Reference-Compatible Outdoor Wet Bulb Globe Temperature
Version: 1.0.1
Description: Computes outdoor wet bulb globe temperature using the reference-compatible Liljegren numerical model described by Liljegren et al. (2008) <doi:10.1080/15459620802310770>. Provides dependency-free, vectorized access to the native calculation with explicit input units, per-row validation, and deterministic failure reporting.
License: Apache License (== 2.0)
Copyright: See file inst/COPYRIGHTS.
URL: https://github.com/zyf0717/lwbgt, https://zyf0717.r-universe.dev/lwbgt
BugReports: https://github.com/zyf0717/lwbgt/issues
Depends: R (≥ 4.3.0)
Encoding: UTF-8
NeedsCompilation: yes
Packaged: 2026-10-01 01:23:46 UTC; yifei
Author: Yifei Zheng ORCID iD [aut, cre, cph], James C. Liljegren [ctb], Nels Larson [ctb], UChicago Argonne, LLC [cph]
Maintainer: Yifei Zheng <zyf0717@gmail.com>
Repository: CRAN
Date/Publication: 2026-10-01 15:50:02 UTC

Reference-Compatible Outdoor Wet Bulb Globe Temperature

Description

Dependency-free, vectorized access to the Liljegren outdoor wet bulb globe temperature numerical model.

Details

Inputs use the same explicit field names and units as the native and Python interfaces. The package performs row-level validation and reports failures without aborting calculations for other rows.

References

Liljegren, J. C., Carhart, R. A., Lawday, P., Tschopp, S., and Sharp, R. (2008). Modeling the Wet Bulb Globe Temperature Using Standard Meteorological Measurements. Journal of Occupational and Environmental Hygiene, 5(10), 645–655. doi:10.1080/15459620802310770.


Calculate Outdoor Wet Bulb Globe Temperature

Description

Calculates one result per input row while preserving row order. Invalid rows do not prevent valid rows from being calculated.

Usage

calculate(input)

Arguments

input

A data frame containing the columns produced by lwbgt_input(). Additional columns are ignored.

Value

A plain data frame containing integer status, character status_message, and five numeric result columns. Status zero indicates success; -1 indicates solver non-convergence; 1 indicates missing input; 2 indicates invalid input; and 3 indicates an invalid native result. Numeric outputs are NA for nonzero statuses.

Examples

input <- lwbgt_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, pressure_hpa = 1008.4,
  air_temperature_c = 32.1, relative_humidity_percent = 68,
  wind_speed_m_s = 2.8, wind_height_m = 10,
  vertical_temperature_difference_c = 1
)
calculate(input)

Calculate Saturation Vapour Pressure

Description

Calls the native Liljegren saturation-pressure calculation. Missing inputs propagate to NA; invalid non-missing inputs produce NA and one warning per call.

Usage

esat(temperature_k, phase = 0L)

Arguments

temperature_k

Numeric temperatures in kelvin.

phase

Zero for liquid water or one for ice.

Value

A numeric vector of saturation vapour pressures in hectopascals.

Examples

esat(c(263.15, 273.15, 303.15))
esat(263.15, phase = 1L)

Construct WBGT Input Records

Description

Constructs one or more input rows. All arguments are required; scalar values are recycled to the common non-scalar length.

Usage

lwbgt_input(
  year, month, day, hour, minute, gmt_offset_hours, averaging_minutes,
  urban, latitude_deg_north, longitude_deg_east, solar_w_m2,
  pressure_hpa, air_temperature_c, relative_humidity_percent,
  wind_speed_m_s, wind_height_m, vertical_temperature_difference_c
)

Arguments

year

Integer-valued Gregorian year from 1950 through 2049.

month, day, hour, minute

Integer-valued local date and time fields. A month of zero makes day a day-of-year value.

gmt_offset_hours

Local standard time minus GMT, in whole hours.

averaging_minutes

Input averaging interval, in minutes.

urban

Zero for rural wind scaling or one for urban wind scaling.

latitude_deg_north, longitude_deg_east

Coordinates in degrees north and degrees east.

solar_w_m2

Solar irradiance in watts per square metre.

pressure_hpa

Barometric pressure in hectopascals.

air_temperature_c

Dry-bulb air temperature in degrees Celsius.

relative_humidity_percent

Relative humidity in percent.

wind_speed_m_s

Wind speed in metres per second.

wind_height_m

Wind measurement height in metres.

vertical_temperature_difference_c

Upper-minus-lower temperature difference in degrees Celsius. Only whether it is < 0 or >= 0 is used. It can affect results only for rural nighttime records when wind_height_m differs from 2 m and wind_speed_m_s is below 2.5.

Value

A plain data frame with the 17 native input columns.

Examples

input <- lwbgt_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, pressure_hpa = 1008.4,
  air_temperature_c = 32.1, relative_humidity_percent = 68,
  wind_speed_m_s = 2.8, wind_height_m = 10,
  vertical_temperature_difference_c = 1
)

mirror server hosted at Truenetwork, Russian Federation.