A utility package for working with air quality measurements.
Currently, supports computing Air Quality Index (AQI) scores given PM2.5 concentrations and US categories.
let someVal = AirQualityIndex.compute(forPollutant: .PM_25, atConcentration: 37.0)
switch someVal {
case .success(let (aqi, category)):
print("Your AQI is: \(aqi), which is: \(category.label())")
case .failure(let err):
switch err {
case .ConcentrationOutOfRange:
print("Your AQI is literally off the charts.")
}
}
- More pollutants
- Probably all kinds of other stuff
Any way you like, but SPM does work just fine. Note that the branch you want to be following is main
.