Git Product home page Git Product logo

aqi's Introduction

Air Quality Index (AQI)

https://melpa.org/packages/aqi-badge.svg

The aqi package provides an interface to the World Air Quality Index.

“The World Air Quality Index project is a non-profit project started in 2007. Its mission is to promote air pollution awareness for citizens and provide a unified and world-wide air quality information. The project is providing transparent air quality information for more than 100 countries, covering more than 12,000 stations in 1000 major cities, via those two websites: aqicn.org and waqi.info.”

“The Air Quality Index is based on measurement of particulate matter (PM2.5 and PM10), Ozone (O3), Nitrogen Dioxide (NO2), Sulfur Dioxide (SO2) and Carbon Monoxide (CO) emissions. Most of the stations on the map are monitoring both PM2.5 and PM10 data, but there are few exceptions where only PM10 is available.”

Further information can be found on the WAQI site, in particular the sources & coverage, API docs and FAQ.

Installation, configuration and use

The aqi package can be installed from MELPA or manually via github.

To access the WAQI project API it’s necessary to register at http://aqicn.org/data-platform/token/ and generate a key. Once you have your API key it can be configured via use-package, M-x customize or manually.

(use-package aqi
 :config (setq aqi-api-key "your-api-key“
          aqi-use-cache t)

The simplest way to view AQI info is with M-x aqi-report which displays air quality info for your algorithmically derived location (equivalent to the location “here”) or the name of a place. A place can be the name of a city (in which case the nearest monitoring station is used) or the id of specific monitoring station.

By name…

(aqi-report "Ulaanbaatar")

By id…

(aqi-report "@7397")

A detailed report is displayed by default and a single line summary can be provided by using the keyword brief

(aqi-report "Taipei" 'brief)

To use the data programmatically, the functions aqi-report-full and aqi-report-brief return the report as a string. The function aqi-city-aqi will return the AQI for a given city as a number.

(aqi-city-aqi "Osaka")

There are macros that can be used to create accessors for specific data points from the city/station feed. For example, (aqi--make-city-raw-accessor 'aqi-station .attribution) will create the function aqi-station which returns the attribution field as specified in the API reference.

Further

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.