Web Weather > Weather Website PHP/AJAX scripting

Purpleair PHP Retrieval script

<< < (2/27) > >>

wvdkuil:

--- Quote from: Forever on January 02, 2018, 11:21:45 PM ---I just got my PurpleAir and setup this script but noticed the AQI on the PurpleAir site and this script do not match.

This there more than one way to calculate AQI?

Is this script calculating the AQI correctly?

http://www.weathercat.net/purpleair.php
https://www.purpleair.com/map?&zoom=15&selected=393264|393266&lat=36.98094&lng=-122.01315899999997&clustersize=30&orderby=L&latr=0.03081979434855242&lngr=0.05776405334472656

--- End quote ---
Yes there are more ways to calculate. But only one "official" for the US.
https://www.airnow.gov/index.cfm?action=airnow.calculator

When I enter the values for PM2.5 Santa Cruz HighSchool https://www.purpleair.com/json?show=4355 there I get the same AQI as at the map:
21 ug/m3 => 70 AQI  Moderate

This purpleair script returns similar results when I test it for Santa Cruz HighSchool
21.58 ug/m3 => AQI 71 Moderate

But your script http://www.weathercat.net/purpleair.php returns lower values but the calculation is correct
14 ug/m3 => AQI 55 Moderate
Those 14 ug/m3 values are different from Santa Cruz HighSchool at the purpleair map which are all in the 20 ug/m3  range.

Check your script and  the number you entered at:

--- Code: ---$sensorid = '4355';
--- End code ---

Wim

Forever:
I checked my station ID and it's correct. https://www.purpleair.com/json?show=5650

The vales are much closer today but never seem to be the same.

At this point I guess it could be a rounding issue.

weatherbee:
I changed the script a little to pull the time of the file it is using.  I noticed it's about two minutes behind then the script on the map.  Also script pulls data only from channel A and I assume the AQI on the map is the average between channel A and B.
Tom

wvdkuil:

--- Quote from: weatherbee on January 03, 2018, 07:51:19 AM ---I changed the script a little to pull the time of the file it is using.  I noticed it's about two minutes behind then the script on the map.  Also script pulls data only from channel A and I assume the AQI on the map is the average between channel A and B.
Tom

--- End quote ---
Exactly, I was typing that now, When you check the link, https://www.purpleair.com/json?show=5650 you see that the two sensors are reported separate, their PM2.5 are  9.02 and 9.79  which result in an AQI of 38 and 40.

Succes, Wim


weatherbee:
I also changed the script to pull in both channels and average them together.
Tom

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version