Skip to content

Dear Internet Explorer user: Your browser is no longer supported

Please switch to a modern browser such as Microsoft Edge, Mozilla Firefox or Google Chrome to view this website's content.

Calculating “Feels Like” Temperatures

Use the Aeris Weather API to calculate Australian Ambient Temperature (AT) or “feels like” calculations from private weather station data published to PWSweather.

I recently purchased a private weather station (PWS) that reports data every 60 seconds to PWSweather. Members of PWSweather can also sign-up to access the AerisWeather API, which allows users to access their weather station data online for downstream purposes (such as publishing to a personal website).

The Australian Bureau of Meteorology (BOM) displays “feels like” temperature readings alongside dry bulb temperatures on its website and app. This is actually known internationally as the Australian Apparent Temperature (AT) and is based on the work of Steadman (1994). It differs from models used in the United States, Canada and United Kingdom which is why I wanted to use it. My weather station does not natively calculate this metric, so I implemented a PHP routine to calculate it and publish the value to a website along with my other data.

Screen capture of Bureau of Meteorology website.
Output from the Australian Bureau of Meteorology’s website showing a dry bulb temperature of 10.4°C and “feels like” of 8.1°C for Melbourne. This is the Australian Apparent Temperature (AT) value.

There are two models of AT; one which factors in radiation and one that doesn’t. The version that factors-in radiation is complex and not utilised by the BOM. The BOM’s “feels like” metric is calculated as follows:

\[AT=T_a+0.33\rho-0.7\omega-4.00\]

where:

The vapour pressure can be calculated from the temperature and relative humidity using the equation:

\[ \rho =\frac{RH}{100}\times6.105\times e^{ \left(\frac{17.27\times T_a}{237.7 + T_a}\right)}\]

where RH is relative humidity (%).

My weather station provides data for Ta and ω whilst ρ has to be calculated from RH (which is also reported).

To do this in PHP, a call to the AerisWeather API is required:

<?php
$response = file_get_contents('https://api.aerisapi.com/observations/pws_PWSID?client_id=YOURID&client_secret=YOURSECRET');
$json = json_decode($response);
$time = $json->response->ob->dateTimeISO;
date_default_timezone_set('Australia/Melbourne');
?>

The PWSID, YOURID and YOURSECRET strings need to be replaced with your weather station ID (on PWSweather) and API credentials. This will return data in JSON format with current readings for your weather station (as last reported on PWSweather).

Next, add a PHP block that pulls out the relevant data and performs the calculations:

<?php
$rh = $json->response->ob->humidity;
$ta = $json->response->ob->tempC;
$vp = ($rh/100)*6.105*exp((17.27*$ta)/(237.7+$ta));
$ws = $json->response->ob->windSpeedKPH;
$wsm = $ws*0.277778;
$at = $ta+(0.33*$vp)-(0.70*$wsm)-4;
?>

The AerisWeather API returns wind speed in kilometres per hour, so this needs to be changed to metres per second ($wsm) for the calculation to work.

Then to print the value on the website, call the $at variable:

<?php echo number_format($at, 1);?>&#176;

This will print the “Feels Like” temperature followed by a degrees symbol (°).

   

Comments

3 responses to “Calculating “Feels Like” Temperatures”

On 27 July 2023, Ryan Blundell wrote: Hyperlink chain icon

Hi Adam

I saw that you were linking to bom.gov.au on this page https://code.adonline.id.au/calculating-feels-like-temperatures/

I would be thrilled if you would consider my website for weather information too? I think my website gives a better experience to your users as the design is a little less dated. I also provide hourly forecasts and not just one forecast for the entire day.

Here is my page for Melbourne, (https://justweather.org/Australia/Victoria/Melbourne/Melbourne/). Let me know what you think?

Cheers

Ryan Blundell
Founder at Justweather.org

Reply

On 16 August 2023, zzap wrote: Hyperlink chain icon

Great post! I came across this as I was looking to understand how the BOM calculates feels like or apparent temperature. I never knew they used a calculation unique to Australia and that it is not the same as the US or UK feels like calculations. Thanks for sharing your cool PHP script too.

Reply

On 9 January 2024, Nobby wrote: Hyperlink chain icon

The attribution year for Steadman should be 1984, Roberts initial finding, unless you chose the revision in 94 for a reason that is.

Reply

Have Your Say

The following HTML is permitted:
<a href="" title=""> <b> <blockquote cite=""> <code> <em> <i> <q cite=""> <strike> <strong>

Comments will be published subject to the Editorial Policy.