8000 GitHub - bcl/aqi: AQI calculation package for go
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

bcl/aqi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AQI calculation package

This is based on this document from the EPA: https://nepis.epa.gov/Exe/ZyPDF.cgi/P100W5UG.PDF?Dockey=P100W5UG.PDF

Note that additional work is needed to average the Particulate Matter (PM) values before conversion, this package only implements the calcuation, not data gathering or averaging.

The AQI conversion is essentially a table of ranges with the concentration linerly scaled to map the the AQI output value The concentration input may be averaged over some timespan, eg. NowCast

Which is described here: https://www.airnow.gov/faqs/how-nowcast-algorithm-used-report/

Basic usage

Call the Lookup function with PM2.5 or PM10 and a float64 PM value. It will return the AQI value and the name of the range it falls into.

package main

import (
	"fmt"

	"github.com/bcl/aqi"
)

func main() {
	var pm2p5 float64
	var pm10 float64

	pm2p5 = 17.4
	pm10 = 3

	aqi_2p5, name_2p5, _ := aqi.Lookup("PM2.5", pm2p5)
	aqi_10, name_10, _ := aqi.Lookup("PM10", pm10)

	fmt.Printf("PM2.5 AQI = %d (%s)\n", aqi_2p5, name_2p5)
	fmt.Printf("PM10 AQI = %d (%s)\n", aqi_10, name_10)
}

About

AQI calculation package for go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0