Skip to main content

pyAEMET

PyPI Latest Release DOI License Downloads 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

$ 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.

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:

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.
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.
aemet.sites_in(subregion="Cantabria")

image

  • 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.
aemet.near_sites(latitude=43.47,
                 longitude=-3.798,
                 n_near=5, max_distance=50)

image

  • 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.

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

Metadata

Release files for pyaemet 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyaemet 1.1.1
File Size Uploaded Provenance Actions
pyaemet-1.1.1.tar.gz 2.1 MB Without provenance Details for pyaemet-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyaemet 1.1.1
File Interpreter ABI Platform Actions
pyaemet-1.1.1-py3-none-any.whl Python 3 none any Details for pyaemet-1.1.1-py3-none-any.whl

Total release size: 2.2 MB

Release files / pyaemet-1.1.1.tar.gz

Download URL pyaemet-1.1.1.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
9b2f351222974e50f0ee686a0bb22f1240d75d03d3842a315509e1abf9620543
BLAKE2b-256 checksum
How to use checksums
d19f3b551507d478ca06513dc9defa4fd75700f5fb4b38d4c7d4368fcfb8cba0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.8

Release files / pyaemet-1.1.1-py3-none-any.whl

Download URL pyaemet-1.1.1-py3-none-any.whl
Size 40.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e2ba2c95d12577bc369a89ea415fe1be94970516615f1900ec5d773303e1860
BLAKE2b-256 checksum
How to use checksums
d7221169328feb886b627b574e74d11c529987d27183dd29698eb2575e940431
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.8

Security for pyaemet 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page