npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yr-forecast

v1.0.3

Published

Get the forecast for a geographic location from [Yr](https://yr.no), the weather service by [Norwegian Meteorological Institute](https://met.no) and the [Norwegian Broadcasting Corporation](https://nrk.no). All the data is gathered from different API endp

Downloads

204

Readme

yr-forecast

Get the forecast for a geographic location from Yr, the weather service by Norwegian Meteorological Institute and the Norwegian Broadcasting Corporation. All the data is gathered from different API endpoints thats publicly available from this page (api.met.no).

Please read the conditions for usage here before starting using this module!

Installation

$ npm i yr-forecast

Usage

Get forecast for a location

This returns a full forecast for one location, that is, a forecast with several parameters for a nine-day period.

The parameters are temperature, wind speed, wind direction, pressure, precipitation, cloudiness, fog, lowClouds, mediumClouds, highClouds and humidity.

Example

const yr = require('yr-forecast')
const lat = 59.2667259
const lon = 10.4045301

const forecast = await yr.getForecast(lat, lon)

Returns

[
  {
    "from": "2020-05-17T18:00:00.000Z",
    "instant": {
      "air_pressure_at_sea_level": 1007,
      "air_temperature": 11.5,
      "cloud_area_fraction": 0,
      "cloud_area_fraction_high": 0,
      "cloud_area_fraction_low": 0.1,
      "cloud_area_fraction_medium": 0,
      "dew_point_temperature": -1.5,
      "fog_area_fraction": 0,
      "relative_humidity": 41.6,
      "ultraviolet_index_clear_sky": 0.2,
      "wind_from_direction": 303.5,
      "wind_speed": 4.3,
      "wind_speed_of_gust": 9.7
    },
    "next_1_hours": {
      "symbol_code": "clearsky_day",
      "precipitation_amount": 0,
      "precipitation_amount_max": 0,
      "precipitation_amount_min": 0,
      "probability_of_precipitation": 0,
      "probability_of_thunder": 0
    },
    "next_6_hours": {
      "symbol_code": "clearsky_night",
      "air_temperature_max": 10.3,
      "air_temperature_min": 5.3,
      "precipitation_amount": 0,
      "precipitation_amount_max": 0,
      "precipitation_amount_min": 0,
      "probability_of_precipitation": 0
    }
  },
  ...
]

Get precipitation forecast for a specific place

This returns the forcast for the next two hours.

The output is precipitation with unit mm/h. Currently only the area where we have radar coverage is supported. If the requests is outside the supported range, an error is thrown.

Example

const yr = require('yr-forecast')
const lat = 59.2667259
const lon = 10.4045301

const forecast = await yr.getNowcast(lat, lon)

Returns

[
  {
    "from": "2020-05-15T17:25:00.000Z",
    "to": "2020-05-15T17:25:00.000Z",
    "precipitation": {
      "unit": "mm/h",
      "value": "0.0"
    }
  },
  {
    "from": "2020-05-15T17:30:00.000Z",
    "to": "2020-05-15T17:30:00.000Z",
    "precipitation": {
      "unit": "mm/h",
      "value": "0.0"
    }
  },
  {
    "from": "2020-05-15T17:35:00.000Z",
    "to": "2020-05-15T17:35:00.000Z",
    "precipitation": {
      "value": "0.0",
      "unit": "mm/h"
    }
  },
  ...
]

Get text forecast for location

Get text forecasts for land areas in Norway. Land forecasts are currently only issued in Norwegian.

Example

const yr = require('yr-forecast')
const lat = 59.2667259
const lon = 10.4045301

const forecast = await yr.getTextForecast(lat, lon)

Returns

[
  {
    "from": "2020-05-17T22:00:00.000Z",
    "to": "2020-05-18T22:00:00.000Z",
    "areas": [
      {
        "id": "0513",
        "name": "Østafjells",
        "forecast": "Nordvest bris. Opphold. Fra om ettermiddagen skiftende bris, sørvest periodevis frisk bris på kysten. Kan hende litt regn i Agder, ellers stort sett opphold."
      }
    ]
  },
  ...
]