# weatheril
[![Downloads](https://static.pepy.tech/personalized-badge/weatheril?period=total&units=international_system&left_color=blue&right_color=green&left_text=Downloads)](https://pepy.tech/project/weatheril)
[![DownloaFormatds](https://img.shields.io/pypi/v/weatheril)](https://img.shields.io/pypi/v/weatheril)
[![DownloaFormatds](https://img.shields.io/pypi/format/weatheril)](https://img.shields.io/pypi/format/weatheril) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=techblog_weatheril&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=techblog_weatheril)
weatheril is an unofficial [IMS](https://ims.gov.il) (Israel Meteorological Service) python API wrapper.
## Features supported
* Get current weather status.
* Get Daily and Hourly forecast (5 days ahead).
* Get Radar and Satellite images.
## Components and Frameworks used in weatheril
* [Loguru](https://pypi.org/project/loguru/)
* [Requests ](https://pypi.org/project/requests/)
* [Pillow](https://pypi.org/project/Pillow/)
* [urllib3](https://pypi.org/project/urllib3/)
## Getting started
Use git to clone or you can also manually download the project repository just as shown below;
```bash
$ git clone https://github.com/t0mer/py-weatheril/
$ cd py-weatheril
py-weatheril $ python3 setup.py install
```
### Installing from PyPi
```bash
# For Windows
pip install --upgrade weatheril
#For Linux | MAC
pip3 install --upgrade weatheril
```
## Working with the API
weatheril can be configured to retrive forecast information for specific location. when initiating the library you must set the location id and language (Currently only he and en are supported)
```python
from weatheril import *
weather = WeatherIL(21,"he")
```
In the above example i set **Raanana** as the location and **Hebrew** as language. Full locations list in the table below.
| Id | Location |
| ------------ | ----------- |
| 1| Jerusalem|
| 2| Tel Aviv - Yafo|
| 3| Haifa|
| 4| Rishon le Zion|
| 5| Petah Tiqva|
| 6| Ashdod|
| 7| Netania|
| 8| Beer Sheva|
| 9| Bnei Brak|
| 10| Holon|
| 11| Ramat Gan|
| 12| Asheqelon|
| 13| Rehovot|
| 14| Bat Yam|
| 15| Bet Shemesh|
| 16| Kfar Sava|
| 17| Herzliya|
| 18| Hadera|
| 19| Modiin|
| 20| Ramla|
| 21| Raanana|
| 22| Modiin Illit|
| 23| Rahat|
| 24| Hod Hasharon|
| 25| Givatayim|
| 26| Kiryat Ata|
| 27| Nahariya|
| 28| Beitar Illit|
| 29| Um al-Fahm|
| 30| Kiryat Gat|
| 31| Eilat|
| 32| Rosh Haayin|
| 33| Afula|
| 34| Nes-Ziona|
| 35| Akko|
| 36| Elad|
| 37| Ramat Hasharon|
| 38| Karmiel|
| 39| Yavneh|
| 40| Tiberias|
| 41| Tayibe|
| 42| Kiryat Motzkin|
| 43| Shfaram|
| 44| Nof Hagalil|
| 45| Kiryat Yam|
| 46| Kiryat Bialik|
| 47| Kiryat Ono|
| 48| Maale Adumim|
| 49| Or Yehuda|
| 50| Zefat|
| 51| Netivot|
| 52| Dimona|
| 53| Tamra |
| 54| Sakhnin|
| 55| Yehud|
| 56| Baka al-Gharbiya|
| 57| Ofakim|
| 58| Givat Shmuel|
| 59| Tira|
| 60| Arad|
| 61| Migdal Haemek|
| 62| Sderot|
| 63| Araba|
| 64| Nesher|
| 65| Kiryat Shmona|
| 66| Yokneam Illit|
| 67| Kafr Qassem|
| 68| Kfar Yona|
| 69| Qalansawa|
| 70| Kiryat Malachi|
| 71| Maalot-Tarshiha|
| 72| Tirat Carmel|
| 73| Ariel|
| 74| Or Akiva|
| 75| Bet Shean|
| 76| Mizpe Ramon|
| 77| Lod|
| 78| Nazareth|
| 79| Qazrin|
| 80| En Gedi|
| 200| Nimrod Fortress|
| 201| Banias|
| 202| Tel Dan|
| 203| Snir Stream|
| 204| Horshat Tal |
| 205| Ayun Stream|
| 206| Hula|
| 207| Tel Hazor|
| 208| Akhziv|
| 209| Yehiam Fortress|
| 210| Baram|
| 211| Amud Stream|
| 212| Korazim|
| 213| Kfar Nahum|
| 214| Majrase |
| 215| Meshushim Stream|
| 216| Yehudiya |
| 217| Gamla|
| 218| Kursi |
| 219| Hamat Tiberias|
| 220| Arbel|
| 221| En Afek|
| 222| Tzipori|
| 223| Hai-Bar Carmel|
| 224| Mount Carmel|
| 225| Bet Shearim|
| 226| Mishmar HaCarmel |
| 227| Nahal Me‘arot|
| 228| Dor-HaBonim|
| 229| Tel Megiddo|
| 230| Kokhav HaYarden|
| 231| Maayan Harod|
| 232| Bet Alpha|
| 233| Gan HaShlosha|
| 235| Taninim Stream|
| 236| Caesarea|
| 237| Tel Dor|
| 238| Mikhmoret Sea Turtle|
| 239| Beit Yanai|
| 240| Apollonia|
| 241| Mekorot HaYarkon|
| 242| Palmahim|
| 243| Castel|
| 244| En Hemed|
| 245| City of David|
| 246| Me‘arat Soreq|
| 248| Bet Guvrin|
| 249| Sha’ar HaGai|
| 250| Migdal Tsedek|
| 251| Haniya Spring|
| 252| Sebastia|
| 253| Mount Gerizim|
| 254| Nebi Samuel|
| 255| En Prat|
| 256| En Mabo‘a|
| 257| Qasr al-Yahud|
| 258| Good Samaritan|
| 259| Euthymius Monastery|
| 261| Qumran|
| 262| Enot Tsukim|
| 263| Herodium|
| 264| Tel Hebron|
| 267| Masada |
| 268| Tel Arad|
| 269| Tel Beer Sheva|
| 270| Eshkol|
| 271| Mamshit|
| 272| Shivta|
| 273| Ben-Gurion’s Tomb|
| 274| En Avdat|
| 275| Avdat|
| 277| Hay-Bar Yotvata|
| 278| Coral Beach|
### Get Satellite and Radar Images
```python
from weatheril import *
weather = WeatherIL(21,"he")
images = weather.get_radar_images()
```
The get_radar_images will retun an object with four lists:
* imsradar_images - Rain radar images (IMS).
* radar_images - Radar images.
* middle_east_satellite_images - Middel East weather sattelite images.
* europe_satellite_images - Eourope weather sattelite images.
You can also create animateg gif from this images lists by using the create_animation method as follows:
```python
from weatheril import *
weather = WeatherIL(21,"he")
images = weather.get_radar_images()
animated = images.create_animation(images = images.middle_east_satellite_images, animated_file = "file.gif", path="/tmp")
```
The function will return the path for the created image.
**Optional**
You can use the following function to create animated gifs for all images
```python
from weatheril import *
weather = WeatherIL(21,"he")
images = weather.get_radar_images()
images.generate_images(path="Path to store the images")
```
[![Sattelite](https://github.com/t0mer/py-weatheril/blob/main/screenshots/animated.gif?raw=true "Sattelite")](https://github.com/t0mer/py-weatheril/blob/main/screenshots/animated.gif?raw=true "Sattelite")
### Get current weather status for given location
```python
from weatheril import *
weather = WeatherIL(21,"he")
current = weather.get_current_analysis()
```
The result will be a weather object containing the data requested:
* Location.
* Humidity.
* Rain.
* Temperature.
* Wind speed.
* Feels like.
* UV.
* Time
* Json result
```json
"33": {
"id": "1601809",
"lid": "33",
"forecast_time": "2023-01-25 16:00:00",
"type": "analysis",
"main_hour": "0",
"heat_stress": "17",
"relative_humidity": "58",
"due_point_Temp": "11",
"rain": null,
"temperature": "20",
"wind_direction_id": "15",
"wind_speed": "2",
"wind_chill": "20",
"weather_code": null,
"heat_stress_level": "0",
"feels_like": "20",
"min_temp": null,
"max_temp": null,
"modified": "2023-01-25 15:55:00",
"created": "2023-01-22 11:50:05",
"u_v_index": "0",
"u_v_level": "L",
"u_v_i_max": null,
"u_v_i_factor": null
}
```
### Get weather forecast
```python
from weatheril import *
weather = WeatherIL(21,"he")
forcats = weather.get_forecast()
```
This method wil return forecast object that includes weather forecast for the new 5 days. The object contains data on Coutry level and also on give location Forecast >> Daily >> Hourly.
```python
class Forecast:
days: list
class Daily:
date: datetime
location: str
day: str
weather: str
minimum_temperature: int
maximum_temperature: int
maximum_uvi: int
hours: list
description: str
class Hourly:
hour: str
weather: str
temperature: int
```
Raw data
{
"_id": null,
"home_page": "https://github.com/t0mer/py-weatheril",
"name": "weatheril",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "ims, weatheril, Israel Meteorological Service, Meteorological Service, weather",
"author": "Tomer Klein",
"author_email": "tomer.klein@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e7/08/1cc48a993ac961fb564f7c51ed92e94539df8c715a691afbe7bb7788701d/weatheril-0.34.0.tar.gz",
"platform": null,
"description": "# weatheril\n[![Downloads](https://static.pepy.tech/personalized-badge/weatheril?period=total&units=international_system&left_color=blue&right_color=green&left_text=Downloads)](https://pepy.tech/project/weatheril) \n[![DownloaFormatds](https://img.shields.io/pypi/v/weatheril)](https://img.shields.io/pypi/v/weatheril)\n[![DownloaFormatds](https://img.shields.io/pypi/format/weatheril)](https://img.shields.io/pypi/format/weatheril) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=techblog_weatheril&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=techblog_weatheril)\n\n\n\nweatheril is an unofficial [IMS](https://ims.gov.il) (Israel Meteorological Service) python API wrapper.\n\n## Features supported\n* Get current weather status.\n* Get Daily and Hourly forecast (5 days ahead).\n* Get Radar and Satellite images.\n\n\n## Components and Frameworks used in weatheril\n* [Loguru](https://pypi.org/project/loguru/)\n* [Requests ](https://pypi.org/project/requests/)\n* [Pillow](https://pypi.org/project/Pillow/)\n* [urllib3](https://pypi.org/project/urllib3/)\n\n\n## Getting started\n\nUse git to clone or you can also manually download the project repository just as shown below;\n\n```bash\n$ git clone https://github.com/t0mer/py-weatheril/\n$ cd py-weatheril\npy-weatheril $ python3 setup.py install \n```\n\n### Installing from PyPi\n\n```bash\n# For Windows \n\npip install --upgrade weatheril\n\n#For Linux | MAC \n\npip3 install --upgrade weatheril\n```\n\n## Working with the API\n\nweatheril can be configured to retrive forecast information for specific location. when initiating the library you must set the location id and language (Currently only he and en are supported)\n\n```python\nfrom weatheril import *\nweather = WeatherIL(21,\"he\")\n```\n\nIn the above example i set **Raanana** as the location and **Hebrew** as language. Full locations list in the table below.\n\n\n\n| Id | Location |\n| ------------ | ----------- |\n| 1| Jerusalem|\n| 2| Tel Aviv - Yafo|\n| 3| Haifa|\n| 4| Rishon le Zion|\n| 5| Petah Tiqva|\n| 6| Ashdod|\n| 7| Netania|\n| 8| Beer Sheva|\n| 9| Bnei Brak|\n| 10| Holon|\n| 11| Ramat Gan|\n| 12| Asheqelon|\n| 13| Rehovot|\n| 14| Bat Yam|\n| 15| Bet Shemesh|\n| 16| Kfar Sava|\n| 17| Herzliya|\n| 18| Hadera|\n| 19| Modiin|\n| 20| Ramla|\n| 21| Raanana|\n| 22| Modiin Illit|\n| 23| Rahat|\n| 24| Hod Hasharon|\n| 25| Givatayim|\n| 26| Kiryat Ata|\n| 27| Nahariya|\n| 28| Beitar Illit|\n| 29| Um al-Fahm|\n| 30| Kiryat Gat|\n| 31| Eilat|\n| 32| Rosh Haayin|\n| 33| Afula|\n| 34| Nes-Ziona|\n| 35| Akko|\n| 36| Elad|\n| 37| Ramat Hasharon|\n| 38| Karmiel|\n| 39| Yavneh|\n| 40| Tiberias|\n| 41| Tayibe|\n| 42| Kiryat Motzkin|\n| 43| Shfaram|\n| 44| Nof Hagalil|\n| 45| Kiryat Yam|\n| 46| Kiryat Bialik|\n| 47| Kiryat Ono|\n| 48| Maale Adumim|\n| 49| Or Yehuda|\n| 50| Zefat|\n| 51| Netivot|\n| 52| Dimona|\n| 53| Tamra |\n| 54| Sakhnin|\n| 55| Yehud|\n| 56| Baka al-Gharbiya|\n| 57| Ofakim|\n| 58| Givat Shmuel|\n| 59| Tira|\n| 60| Arad|\n| 61| Migdal Haemek|\n| 62| Sderot|\n| 63| Araba|\n| 64| Nesher|\n| 65| Kiryat Shmona|\n| 66| Yokneam Illit|\n| 67| Kafr Qassem|\n| 68| Kfar Yona|\n| 69| Qalansawa|\n| 70| Kiryat Malachi|\n| 71| Maalot-Tarshiha|\n| 72| Tirat Carmel|\n| 73| Ariel|\n| 74| Or Akiva|\n| 75| Bet Shean|\n| 76| Mizpe Ramon|\n| 77| Lod|\n| 78| Nazareth|\n| 79| Qazrin|\n| 80| En Gedi|\n| 200| Nimrod Fortress|\n| 201| Banias|\n| 202| Tel Dan|\n| 203| Snir Stream|\n| 204| Horshat Tal |\n| 205| Ayun Stream|\n| 206| Hula|\n| 207| Tel Hazor|\n| 208| Akhziv|\n| 209| Yehiam Fortress|\n| 210| Baram|\n| 211| Amud Stream|\n| 212| Korazim|\n| 213| Kfar Nahum|\n| 214| Majrase |\n| 215| Meshushim Stream|\n| 216| Yehudiya |\n| 217| Gamla|\n| 218| Kursi |\n| 219| Hamat Tiberias|\n| 220| Arbel|\n| 221| En Afek|\n| 222| Tzipori|\n| 223| Hai-Bar Carmel|\n| 224| Mount Carmel|\n| 225| Bet Shearim|\n| 226| Mishmar HaCarmel |\n| 227| Nahal Me\u2018arot|\n| 228| Dor-HaBonim|\n| 229| Tel Megiddo|\n| 230| Kokhav HaYarden|\n| 231| Maayan Harod|\n| 232| Bet Alpha|\n| 233| Gan HaShlosha|\n| 235| Taninim Stream|\n| 236| Caesarea|\n| 237| Tel Dor|\n| 238| Mikhmoret Sea Turtle|\n| 239| Beit Yanai|\n| 240| Apollonia|\n| 241| Mekorot HaYarkon|\n| 242| Palmahim|\n| 243| Castel|\n| 244| En Hemed|\n| 245| City of David|\n| 246| Me\u2018arat Soreq|\n| 248| Bet Guvrin|\n| 249| Sha\u2019ar HaGai|\n| 250| Migdal Tsedek|\n| 251| Haniya Spring|\n| 252| Sebastia|\n| 253| Mount Gerizim|\n| 254| Nebi Samuel|\n| 255| En Prat|\n| 256| En Mabo\u2018a|\n| 257| Qasr al-Yahud|\n| 258| Good Samaritan|\n| 259| Euthymius Monastery|\n| 261| Qumran|\n| 262| Enot Tsukim|\n| 263| Herodium|\n| 264| Tel Hebron|\n| 267| Masada |\n| 268| Tel Arad|\n| 269| Tel Beer Sheva|\n| 270| Eshkol|\n| 271| Mamshit|\n| 272| Shivta|\n| 273| Ben-Gurion\u2019s Tomb|\n| 274| En Avdat|\n| 275| Avdat|\n| 277| Hay-Bar Yotvata|\n| 278| Coral Beach| \n\n\n### Get Satellite and Radar Images\n\n```python\nfrom weatheril import *\nweather = WeatherIL(21,\"he\")\nimages = weather.get_radar_images()\n```\nThe get_radar_images will retun an object with four lists:\n* imsradar_images - Rain radar images (IMS).\n* radar_images - Radar images.\n* middle_east_satellite_images - Middel East weather sattelite images.\n* europe_satellite_images - Eourope weather sattelite images.\n\nYou can also create animateg gif from this images lists by using the create_animation method as follows:\n\n```python\nfrom weatheril import *\nweather = WeatherIL(21,\"he\")\nimages = weather.get_radar_images()\nanimated = images.create_animation(images = images.middle_east_satellite_images, animated_file = \"file.gif\", path=\"/tmp\")\n```\nThe function will return the path for the created image.\n\n**Optional**\nYou can use the following function to create animated gifs for all images\n\n```python\nfrom weatheril import *\nweather = WeatherIL(21,\"he\")\nimages = weather.get_radar_images()\nimages.generate_images(path=\"Path to store the images\")\n```\n\n\n[![Sattelite](https://github.com/t0mer/py-weatheril/blob/main/screenshots/animated.gif?raw=true \"Sattelite\")](https://github.com/t0mer/py-weatheril/blob/main/screenshots/animated.gif?raw=true \"Sattelite\")\n\n\n### Get current weather status for given location\n\n```python\nfrom weatheril import *\nweather = WeatherIL(21,\"he\")\ncurrent = weather.get_current_analysis()\n```\n\nThe result will be a weather object containing the data requested:\n* Location.\n* Humidity.\n* Rain.\n* Temperature.\n* Wind speed.\n* Feels like.\n* UV.\n* Time\n* Json result\n\n```json\n \"33\": {\n \"id\": \"1601809\",\n \"lid\": \"33\",\n \"forecast_time\": \"2023-01-25 16:00:00\",\n \"type\": \"analysis\",\n \"main_hour\": \"0\",\n \"heat_stress\": \"17\",\n \"relative_humidity\": \"58\",\n \"due_point_Temp\": \"11\",\n \"rain\": null,\n \"temperature\": \"20\",\n \"wind_direction_id\": \"15\",\n \"wind_speed\": \"2\",\n \"wind_chill\": \"20\",\n \"weather_code\": null,\n \"heat_stress_level\": \"0\",\n \"feels_like\": \"20\",\n \"min_temp\": null,\n \"max_temp\": null,\n \"modified\": \"2023-01-25 15:55:00\",\n \"created\": \"2023-01-22 11:50:05\",\n \"u_v_index\": \"0\",\n \"u_v_level\": \"L\",\n \"u_v_i_max\": null,\n \"u_v_i_factor\": null\n }\n```\n\n### Get weather forecast\n\n\n```python\nfrom weatheril import *\nweather = WeatherIL(21,\"he\")\nforcats = weather.get_forecast()\n```\n\nThis method wil return forecast object that includes weather forecast for the new 5 days. The object contains data on Coutry level and also on give location Forecast >> Daily >> Hourly.\n\n```python\n\nclass Forecast:\n days: list\n\nclass Daily:\n date: datetime\n location: str\n day: str\n weather: str\n minimum_temperature: int\n maximum_temperature: int\n maximum_uvi: int\n hours: list\n description: str\n\nclass Hourly:\n hour: str\n weather: str\n temperature: int\n\n\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Israel Meteorological Service unofficial python api wrapper",
"version": "0.34.0",
"project_urls": {
"Documentation": "https://github.com/t0mer/py-weatheril",
"Download": "https://pypi.org/project/weatheril/",
"Homepage": "https://github.com/t0mer/py-weatheril",
"Source": "https://github.com/t0mer/py-weatheril"
},
"split_keywords": [
"ims",
" weatheril",
" israel meteorological service",
" meteorological service",
" weather"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9b74bab84baede458c1ff5a25e77cfb2219f33cc35a67867771e4453a338680e",
"md5": "c3c271ead018a0c52bd1e673623526a9",
"sha256": "fcb8351af769fc97b0aed0b55d7635e43607466398fd037687d265925269fb77"
},
"downloads": -1,
"filename": "weatheril-0.34.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c3c271ead018a0c52bd1e673623526a9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 17964,
"upload_time": "2024-10-10T12:32:50",
"upload_time_iso_8601": "2024-10-10T12:32:50.130562Z",
"url": "https://files.pythonhosted.org/packages/9b/74/bab84baede458c1ff5a25e77cfb2219f33cc35a67867771e4453a338680e/weatheril-0.34.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e7081cc48a993ac961fb564f7c51ed92e94539df8c715a691afbe7bb7788701d",
"md5": "a284227808dce7ea25748291f3c09aa6",
"sha256": "6fc6db6f97aa8c3664966bd8ba667885d0a8f595a56131b37e6bf24c456a2253"
},
"downloads": -1,
"filename": "weatheril-0.34.0.tar.gz",
"has_sig": false,
"md5_digest": "a284227808dce7ea25748291f3c09aa6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 20331,
"upload_time": "2024-10-10T12:32:51",
"upload_time_iso_8601": "2024-10-10T12:32:51.177567Z",
"url": "https://files.pythonhosted.org/packages/e7/08/1cc48a993ac961fb564f7c51ed92e94539df8c715a691afbe7bb7788701d/weatheril-0.34.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-10 12:32:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "t0mer",
"github_project": "py-weatheril",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "weatheril"
}