Skip to main content

CAVA Python package. Retrive and analyze climate data.

Project description

Introduction

cavapy is a Python library that allows retrieval of climate data hosted in THREDDS servers at the University of Cantabria thanks to the CAVA project.

Data source

The climate data is available at the THREDDS data server of the University of Cantabria as part of the CAVA (Climate and Agriculture Risk Visualization and Assessment) product developed by FAO, the University of Cantabria, the University of Cape Town and Predictia. CAVA has available CORDEX-CORE climate models, the high resolution (25 Km) dynamically-downscaled climate models used in the IPCC report AR5. Additionally, CAVA offers access to state-of-the-art reanalyses datasets, such as ERA5 and the observational dataset W5E5 v2.

The currently available data is:

  • CORDEX-CORE simulations (3 GCMs donwscaled with 2 RCMs for two RCPs)
  • W5E5 and ERA5 datasets

Available variables:

  • Daily maximum temperature (tasmax) (°C)
  • Daily minimum temperature (tasmin) (°C)
  • Daily precipitation (pr) (mm)
  • Daily relative humidity (hurs) (%)
  • Daily wind speed (sfcWind) (2 m level m/s)
  • Daily solar radiation (rsds) (W/m^2)

Installation

cavapy can be installed with pip. Ensure that you are not using a python version > 13.

conda create -n test python=3.11
conda activate test
pip install cavapy

Process

The get_climate_data function performs automatically:

  • Data retrieval in parallel
  • Unit conversion
  • Convert into a Gregorian calendar (CORDEX-CORE models do not have a full 365 days calendar) through linear interpolation
  • Bias correction using the empirical quantile mapping (optional)

Example usage

Depending on the interest, downloading climate data can be done in a few different ways. Note that GCM stands for General Circulation Model while RCP stands for Regional Climate Model. As the climate data comes from the CORDEX-CORE initiative, users can choose between 3 different GCMs downscaled with two RCMs. In total, there are six simulations for any given domain (except for CAS-22 where only three are available). Since bias-correction requires both the historical run of the CORDEX model and the observational dataset (in this case ERA5), even when the historical argument is set to False, the historical run will be used for learning the bias correction factor.

It takes about 10 minutes to run each of the tasks below. For bigger areas/country, the computational time increases. For example, for Zambia it takes about 30 minutes.

Bias-corrected climate projections

import cavapy
Togo_climate_data = cavapy.get_climate_data(country="Togo", cordex_domain="AFR-22", rcp="rcp26", gcm="MPI", rcm="REMO", years_up_to=2030, obs=False, bias_correction=True, historical=False)

Non bias-corrected climate projections

import cavapy
Togo_climate_data = cavapy.get_climate_data(country="Togo", cordex_domain="AFR-22", rcp="rcp26", gcm="MPI", rcm="REMO", years_up_to=2030, obs=False, bias_correction=False, historical=False)

Bias-corrected climate projections plus the historical run

This is useful when assessing changes in crop yield from the historical period. In this case, we provide the bias-corrected historical run of the climate models plus the bias-corrected projections.

import cavapy
Togo_climate_data = cavapy.get_climate_data(country="Togo", cordex_domain="AFR-22", rcp="rcp26", gcm="MPI", rcm="REMO", years_up_to=2030, obs=False, bias_correction=True, historical=True)

Observations only (ERA5)

import cavapy
Togo_climate_data = cavapy.get_climate_data(country="Togo", cordex_domain="AFR-22", rcp="rcp26", gcm="MPI", rcm="REMO", years_up_to=2030, obs=True, bias_correction=True, historical=True, years_obs=range(1980,2019))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cavapy-0.1.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cavapy-0.1.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file cavapy-0.1.1.tar.gz.

File metadata

  • Download URL: cavapy-0.1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.11.11 Windows/10

File hashes

Hashes for cavapy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a23393d0b5162eb87cf0a55038220b9f4ead73d0214226d5058e5690fd8c3253
MD5 dafd35a2dc97e5b2165191f541de6ba6
BLAKE2b-256 41fb47b4d218bcbfe66834a64f88534d47f719dccb436a7ba2ccf9c997388014

See more details on using hashes here.

File details

Details for the file cavapy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cavapy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.11.11 Windows/10

File hashes

Hashes for cavapy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf9713420aef6af7efc112a8680325dffa1d552533c15bcc973d1ed411766d22
MD5 8cb228a54509c7465d927bda09528a14
BLAKE2b-256 ce1fea77df9745e6504b41b4e3bb775d004ccbdfe9a7678ae1845c74d9d29bac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page