Package 'lwbgt'

Title: Reference-Compatible Outdoor Wet Bulb Globe Temperature
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.
Authors: Yifei Zheng [aut, cre, cph] (ORCID: <https://orcid.org/0009-0001-4858-2025>), James C. Liljegren [ctb], Nels Larson [ctb], UChicago Argonne, LLC [cph]
Maintainer: Yifei Zheng <[email protected]>
License: Apache License (== 2.0)
Version: 1.2.1
Built: 2026-10-11 16:02:17 UTC
Source: https://github.com/zyf0717/lwbgt

Help Index


Reference-Compatible Outdoor Wet Bulb Globe Temperature

Description

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

Details

The R, Python, Julia, Swift, and native C interfaces share the same Liljegren numerical C kernel.

Inputs use the same explicit field names and units as the native and Python interfaces. The R interface 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.

See Also

Other interfaces to the shared kernel: Python on PyPI, Julia (LWBGT.jl), Swift, and native C. See the documentation index for the shared kernel and its interfaces.


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, psychrometric = TRUE)

Arguments

input

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

psychrometric

Calculate psychrometric wet-bulb temperature, default TRUE. With FALSE, that column is NA; the other calculations are unchanged. Skipping a failed psychrometric solve can allow a row to succeed.

Value

A plain data frame with the following columns:

  • status: integer status; zero means all requested solves succeeded, -1 means a requested solver did not converge, 1 means missing input, 2 means invalid input, and 3 means an invalid native result.

  • status_message: character description of the row status.

  • estimated_wind_speed_m_s: estimated wind at 2 m, in metres per second.

  • globe_temperature_c: globe temperature, in degrees Celsius.

  • natural_wet_bulb_c: natural wet-bulb temperature, in degrees Celsius.

  • psychrometric_wet_bulb_c: psychrometric wet-bulb temperature, in degrees Celsius; NA when skipped.

  • wbgt_c: outdoor wet bulb globe temperature, in degrees Celsius.

All numerical 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. Non-finite native results are also replaced with NA and included in that warning.

Usage

esat(temperature_k, phase = 0L)

Arguments

temperature_k

Finite, positive 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. Row values are validated by calculate, rather than by this constructor. Valid input ranges do not guarantee solver convergence.

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 standard date and time. Months are 1–12 and days must be valid for the selected year and month. A month of zero makes day a day-of-year value (1–365 or 366). Hours are 0–23 and minutes are 0–59.

gmt_offset_hours

Local standard time minus GMT, in whole hours from -12 through 14. Convert daylight-saving or fractional-offset timestamps to standard time or UTC before constructing inputs.

averaging_minutes

Integer averaging interval from 0 through 1440 minutes. The kernel subtracts half this interval from the supplied timestamp to center the calculation. Use zero for instantaneous or already centered observations.

urban

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

latitude_deg_north, longitude_deg_east

Finite coordinates in degrees north (-90 through 90) and degrees east (-180 through 180).

solar_w_m2

Finite, nonnegative solar irradiance in watts per square metre.

pressure_hpa

Finite, positive barometric pressure in hectopascals.

air_temperature_c

Finite dry-bulb temperature in degrees Celsius, strictly above -273.15.

relative_humidity_percent

Finite relative humidity from 0 through 100 percent.

wind_speed_m_s

Finite, nonnegative wind speed in metres per second.

wind_height_m

Finite, positive wind measurement height in metres.

vertical_temperature_difference_c

Finite 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
)