wgbtModel.ts

Unused legacy ONNX session wrapper for the NWB WBGT model

Purpose

This module is an early standalone ONNX session wrapper for the Natural Wet Bulb model, predating the unified inferenceWGBT.ts + onnxAsset.ts architecture. It is no longer called by any active code path and is retained only as a historical reference.

Its responsibilities (as originally designed) included:

  • Downloading and caching the NWB ONNX model asset to the Expo file system cache directory
  • Creating and caching an InferenceSession from the local model file
  • Accepting meteorological inputs and returning a single scalar NWB prediction

Invariants

This module is not integrated into any active pipeline. Its invariants are documented for reference only.

Session Singleton

An in-memory session variable caches the InferenceSession after first creation.

Subsequent calls to getSession return the cached instance without re-reading from disk.

Fixed Input Order

The input tensor always expects [airTemp, windSpeed, solarRad, humidity] in that order, matching the NWB model’s training feature layout.


Status

This module is not used. The NWB model is loaded and run through inferenceWGBT.ts via onnxAsset.ts. This file should be removed or archived.


Exports

runWbgtInference(...)

async function runWbgtInference({
	airTemp,
	windSpeed,
	solarRad,
	humidity,
}: {
	airTemp: number;
	windSpeed: number;
	solarRad: number;
	humidity: number;
}): Promise<number>

Runs NWB model inference and returns the scalar predicted value. Not called by any active code path.