{"id":17668499,"url":"https://github.com/evanshortiss/yr.no-forecast","last_synced_at":"2025-04-30T22:23:00.495Z","repository":{"id":11714341,"uuid":"14233301","full_name":"evanshortiss/yr.no-forecast","owner":"evanshortiss","description":"Node.js module to get weather forecast data in JSON format from yr.no service.","archived":false,"fork":false,"pushed_at":"2021-02-15T12:57:03.000Z","size":62,"stargazers_count":46,"open_issues_count":0,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-17T19:56:55.202Z","etag":null,"topics":["forecast","json","meteorologisk","metno","weather-data","yrno"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evanshortiss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-08T13:09:05.000Z","updated_at":"2024-12-19T20:35:10.000Z","dependencies_parsed_at":"2022-09-26T21:20:21.075Z","dependency_job_id":null,"html_url":"https://github.com/evanshortiss/yr.no-forecast","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanshortiss%2Fyr.no-forecast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanshortiss%2Fyr.no-forecast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanshortiss%2Fyr.no-forecast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanshortiss%2Fyr.no-forecast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evanshortiss","download_url":"https://codeload.github.com/evanshortiss/yr.no-forecast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251790271,"owners_count":21644195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["forecast","json","meteorologisk","metno","weather-data","yrno"],"created_at":"2024-10-23T23:22:47.236Z","updated_at":"2025-04-30T22:23:00.472Z","avatar_url":"https://github.com/evanshortiss.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"yr.no-forecast\n==============\n\n![TravisCI](https://travis-ci.org/evanshortiss/yr.no-forecast.svg) [![npm version](https://badge.fury.io/js/yr.no-forecast.svg)](https://badge.fury.io/js/yr.no-forecast) [![Coverage Status](https://coveralls.io/repos/github/evanshortiss/yr.no-forecast/badge.svg?branch=master)](https://coveralls.io/github/evanshortiss/yr.no-forecast?branch=master)\n\nWrapper to easily get weather data for a specified location in JSON format. Uses [yr.no-interface](https://github.com/evanshortiss/yr.no-interface) under the\nhood. See the API docs at [yr.no](http://api.yr.no/weatherapi/locationforecast/1.9/documentation).\n\n\n## Usage\nUse the ```getWeather(queryParams)``` function to get a\nLocationForecast object by calling the \"locationforecast\" API.\n\nHere's an example:\n\n\n```js\nconst yrno = require('yr.no-forecast')({\n  version: '1.9', // this is the default if not provided,\n  request: {\n    // make calls to locationforecast timeout after 15 seconds\n    timeout: 15000\n  }\n});\n\nconst LOCATION = {\n  // This is Dublin, Ireland\n  lat: 53.3478,\n  lon: 6.2597\n};\n\nyrno.getWeather(LOCATION)\n  .then((weather) =\u003e {\n    // Get general weather for next five days (Array with five objects)\n    weather.getFiveDaySummary()\n      .then((data) =\u003e console.log('five day summary', data));\n\n    // Get a weather data point for a given time between now and 9 days ahead\n    weather.getForecastForTime(new Date())\n      .then((data) =\u003e console.log('current weather', data));\n  })\n  .catch((e) =\u003e {\n    console.log('an error occurred!', e);\n  });\n```\n\n## API\n\n### module(config)\nThis module exports a single factory function that can be used to get a\nconfigured `instance` that exports the `getWeather` function.\n\nCurrently supported config options:\n\n* version - Passed when making a call to the met.no API to select the\nlocationforecast version to call\n* request - Can be populated with options for the `request` module. The only\nsetting that you should need to pass is `timeout` and is demonstrated above\n\n\n### instance.getWeather(params[, version])\nReturns a Promise that will resolve with a `LocationForecast` object that\ncontains functions to get weather data. You can pass the version parameter if\nyou want to override the default of 1.9, or the default you supplied when\ncreating and instance.\n\n### LocationForecast.getFiveDaySummary()\nReturns a Promise that resolves to an Array of 5 weather data Objects.\n\n### LocationForecast.getForecastForTime(time)\nReturns a Promise that resolves to a weather data Object that is closest to the\nprovided `time` argument. The `time` argument will be passed to `moment.utc` so\nmany time formats will work, but a millisecond timestamp or ISO formatted date\nstring are both ideal options to use use.\n\n### LocationForecast.getXml()\nReturns the raw XML string that the `locationforecast` API returned.\n\n### LocationForecast.getJson()\nReturns the JSON representation of the entire `locationforecast` response.\n\n### LocationForecast.getFirstDateInPayload()\nReturns the first date string that is available in the data returned from the\nlocationforecast call.\n\n### LocationForecast.getValidTimes()\nReturns an Array of ISO timestamps that represent points in time that we have\nweather data for.\n\n\n## Weather JSON Format\n\nSome fields will be undefined depending on the weather conditions. Always\nverify the field you need exists, e.g use `data.hasOwnProperty('fog')` or\nsimilar techniques.\n\n```json\n{\n  \"datatype\": \"forecast\",\n  \"from\": \"2017-04-18T03:00:00Z\",\n  \"to\": \"2017-04-18T03:00:00Z\",\n  \"icon\": \"PartlyCloud\",\n  \"rain\": \"0.0 mm\",\n  \"altitude\": \"0\",\n  \"latitude\": \"59.8940\",\n  \"longitude\": \"10.6450\",\n  \"temperature\": {\n    \"id\": \"TTT\",\n    \"unit\": \"celsius\",\n    \"value\": \"-0.9\"\n  },\n  \"windDirection\": {\n    \"id\": \"dd\",\n    \"deg\": \"14.6\",\n    \"name\": \"N\"\n  },\n  \"windSpeed\": {\n    \"id\": \"ff\",\n    \"mps\": \"1.5\",\n    \"beaufort\": \"1\",\n    \"name\": \"Flau vind\"\n  },\n  \"windGust\": {\n    \"id\": \"ff_gust\",\n    \"mps\": \"2.4\"\n  },\n  \"humidity\": {\n    \"value\": \"78.3\",\n    \"unit\": \"percent\"\n  },\n  \"pressure\": {\n    \"id\": \"pr\",\n    \"unit\": \"hPa\",\n    \"value\": \"1030.1\"\n  },\n  \"cloudiness\": {\n    \"id\": \"NN\",\n    \"percent\": \"15.4\"\n  },\n  \"fog\": {\n    \"id\": \"FOG\",\n    \"percent\": \"0.0\"\n  },\n  \"lowClouds\": {\n    \"id\": \"LOW\",\n    \"percent\": \"15.4\"\n  },\n  \"mediumClouds\": {\n    \"id\": \"MEDIUM\",\n    \"percent\": \"0.8\"\n  },\n  \"highClouds\": {\n    \"id\": \"HIGH\",\n    \"percent\": \"0.0\"\n  },\n  \"dewpointTemperature\": {\n    \"id\": \"TD\",\n    \"unit\": \"celsius\",\n    \"value\": \"-4.5\"\n  }\n}\n```\n\n## CHANGELOG\n\nCan be found [at this link](https://github.com/evanshortiss/yr.no-forecast/blob/master/CHANGELOG.md ).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevanshortiss%2Fyr.no-forecast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevanshortiss%2Fyr.no-forecast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevanshortiss%2Fyr.no-forecast/lists"}