pymeteoclimatic


Namepymeteoclimatic JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/adrianmo/pymeteoclimatic
SummaryA Python wrapper around the Meteoclimatic service
upload_time2024-01-08 12:05:19
maintainer
docs_urlNone
authorAdrián Moreno
requires_python>=3.8
licenseMIT
keywords meteoclimatic client library api weather
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyMeteoclimatic

A Python wrapper around the Meteoclimatic service.

[![](https://img.shields.io/pypi/v/pymeteoclimatic)](https://pypi.org/project/pymeteoclimatic/)
[![](https://img.shields.io/pypi/pyversions/pymeteoclimatic)](https://pypi.org/project/pymeteoclimatic/)
[![Coverage Status](https://coveralls.io/repos/github/adrianmo/pymeteoclimatic/badge.svg?branch=master)](https://coveralls.io/github/adrianmo/pymeteoclimatic?branch=master)
[![Build & Test](https://github.com/adrianmo/pymeteoclimatic/workflows/Build%20and%20Test/badge.svg)](https://github.com/adrianmo/pymeteoclimatic/actions?query=workflow%3A%22Build+and+Test%22)
[![Publish to Pypi](https://github.com/adrianmo/pymeteoclimatic/workflows/Publish%20to%20Pypi/badge.svg)](https://github.com/adrianmo/pymeteoclimatic/actions?query=workflow%3A%22Publish+to+Pypi%22)

PyMeteoclimatic is a client Python wrapper library for [Meteoclimatic](https://www.meteoclimatic.net). Meteoclimatic is a large network of non-professional automatic real-time weather stations and an important directory of weather resources. The geographical scope of Meteoclimatic comprises the Iberian Peninsula, the two Spanish archipelagos (the Balearic Islands and the Canary Islands), southern France and Africa near the Strait of Gibraltar.

PyMeteoclimatic relies on the [Meteoclimatic RSS feed](https://www.meteoclimatic.net/index/wp/rss_es.html). More specifically, PyMeteoclimatic leverages the coded, normalized data blocks included as HTML comments in the feeds between the `[[<BEGIN:identificador:DATA>]]` and `[[<END:identificador:DATA>]]` tags to obtain station weather information. 


## What data can I get?

With PyMeteoclimatic you can obtain weather information directly from Meteoclimatic stations identified by their code. You can find out the station code from the station profile page in the Meteoclimatic site.

When obtaining the weather information from a station, you will get a `meteoclimatic.Observation` object, which represents the weather which is currently being observed from a certain station and contains the following fields.

| Field | Type | Description |
| --- | --- | --- |
| `reception_time` | `datetime.datetime`     | Timestamp telling when the weather obervation has been received from the station |
| `station`        | `meteoclimatic.Station` | The *Station* relative to this observation |
| `weather`        | `meteoclimatic.Weather` | The *Weather* relative to this observation |

A `meteoclimatic.Station` object contains the following data.

| Field | Type  | Description |
| --- | --- | --- |
| `name` | `str` | Name of the station |
| `code` | `str` | Meteoclimatic code of the station (e.g. "ESCAT4300000043206B") |
| `url`  | `str` | URL of the Meteoclimatic station page |

A `meteoclimatic.Weather` object contains the following data. Note that not all stations have the same physical sensors and capabilities (e.g. pluviometer, barometer, ...), therefore, some of these values may be `None` for some stations. Check the Meteoclimatic station page for more information on your preferred station capabilities.

| Field | Type | Description |
| --- | --- | --- |
| `reference_time`   | `datetime.datetime` | Timestamp of weather measurement |
| `condition`        | `meteoclimatic.Condition` or `str` | Single-word weather condition (e.g. "sun", "suncloud", "rain", ...). If it's a recognized condition, it will be mapped to a value of the `meteoclimatic.Condition` enumerate, otherwise it will be stored as a string |
| `temp_current`     | `float` | Current temperature in Celsius |
| `temp_max`         | `float` | Maximum temperature in Celsius for the past 24 hours |
| `temp_min`         | `float` | Minimum temperature in Celsius for the past 24 hours |
| `humidity_current` | `float` | Current humidity in percentage points |
| `humidity_max`     | `float` | Maximum humidity in percentage points for the past 24 hours |
| `humidity_min`     | `float` | Minimum humidity in percentage points for the past 24 hours |
| `pressure_current` | `float` | Current atmospheric pressure in hPa units |
| `pressure_max`     | `float` | Maximum atmospheric pressure in hPa units for the past 24 hours |
| `pressure_min`     | `float` | Minimum atmospheric pressure in hPa units for the past 24 hours |
| `wind_current`     | `float` | Current wind speed in km/h units |
| `wind_max`         | `float` | Maximum wind speed in km/h units for the past 24 hours |
| `wind_bearing`     | `float` | Wind bearing in degree units |
| `rain`             | `float` | Precipitation in mm units for the past 24 hours |


## Installation

Install with `pip` for your ease.

```
$ pip install pymeteoclimatic
```

## Example

```python
from meteoclimatic import MeteoclimaticClient

client = MeteoclimaticClient()
observation = client.weather_at_station("ESCAT4300000043206B")

print("Timestamp")
print("~~~~~~~~~")
print(observation.reception_time)
print()
print("Station")
print("~~~~~~~")
print(observation.station)
print()
print("Weather")
print("~~~~~~~")
print(observation.weather)
```

Output:

```
Timestamp
~~~~~~~~~
2020-06-09 13:45:55+00:00

Station
~~~~~~~
<class 'meteoclimatic.station.Station'>({'name': 'Reus - Nord (Tarragona)', 'code': 'ESCAT4300000043206B', 'url': 'http://www.meteoclimatic.net/perfil/ESCAT4300000043206B'})

Weather
~~~~~~~
<class 'meteoclimatic.weather.Weather'>({'reference_time': datetime.datetime(2020, 6, 9, 13, 45, 55, tzinfo=datetime.timezone.utc), 'condition': <Condition.sun: 'sun'>, 'temp_current': 24.0, 'temp_max': 24.2, 'temp_min': 13.7, 'humidity_current': 45.0, 'humidity_max': 80.0, 'humidity_min': 44.0, 'pressure_current': 1013.5, 'pressure_max': 1015.3, 'pressure_min': 1013.5, 'wind_current': 13.0, 'wind_max': 31.0, 'wind_bearing': 232.0, 'rain': 0.2})
```

## Contributing

Please feel free to submit issues or fork the repository and send pull requests to update the library and fix bugs, implement support for new sentence types, refactor code, etc.

## License

[MIT License](https://github.com/adrianmo/pymeteoclimatic/blob/master/LICENSE)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/adrianmo/pymeteoclimatic",
    "name": "pymeteoclimatic",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "meteoclimatic client library api weather",
    "author": "Adri\u00e1n Moreno",
    "author_email": "adrian@morenomartinez.com",
    "download_url": "https://files.pythonhosted.org/packages/ce/75/fb57cb65cde92a814a3c5cc3378c9e5072a0d6a217f52000381997266342/pymeteoclimatic-0.1.0.tar.gz",
    "platform": null,
    "description": "# PyMeteoclimatic\n\nA Python wrapper around the Meteoclimatic service.\n\n[![](https://img.shields.io/pypi/v/pymeteoclimatic)](https://pypi.org/project/pymeteoclimatic/)\n[![](https://img.shields.io/pypi/pyversions/pymeteoclimatic)](https://pypi.org/project/pymeteoclimatic/)\n[![Coverage Status](https://coveralls.io/repos/github/adrianmo/pymeteoclimatic/badge.svg?branch=master)](https://coveralls.io/github/adrianmo/pymeteoclimatic?branch=master)\n[![Build & Test](https://github.com/adrianmo/pymeteoclimatic/workflows/Build%20and%20Test/badge.svg)](https://github.com/adrianmo/pymeteoclimatic/actions?query=workflow%3A%22Build+and+Test%22)\n[![Publish to Pypi](https://github.com/adrianmo/pymeteoclimatic/workflows/Publish%20to%20Pypi/badge.svg)](https://github.com/adrianmo/pymeteoclimatic/actions?query=workflow%3A%22Publish+to+Pypi%22)\n\nPyMeteoclimatic is a client Python wrapper library for [Meteoclimatic](https://www.meteoclimatic.net). Meteoclimatic is a large network of non-professional automatic real-time weather stations and an important directory of weather resources. The geographical scope of Meteoclimatic comprises the Iberian Peninsula, the two Spanish archipelagos (the Balearic Islands and the Canary Islands), southern France and Africa near the Strait of Gibraltar.\n\nPyMeteoclimatic relies on the [Meteoclimatic RSS feed](https://www.meteoclimatic.net/index/wp/rss_es.html). More specifically, PyMeteoclimatic leverages the coded, normalized data blocks included as HTML comments in the feeds between the `[[<BEGIN:identificador:DATA>]]` and `[[<END:identificador:DATA>]]` tags to obtain station weather information. \n\n\n## What data can I get?\n\nWith PyMeteoclimatic you can obtain weather information directly from Meteoclimatic stations identified by their code. You can find out the station code from the station profile page in the Meteoclimatic site.\n\nWhen obtaining the weather information from a station, you will get a `meteoclimatic.Observation` object, which represents the weather which is currently being observed from a certain station and contains the following fields.\n\n| Field | Type | Description |\n| --- | --- | --- |\n| `reception_time` | `datetime.datetime`     | Timestamp telling when the weather obervation has been received from the station |\n| `station`        | `meteoclimatic.Station` | The *Station* relative to this observation |\n| `weather`        | `meteoclimatic.Weather` | The *Weather* relative to this observation |\n\nA `meteoclimatic.Station` object contains the following data.\n\n| Field | Type  | Description |\n| --- | --- | --- |\n| `name` | `str` | Name of the station |\n| `code` | `str` | Meteoclimatic code of the station (e.g. \"ESCAT4300000043206B\") |\n| `url`  | `str` | URL of the Meteoclimatic station page |\n\nA `meteoclimatic.Weather` object contains the following data. Note that not all stations have the same physical sensors and capabilities (e.g. pluviometer, barometer, ...), therefore, some of these values may be `None` for some stations. Check the Meteoclimatic station page for more information on your preferred station capabilities.\n\n| Field | Type | Description |\n| --- | --- | --- |\n| `reference_time`   | `datetime.datetime` | Timestamp of weather measurement |\n| `condition`        | `meteoclimatic.Condition` or `str` | Single-word weather condition (e.g. \"sun\", \"suncloud\", \"rain\", ...). If it's a recognized condition, it will be mapped to a value of the `meteoclimatic.Condition` enumerate, otherwise it will be stored as a string |\n| `temp_current`     | `float` | Current temperature in Celsius |\n| `temp_max`         | `float` | Maximum temperature in Celsius for the past 24 hours |\n| `temp_min`         | `float` | Minimum temperature in Celsius for the past 24 hours |\n| `humidity_current` | `float` | Current humidity in percentage points |\n| `humidity_max`     | `float` | Maximum humidity in percentage points for the past 24 hours |\n| `humidity_min`     | `float` | Minimum humidity in percentage points for the past 24 hours |\n| `pressure_current` | `float` | Current atmospheric pressure in hPa units |\n| `pressure_max`     | `float` | Maximum atmospheric pressure in hPa units for the past 24 hours |\n| `pressure_min`     | `float` | Minimum atmospheric pressure in hPa units for the past 24 hours |\n| `wind_current`     | `float` | Current wind speed in km/h units |\n| `wind_max`         | `float` | Maximum wind speed in km/h units for the past 24 hours |\n| `wind_bearing`     | `float` | Wind bearing in degree units |\n| `rain`             | `float` | Precipitation in mm units for the past 24 hours |\n\n\n## Installation\n\nInstall with `pip` for your ease.\n\n```\n$ pip install pymeteoclimatic\n```\n\n## Example\n\n```python\nfrom meteoclimatic import MeteoclimaticClient\n\nclient = MeteoclimaticClient()\nobservation = client.weather_at_station(\"ESCAT4300000043206B\")\n\nprint(\"Timestamp\")\nprint(\"~~~~~~~~~\")\nprint(observation.reception_time)\nprint()\nprint(\"Station\")\nprint(\"~~~~~~~\")\nprint(observation.station)\nprint()\nprint(\"Weather\")\nprint(\"~~~~~~~\")\nprint(observation.weather)\n```\n\nOutput:\n\n```\nTimestamp\n~~~~~~~~~\n2020-06-09 13:45:55+00:00\n\nStation\n~~~~~~~\n<class 'meteoclimatic.station.Station'>({'name': 'Reus - Nord (Tarragona)', 'code': 'ESCAT4300000043206B', 'url': 'http://www.meteoclimatic.net/perfil/ESCAT4300000043206B'})\n\nWeather\n~~~~~~~\n<class 'meteoclimatic.weather.Weather'>({'reference_time': datetime.datetime(2020, 6, 9, 13, 45, 55, tzinfo=datetime.timezone.utc), 'condition': <Condition.sun: 'sun'>, 'temp_current': 24.0, 'temp_max': 24.2, 'temp_min': 13.7, 'humidity_current': 45.0, 'humidity_max': 80.0, 'humidity_min': 44.0, 'pressure_current': 1013.5, 'pressure_max': 1015.3, 'pressure_min': 1013.5, 'wind_current': 13.0, 'wind_max': 31.0, 'wind_bearing': 232.0, 'rain': 0.2})\n```\n\n## Contributing\n\nPlease feel free to submit issues or fork the repository and send pull requests to update the library and fix bugs, implement support for new sentence types, refactor code, etc.\n\n## License\n\n[MIT License](https://github.com/adrianmo/pymeteoclimatic/blob/master/LICENSE)\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python wrapper around the Meteoclimatic service",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/adrianmo/pymeteoclimatic"
    },
    "split_keywords": [
        "meteoclimatic",
        "client",
        "library",
        "api",
        "weather"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "60dc548e73f8042293f3a36fc17295bbcc30b34c5185c62fa5ad1e8e9825a39a",
                "md5": "1ddab47a6267eeda270168db13e860c4",
                "sha256": "4dd70f5f86f9835ed6f1733aa2ad0f36283355157e35e8fce4de0a2658c69140"
            },
            "downloads": -1,
            "filename": "pymeteoclimatic-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1ddab47a6267eeda270168db13e860c4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9715,
            "upload_time": "2024-01-08T12:05:17",
            "upload_time_iso_8601": "2024-01-08T12:05:17.719642Z",
            "url": "https://files.pythonhosted.org/packages/60/dc/548e73f8042293f3a36fc17295bbcc30b34c5185c62fa5ad1e8e9825a39a/pymeteoclimatic-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce75fb57cb65cde92a814a3c5cc3378c9e5072a0d6a217f52000381997266342",
                "md5": "9b910e8dbc1572932333e643d29b633f",
                "sha256": "bf06b7b3f5ee53fac095f52acaaf089325c3cb3236247e3c550f1ccc68af067f"
            },
            "downloads": -1,
            "filename": "pymeteoclimatic-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9b910e8dbc1572932333e643d29b633f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9972,
            "upload_time": "2024-01-08T12:05:19",
            "upload_time_iso_8601": "2024-01-08T12:05:19.370034Z",
            "url": "https://files.pythonhosted.org/packages/ce/75/fb57cb65cde92a814a3c5cc3378c9e5072a0d6a217f52000381997266342/pymeteoclimatic-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-08 12:05:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "adrianmo",
    "github_project": "pymeteoclimatic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pymeteoclimatic"
}
        
Elapsed time: 0.40123s