davidcarslaw / openair

Tools for air quality data analysis
https://davidcarslaw.github.io/openair/
GNU General Public License v2.0
307 stars 113 forks source link

Mean in Pollution Rose differs from normal mean #308

Closed Saolaina closed 1 year ago

Saolaina commented 2 years ago

Hi, I need to know how the average for the pollution rose is calculated, as when I calculate the average of the pollutant I get a different result than with the package.

Cheers, Saolaina

e.g.

image

schonhose commented 1 year ago

Is it possible that the mean in the plot is based on concentrations with meteorological data only? In other words, samples without meteorological data might be omitted.

jack-davison commented 1 year ago

@schonhose is spot on; pollutionRose() drops missing met data first, as that is the data visualised in the rose itself.

mean(openair::mydata$nox, na.rm = TRUE)
#> [1] 178.7986

mean(openair::mydata$nox[!is.na(openair::mydata$ws)], na.rm = TRUE)
#> [1] 178.6236

openair::pollutionRose(openair::mydata)

Created on 2023-02-07 with reprex v2.0.2