Giter Site home page Giter Site logo

niluclient's Introduction

niluclient

Python client for getting air pollution data from NILU sensor stations in Norway. The package comes with clients that can fetch and cache data from nilus api.

Buy me a coffee

Acknowledgements

According to the api documentation from nilu.no and luftkvalitet.info, when using data fetched through this client an acknowledgement to both nilu.no and luftkvalitet.info needs to be included.

Usage

Finding all station in an area:

import niluclient as nilu

stations = nilu.lookup_stations_in_area('Bergen')

Finding all stations and sensor reading within 20 km from a location:

import niluclient as nilu

client = nilu.create_location_client(60.123456, 5.123456)

# name of all stations found.
station_names = client.station_names

# dict of all stations with readings.
stations = client.station_data

# all stations NO2 readings
for station in stations:
    no2_value = station.sensors[nilu.NO2].value

Finding readings from a specified station, and update cached value:

import niluclient as nilu

client = nilu.create_station_client('Kannik')
no2_value = client.data.sensors[nilu.NO2].value
no2_unit = client.data.sensors[nilu.NO2].unit_of_measurement

# after an hour. (Data from the api will only update on the hour) 
client.update()

new_no2_value = client.data.sensors[nilu.NO2].value

Client api coverage

Air quality index: Fetch measured value and index.

  • GET /aq/utd (Implemented for station filtering) - niluclient.NiluStationClient
  • GET /aq/utd/{latitude}/{longitude}/{radius} - niluclient.NiluLocationClient
  • GET /aq/historical/{fromtime}/{totime}/{station}
  • GET /aq/historical/{fromtime}/{totime}/{latitude}/{longitude}/{radius}

Observations: Fetch measured value.

  • GET /obs/utd
  • GET /obs/utd/{latitude}/{longitude}/{radius}
  • GET /obs/historical/{fromtime}/{totime}/{station}
  • GET /obs/historical/{fromtime}/{totime}/{latitude}/{longitude}/{radius}

Day average Calculates day average for a given time period.

  • GET /stats/day/{fromtime}/{totime}/{station}
  • GET /stats/day/{fromtime}/{totime}/{latitude}/{longitude}/{radius}

Lookup api: Lists metadata used for filtering.

  • GET /lookup/areas - (Partially with the niluclient.AREAS constants)
  • GET /lookup/stations - niluclient.lookup_stations_in_area('')
  • GET /lookup/components - (Partially with the niluclient.MEASURABLE_COMPONENTS constants)
  • GET /lookup/aqis

Source: endpoints and description fetched from nilu api documentation

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.