pyaemet


Namepyaemet JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/jaimedgp/pyAEMET
SummaryPython module to interact with the AEMET API to download meteorological data
upload_time2023-04-27 20:11:55
maintainerCarmenGBM
docs_urlNone
authorJaimedgp
requires_python>=3.8,<4.0
licenseGPL-3.0-or-later
keywords aemet meteorology api aemet opendata
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyAEMET


[![PyPI Latest Release](https://img.shields.io/pypi/v/pyaemet.svg)](https://pypi.org/project/pyaemet/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5655307.svg)](https://doi.org/10.5281/zenodo.5655307)
[![License](https://img.shields.io/pypi/l/pandas.svg)](https://github.com/jaimedgp/pyAEMET/blob/main/LICENSE)
[![Downloads](https://static.pepy.tech/personalized-badge/pyaemet?period=month&units=international_system&left_color=gray&right_color=orange&left_text=PyPI%20downloads%20per%20month)](https://pepy.tech/project/pyaemet)

A python library developed to download daily climatological values from the Spanish National
Meteorological Agency (AEMET) through its OpenData API. The library contains several methods
to facilitate downloading and filtering the climatological data.

> The information that this library collects and uses is property of the Spanish State
> Meteorological Agency, available through its AEMET OpenData REST API.


## Installation
``` bash
$ pip install pyaemet
```
To use the pyAEMET module, you need to get an API key from the AEMET (Spanish State Meteorological
Agency) OpenData platform. You can apply for a key [here](https://opendata.aemet.es/centrodedescargas/altaUsuario).

## Usage

Once the module is installed and you have your API key, you can start using the module by
importing it in your Python script. To use the module's functions, you need to initialize
the client with your API key:

```python
import pyaemet

aemet = pyaemet.AemetClima(api_key)
```

The `AemetClima` class takes an API key as a parameter in its constructor and allows you to get
information about the available monitoring sites, filter sites based on different parameters
(e.g., city, province, autonomous community), and get nearby sites to a specific location.

Here is a summary of some of the methods provided by the `AemetClima` class:

* **`sites_info`**: Retrieves information about all the available monitoring sites. The method
returns an instance of the `SitesDataFrame` class, which is a subclass of the pandas `DataFrame`.
```python
aemet.sites_info(update=True)
```

* **`sites_in`**: Filters the available monitoring sites based on specified parameters
(e.g., city, province, autonomous community). The method returns an instance of the `SitesDataFrame` class.
```python
aemet.sites_in(subregion="Cantabria")
```
![image](https://github.com/Jaimedgp/pyAEMET/raw/main/docs/screenshots/sites_cantabria.png)

* **`near_sites`**: Retrieves the ``n_near`` monitoring sites closest to a specified latitude and longitude,
within a maximum distance of `max_distance` kilometers. The method returns an instance of the
`NearSitesDataFrame` class.
```python
aemet.near_sites(latitude=43.47,
                 longitude=-3.798,
                 n_near=5, max_distance=50)
```
![image](https://github.com/Jaimedgp/pyAEMET/raw/main/docs/screenshots/near_sites.png)

* **`sites_curation`**: Retrieves the amount of available data of certain `variables` in the monitoring `sites` in a period of time defined by
    `start_dt` and `end_dt`. The function returns a `SitesDataFrame` or `NearSitesDataFrame` (depends of the type of the `sites` parameter given)
    with a column with the average `amount` between all `variables` and `has_enough` boolean if the amount is greater or equal to a `threshold`.

* **`daily_clima`**: Retrieves daily climate data for a given ``site`` or a list of sites over a
specified date range defined by `start_dt` and `end_dt`. The function returns a
`ObservationsDataFrame` object, which is a data structure that holds the retrieved climate data
along with any associated metadata.
```python
import datetime
aemet.daily_clima(site=aemet.sites_in(city="Santander"),
                  start_dt=datetime.date(2022, 6, 3),
                  end_dt=datetime.date.today())
```

The module also provides three deprecated methods `estaciones_info`, `estaciones_loc` and `clima_diaria`
that perform similar functionality as the `sites_info`, `sites_in` and `daily_clima` methods, respectively.

You can find the complete documentation of the module's functions in the GitHub repository,
under the docs directory.

## FAQ
## Contributing
## References
* ["Estimating changes in air pollutant levels due to COVID-19 lockdown measures based on a business-as-usual prediction scenario using data mining models: A case-study for urban traffic sites in Spain"](https://doi.org/10.1016/j.scitotenv.2022.153786), submitted to Environmental Software & Modelling by [J. González-Pardo](https://orcid.org/0000-0001-7268-9933) et al. (2021)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jaimedgp/pyAEMET",
    "name": "pyaemet",
    "maintainer": "CarmenGBM",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "carmen.garcia.be96@gmail.com",
    "keywords": "AEMET,Meteorology,API,AEMET OpenData",
    "author": "Jaimedgp",
    "author_email": "jaime.diez.gp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/16/69/95c309d2c67d1b62f3fd1883ffe4c08e2ba940472545a246f8ae76f53ce7/pyaemet-1.1.0.tar.gz",
    "platform": null,
    "description": "# pyAEMET\n\n\n[![PyPI Latest Release](https://img.shields.io/pypi/v/pyaemet.svg)](https://pypi.org/project/pyaemet/)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5655307.svg)](https://doi.org/10.5281/zenodo.5655307)\n[![License](https://img.shields.io/pypi/l/pandas.svg)](https://github.com/jaimedgp/pyAEMET/blob/main/LICENSE)\n[![Downloads](https://static.pepy.tech/personalized-badge/pyaemet?period=month&units=international_system&left_color=gray&right_color=orange&left_text=PyPI%20downloads%20per%20month)](https://pepy.tech/project/pyaemet)\n\nA python library developed to download daily climatological values from the Spanish National\nMeteorological Agency (AEMET) through its OpenData API. The library contains several methods\nto facilitate downloading and filtering the climatological data.\n\n> The information that this library collects and uses is property of the Spanish State\n> Meteorological Agency, available through its AEMET OpenData REST API.\n\n\n## Installation\n``` bash\n$ pip install pyaemet\n```\nTo use the pyAEMET module, you need to get an API key from the AEMET (Spanish State Meteorological\nAgency) OpenData platform. You can apply for a key [here](https://opendata.aemet.es/centrodedescargas/altaUsuario).\n\n## Usage\n\nOnce the module is installed and you have your API key, you can start using the module by\nimporting it in your Python script. To use the module's functions, you need to initialize\nthe client with your API key:\n\n```python\nimport pyaemet\n\naemet = pyaemet.AemetClima(api_key)\n```\n\nThe `AemetClima` class takes an API key as a parameter in its constructor and allows you to get\ninformation about the available monitoring sites, filter sites based on different parameters\n(e.g., city, province, autonomous community), and get nearby sites to a specific location.\n\nHere is a summary of some of the methods provided by the `AemetClima` class:\n\n* **`sites_info`**: Retrieves information about all the available monitoring sites. The method\nreturns an instance of the `SitesDataFrame` class, which is a subclass of the pandas `DataFrame`.\n```python\naemet.sites_info(update=True)\n```\n\n* **`sites_in`**: Filters the available monitoring sites based on specified parameters\n(e.g., city, province, autonomous community). The method returns an instance of the `SitesDataFrame` class.\n```python\naemet.sites_in(subregion=\"Cantabria\")\n```\n![image](https://github.com/Jaimedgp/pyAEMET/raw/main/docs/screenshots/sites_cantabria.png)\n\n* **`near_sites`**: Retrieves the ``n_near`` monitoring sites closest to a specified latitude and longitude,\nwithin a maximum distance of `max_distance` kilometers. The method returns an instance of the\n`NearSitesDataFrame` class.\n```python\naemet.near_sites(latitude=43.47,\n                 longitude=-3.798,\n                 n_near=5, max_distance=50)\n```\n![image](https://github.com/Jaimedgp/pyAEMET/raw/main/docs/screenshots/near_sites.png)\n\n* **`sites_curation`**: Retrieves the amount of available data of certain `variables` in the monitoring `sites` in a period of time defined by\n    `start_dt` and `end_dt`. The function returns a `SitesDataFrame` or `NearSitesDataFrame` (depends of the type of the `sites` parameter given)\n    with a column with the average `amount` between all `variables` and `has_enough` boolean if the amount is greater or equal to a `threshold`.\n\n* **`daily_clima`**: Retrieves daily climate data for a given ``site`` or a list of sites over a\nspecified date range defined by `start_dt` and `end_dt`. The function returns a\n`ObservationsDataFrame` object, which is a data structure that holds the retrieved climate data\nalong with any associated metadata.\n```python\nimport datetime\naemet.daily_clima(site=aemet.sites_in(city=\"Santander\"),\n                  start_dt=datetime.date(2022, 6, 3),\n                  end_dt=datetime.date.today())\n```\n\nThe module also provides three deprecated methods `estaciones_info`, `estaciones_loc` and `clima_diaria`\nthat perform similar functionality as the `sites_info`, `sites_in` and `daily_clima` methods, respectively.\n\nYou can find the complete documentation of the module's functions in the GitHub repository,\nunder the docs directory.\n\n## FAQ\n## Contributing\n## References\n* [\"Estimating changes in air pollutant levels due to COVID-19 lockdown measures based on a business-as-usual prediction scenario using data mining models: A case-study for urban traffic sites in Spain\"](https://doi.org/10.1016/j.scitotenv.2022.153786), submitted to Environmental Software & Modelling by [J. Gonz\u00e1lez-Pardo](https://orcid.org/0000-0001-7268-9933) et al. (2021)\n\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Python module to interact with the AEMET API to download meteorological data",
    "version": "1.1.0",
    "split_keywords": [
        "aemet",
        "meteorology",
        "api",
        "aemet opendata"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9283db27154ca8fbaed51dff13fb102c14f3abc1a77833e40f23e6f50c55d5ba",
                "md5": "060b5036f389d84435639454cf557cc0",
                "sha256": "36260b6516a4a6ed42514cd8ac02e6ffc3ed12327c55797a6f1476805c1e53fe"
            },
            "downloads": -1,
            "filename": "pyaemet-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "060b5036f389d84435639454cf557cc0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 52742,
            "upload_time": "2023-04-27T20:11:51",
            "upload_time_iso_8601": "2023-04-27T20:11:51.771462Z",
            "url": "https://files.pythonhosted.org/packages/92/83/db27154ca8fbaed51dff13fb102c14f3abc1a77833e40f23e6f50c55d5ba/pyaemet-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "166995c309d2c67d1b62f3fd1883ffe4c08e2ba940472545a246f8ae76f53ce7",
                "md5": "61b8d08416a0772e9e9ec3707a7b8ba0",
                "sha256": "b9884a9b759d8191199673a7cfade46621fa04d09b42b99ffc5f68ab066a4b42"
            },
            "downloads": -1,
            "filename": "pyaemet-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "61b8d08416a0772e9e9ec3707a7b8ba0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 39935,
            "upload_time": "2023-04-27T20:11:55",
            "upload_time_iso_8601": "2023-04-27T20:11:55.567464Z",
            "url": "https://files.pythonhosted.org/packages/16/69/95c309d2c67d1b62f3fd1883ffe4c08e2ba940472545a246f8ae76f53ce7/pyaemet-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-27 20:11:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "jaimedgp",
    "github_project": "pyAEMET",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyaemet"
}
        
Elapsed time: 0.12163s