Hello!
I’d like to use GET api calls to obtain humidex (and other data layers) from PAII sensors. I’m using the GET statement below, but it does not include humidex.
I’d appreciate anyone who can help
curl -X GET "https://api.purpleair.com/v1/sensors/118883" -H "X-API-Key:XXXXXXX..."
Certain layers, including Humidex, aren’t currently available on the API. A complete list of queryable fields is available in our API Documentation.
One option is to locally calculate Humidex using temperature and humidity data from the API. If doing this, please note that temperature and humidity from the API are uncorrected. You can read more about this and available corrections in the Temperature and Humidity section of our What do PurpleAir Sensors Measure article.
export function getHumidex(T, RH) {
/*
https://en.wikipedia.org/wiki/Humidex
From https://www.physlink.com/Education/AskExperts/ae287.cfm
humidex = (air temperature) + h
where, h = (0.5555)*(e - 10.0); and,
e = 6.11 * exp(5417.7530 * ((1/273.16) - (1/dewpoint)))
*/
T = ftoc(T);
if (RH > 100) RH = 100;
var dewpoint = dew(T, RH) + 273.15;
//console.log("dewpoint: " + dewpoint);
var e = 6.11 * Math.exp(5417.7530 * ((1/273.16) - (1/dewpoint)));
var h = (0.5555)*(e - 10.0);
var humidex = T + h
//console.log("humidex: " + humidex);
return Math.round(humidex);
/*
Also a related and simplified formula that takes temperature and the relative humidity inputs is:
Humidex = T + 5/9 * (e-10) where:
e = vapour pressure(6.112*10^(7.5*T/(237.7+T))*H/100)
T= air temperature (degrees Celsius)
H= humidity (%)
*/
}
And this is what we do to the temperature readings before using them in the humidex function:
export function estimateHumidity(raw) {
let est = 1.4498 * raw + 7.022;
if (est > 100) {
est = 100;
}
return est;
}
export function estimateTemperature(raw) {
return 1.0227 * raw - 9.375;
}