troposphere-weather

Simple library to access global weather forecasts and climate data from troposphere.io

Usage no npm install needed!

<script type="module">
  import troposphereWeather from 'https://cdn.skypack.dev/troposphere-weather';
</script>

README

troposphere-weather

Simple library to access global weather forecasts and climate data from troposphere.io

Install

You can install troposphere-weather from npm, provided a recent version of node.js is installed.

npm install troposphere-weather

Getting started

troposphere-weather uses the troposphere.io weather API. You need an API key to access the API. A free API key can be requested here

Example

Here's a quick example of getting the weather for Munich, Germany:

const TroposphereWeather = require('troposphere-weather');

const apiKey = '/* Your API key */';

const api = new TroposphereWeather(apiKey);

weather.getForecastForPlace('Munich').then((results) => {
    console.log(results);
});

/*
{
    "timezone": "Europe/Berlin",
    "current": {
        "time": "2021-08-26T15:00:00+02:00",
        "type": "rain",
        "temperature": 14.08,
        "temperatureMin": 14,
        "temperatureMax": 15.06,
        "windSpeed": 4.15,
        "windGustsSpeed": 10.02,
        "windBearing": 119.77,
        "relHumidity": 84.91,
        "cloudCover": 100,
        "preasure": 101367.2,
        "totalPrecipitation": 0.58,
        "rain": 0.58,
        "snow": 0,
        "uvIndex": 1.33,
        "airQualityIndex": 2.34
    },
    "hourly": [
        {
            "time": "2021-08-26T00:00:00+02:00",
            "type": "partly-cloudy",
            "temperature": 10.54,
            "temperatureMin": 9.86,
            "temperatureMax": 14.48,
            "windSpeed": 1.07,
            "windGustsSpeed": 1.52,
            "windBearing": 59.05,
            "relHumidity": 82.21,
            "cloudCover": 11.3,
            "preasure": 101841.25,
            "totalPrecipitation": 0,
            "rain": 0,
            "snow": 0,
            "uvIndex": 0,
            "airQualityIndex": 2.28
        },
        ...
    ],
    "daily": [
        {
            "time": "2021-08-26T00:00:00+02:00",
            "sun": {
                "sunrise": "2021-08-26T06:26:02+02:00",
            "sunset": "2021-08-26T20:10:00+02:00"
            },
            "type": "rain-showers",
            "temperature": 12.608333333333333,
            "temperatureMin": 8.69,
            "temperatureMax": 15.74,
            "windSpeed": 4.91,
            "windSpeedMax": 10.85,
            "windBearing": 80.01333333333332,
            "relHumidity": 84.54791666666667,
            "cloudCover": 84.59833333333334,
            "preasure": 101463.14666666667,
            "totalPrecipitation": 2.96,
            "rain": 2.9499999999999997,
            "snow": 0,
            "uvIndexMax": 2.41
        }
        ...
    ]
}
*/

Licence

(c) 2021 Manuel Bauer. Licenced under the MIT license