# iceweather
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/)
[![Release](https://shields.io/github/v/release/mideind/iceweather?display_name=tag)]()
[![PyPI](https://img.shields.io/pypi/v/iceweather)]()
[![Build](https://github.com/mideind/iceweather/actions/workflows/python-package.yml/badge.svg)]()
`ìceweather` is a Python 3.7+ package for obtaining Icelandic weather information and forecasts from
the [Icelandic Met Office](https://en.vedur.is/) (*Veðurstofan*). Uses the xmlweather API ([documentation in Icelandic](https://vedur.is/um-vi/vefurinn/xml/)).
## Installation
```sh
pip install iceweather
```
## Examples
### Observations
Get latest weather observations from the nearest weather station:
```python
>>> r = observation_for_closest(64.133097, -21.898145)
>>> pprint(r)
{'results': [{'D': 'SSV',
'F': '3',
'FG': '7',
'FX': '4',
'N': '',
'P': '1001',
'R': '0.2',
'RH': '75',
'RTE': '',
'SED': '',
'SNC': '',
'SND': '',
'T': '9.3',
'TD': '5.1',
'V': '',
'W': '',
'err': '',
'id': '1',
'link': 'http://www.vedur.is/vedur/athuganir/kort/hofudborgarsvaedid/#group=100&station=1',
'name': 'Reykjavík',
'time': '2019-09-12 13:00:00',
'valid': '1'}]}
```
Keys are the following:
| Key | |
| ----- |-----------------------------------|
| F | Wind speed (m/s) |
| FX | Top wind speed (m/s) |
| FG | Top wind gust (m/s) |
| D | Wind direction |
| T | Air temperature (°C) |
| W | Weather description |
| V | Visibility (km) |
| N | Cloud cover (%) |
| P | Air pressure |
| RH | Humidity (%) |
| SNC | Snow description |
| SND | Snow depth |
| SED | Snow type |
| RTE | Road temperature (°C) |
| TD | Dew limit (°C) |
| R | Cumulative precipitation (mm/h) |
```python
>>> observation_for_station(1) # Reykjavík
...
```
See stations.py for a list of all weather stations in Iceland and their unique IDs.
### Forecasts
```python
forecast_for_closest(64.133097, -21.898145)
...
forecast_for_station(1) # Reykjavík
```
### Human-readable weather descriptions
Request a descriptive text from the weather API:
```python
# Human-readable Icelandic-language weather forecast for Iceland's Capital Region
>>> forecast_text(3)
{'results': [{'content': 'Suðvestan 5-10 m/s í dag en 8-13 á morgun. Skúrir og hiti 5 til 10 stig.',
'creation': '2019-09-12 10:20:32',
'id': '3',
'title': 'Veðurhorfur á höfuðborgarsvæðinu',
'valid_from': '2019-09-12 12:00:00',
'valid_to': '2019-09-14 00:00:00'}]}
```
```text
Text types:
"2" = "Veðurhorfur á landinu"
"3" = "Veðurhorfur á höfuðborgarsvæðinu"
"5" = "Veðurhorfur á landinu næstu daga"
"6" = "Veðurhorfur á landinu næstu daga"
"7" = "Weather outlook"
"9" = "Veðuryfirlit"
"10" = "Veðurlýsing"
"11" = "Íslenskar viðvaranir fyrir land"
"12" = "Veðurhorfur á landinu"
"14" = "Enskar viðvaranir fyrir land"
"27" = "Weather forecast for the next several days"
"30" = "Miðhálendið"
"31" = "Suðurland"
"32" = "Faxaflói"
"33" = "Breiðafjörður"
"34" = "Vestfirðir"
"35" = "Strandir og Norðurland vestra"
"36" = "Norðurlandi eystra"
"37" = "Austurland að Glettingi"
"38" = "Austfirðir"
"39" = "Suðausturland"
"42" = "General synopsis
```
All functions accept the `lang` keyword parameter. Supported languages are `is` and `en` for Icelandic or English results, respectively.
## Version History
* 0.2.1 - Updated weather station data. Now requires Python 3.7+ (2022-12-14)
* 0.2.0 - Now uses the Icelandic Met Office's XML API directly instead apis.is (2021-07-15)
* 0.1.1 - Fall back on other close weather stations for if err in result from closest station
* 0.1.0 - Initial release (2019-09-12)
## BSD License
Copyright (C) 2019-2022 Miðeind ehf.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Raw data
{
"_id": null,
"home_page": "https://github.com/mideind/iceweather",
"name": "iceweather",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Mi\u00f0eind ehf.",
"author_email": "mideind@mideind.is",
"download_url": "https://files.pythonhosted.org/packages/9e/9d/2baa0ecd39c4c51da07346a8cd2d17a4f8e80831c340a14bafaa91fb3cac/iceweather-0.2.1.tar.gz",
"platform": null,
"description": "# iceweather\n\n[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/)\n[![Release](https://shields.io/github/v/release/mideind/iceweather?display_name=tag)]()\n[![PyPI](https://img.shields.io/pypi/v/iceweather)]()\n[![Build](https://github.com/mideind/iceweather/actions/workflows/python-package.yml/badge.svg)]()\n\n`\u00ecceweather` is a Python 3.7+ package for obtaining Icelandic weather information and forecasts from\nthe [Icelandic Met Office](https://en.vedur.is/) (*Ve\u00f0urstofan*). Uses the xmlweather API ([documentation in Icelandic](https://vedur.is/um-vi/vefurinn/xml/)).\n\n## Installation\n\n```sh\npip install iceweather\n```\n\n## Examples\n\n### Observations\n\nGet latest weather observations from the nearest weather station:\n\n```python\n>>> r = observation_for_closest(64.133097, -21.898145)\n>>> pprint(r)\n{'results': [{'D': 'SSV',\n 'F': '3',\n 'FG': '7',\n 'FX': '4',\n 'N': '',\n 'P': '1001',\n 'R': '0.2',\n 'RH': '75',\n 'RTE': '',\n 'SED': '',\n 'SNC': '',\n 'SND': '',\n 'T': '9.3',\n 'TD': '5.1',\n 'V': '',\n 'W': '',\n 'err': '',\n 'id': '1',\n 'link': 'http://www.vedur.is/vedur/athuganir/kort/hofudborgarsvaedid/#group=100&station=1',\n 'name': 'Reykjav\u00edk',\n 'time': '2019-09-12 13:00:00',\n 'valid': '1'}]}\n```\n\nKeys are the following:\n\n| Key | |\n| ----- |-----------------------------------|\n| F | Wind speed (m/s) |\n| FX | Top wind speed (m/s) |\n| FG | Top wind gust (m/s) |\n| D | Wind direction |\n| T | Air temperature (\u00b0C) |\n| W | Weather description |\n| V | Visibility (km) |\n| N | Cloud cover (%) |\n| P | Air pressure |\n| RH | Humidity (%) |\n| SNC | Snow description |\n| SND | Snow depth |\n| SED | Snow type |\n| RTE | Road temperature (\u00b0C) |\n| TD | Dew limit (\u00b0C) |\n| R | Cumulative precipitation (mm/h) |\n\n```python\n>>> observation_for_station(1) # Reykjav\u00edk\n...\n```\n\nSee stations.py for a list of all weather stations in Iceland and their unique IDs.\n\n### Forecasts\n\n```python\nforecast_for_closest(64.133097, -21.898145)\n...\nforecast_for_station(1) # Reykjav\u00edk\n```\n\n### Human-readable weather descriptions\n\nRequest a descriptive text from the weather API:\n\n```python\n# Human-readable Icelandic-language weather forecast for Iceland's Capital Region\n>>> forecast_text(3)\n{'results': [{'content': 'Su\u00f0vestan 5-10 m/s \u00ed dag en 8-13 \u00e1 morgun. Sk\u00farir og hiti 5 til 10 stig.',\n 'creation': '2019-09-12 10:20:32',\n 'id': '3',\n 'title': 'Ve\u00f0urhorfur \u00e1 h\u00f6fu\u00f0borgarsv\u00e6\u00f0inu',\n 'valid_from': '2019-09-12 12:00:00',\n 'valid_to': '2019-09-14 00:00:00'}]}\n```\n\n```text\nText types:\n\n \"2\" = \"Ve\u00f0urhorfur \u00e1 landinu\"\n \"3\" = \"Ve\u00f0urhorfur \u00e1 h\u00f6fu\u00f0borgarsv\u00e6\u00f0inu\"\n \"5\" = \"Ve\u00f0urhorfur \u00e1 landinu n\u00e6stu daga\"\n \"6\" = \"Ve\u00f0urhorfur \u00e1 landinu n\u00e6stu daga\"\n \"7\" = \"Weather outlook\"\n \"9\" = \"Ve\u00f0uryfirlit\"\n \"10\" = \"Ve\u00f0url\u00fdsing\"\n \"11\" = \"\u00cdslenskar vi\u00f0varanir fyrir land\"\n \"12\" = \"Ve\u00f0urhorfur \u00e1 landinu\"\n \"14\" = \"Enskar vi\u00f0varanir fyrir land\"\n \"27\" = \"Weather forecast for the next several days\"\n \"30\" = \"Mi\u00f0h\u00e1lendi\u00f0\"\n \"31\" = \"Su\u00f0urland\"\n \"32\" = \"Faxafl\u00f3i\"\n \"33\" = \"Brei\u00f0afj\u00f6r\u00f0ur\"\n \"34\" = \"Vestfir\u00f0ir\"\n \"35\" = \"Strandir og Nor\u00f0urland vestra\"\n \"36\" = \"Nor\u00f0urlandi eystra\"\n \"37\" = \"Austurland a\u00f0 Glettingi\"\n \"38\" = \"Austfir\u00f0ir\"\n \"39\" = \"Su\u00f0austurland\"\n \"42\" = \"General synopsis\n```\n\nAll functions accept the `lang` keyword parameter. Supported languages are `is` and `en` for Icelandic or English results, respectively.\n\n## Version History\n\n* 0.2.1 - Updated weather station data. Now requires Python 3.7+ (2022-12-14)\n* 0.2.0 - Now uses the Icelandic Met Office's XML API directly instead apis.is (2021-07-15)\n* 0.1.1 - Fall back on other close weather stations for if err in result from closest station\n* 0.1.0 - Initial release (2019-09-12)\n\n## BSD License\n\nCopyright (C) 2019-2022 Mi\u00f0eind ehf.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this\nlist of conditions and the following disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its contributors may\nbe used to endorse or promote products derived from this software without specific\nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\nIN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.",
"bugtrack_url": null,
"license": "BSD",
"summary": "Look up Icelandic weather information (observations, forecasts, etc.)",
"version": "0.2.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d4064e6b106b2665dee086b1a50c8d2c",
"sha256": "d657206cb6473ae6d9d694287316ebe780e0be817edb0399be574498add0f3a2"
},
"downloads": -1,
"filename": "iceweather-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "d4064e6b106b2665dee086b1a50c8d2c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16107,
"upload_time": "2022-12-14T16:24:01",
"upload_time_iso_8601": "2022-12-14T16:24:01.353453Z",
"url": "https://files.pythonhosted.org/packages/9e/9d/2baa0ecd39c4c51da07346a8cd2d17a4f8e80831c340a14bafaa91fb3cac/iceweather-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-14 16:24:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "mideind",
"github_project": "iceweather",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "iceweather"
}