Skip to main content

A Python toolkit for climate data processing and analysis

Project description

climalab

Python Version License PyPI Version

climalab is a Python toolkit designed to facilitate climate data analysis and manipulation, including tools for data extraction, processing, and visualization. It leverages external tools and standards like CDO and CDS to streamline workflows for climate-related research.

Features

  • Meteorological Tools:
    • Comprehensive handling of meteorological variables and data
    • Weather software input file generation
    • Variable conversion and standardisation utilities
  • NetCDF Tools:
    • Advanced CDO operations for netCDF file manipulation
    • NCO tools for efficient data processing
    • Faulty file detection and reporting
    • Basic information extraction from netCDF files
  • Supplementary Analysis Tools:
    • Visualisation tools for maps and basic plots
    • Bias correction methods (parametric and non-parametric quantile mapping)
    • Statistical analysis tools
    • Auxiliary functions for data processing
  • Project Structure:
    • Sample project templates for data analysis workflows
    • Standardised directory organisation
    • Version control and changelog management

Installation

Prerequisites

Before installing, please ensure the following dependencies are available on your system:

  • Required Third-Party Libraries:

    pip install numpy pandas scipy cdsapi PyYAML
    

    Or via Anaconda (recommended channel: conda-forge):

    conda install -c conda-forge numpy pandas scipy cdsapi pyyaml
    
  • Other Internal Packages:

    pip install filewise paramlib pygenutils
    

Installation (from PyPI)

Install the package using pip:

pip install climalab

Development Installation

For development purposes, you can install the package in editable mode:

git clone https://github.com/yourusername/climalab.git
cd climalab
pip install -e .

Usage

Basic Example

from climalab.meteorological import variables
from climalab.netcdf_tools import cdo_tools

# Convert temperature from Kelvin to Celsius
temp_celsius = variables.convert_temperature(temp_kelvin, 'K', 'C')

# Process netCDF files using CDO
cdo_tools.merge_files(input_files, output_file)

Advanced Example

from climalab.supplementary_tools import bias_correction
from climalab.netcdf_tools import nco_tools

# Apply quantile mapping bias correction
corrected_data = bias_correction.quantile_mapping(
    obs_data, model_data, future_data
)

# Extract specific variables from netCDF files
nco_tools.extract_variables(input_file, output_file, ['tas', 'pr'])

Project Structure

The package is organised into several sub-packages:

climalab/
├── meteorological/
│   ├── variables.py
│   └── weather_software.py
├── netcdf_tools/
│   ├── cdo_tools.py
│   ├── nco_tools.py
│   ├── detect_faulty.py
│   └── extract_basics.py
├── supplementary_tools/
│   ├── bias_correction/
│   ├── plotting/
│   └── statistics/
└── data_analysis_projects_sample/

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Climate Data Operators (CDO) team
  • Copernicus Climate Data Store (CDS)
  • NetCDF Operators (NCO) team

Contact

For any questions or suggestions, please open an issue on GitHub or contact the maintainers.

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

climalab-4.3.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

climalab-4.3.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file climalab-4.3.1.tar.gz.

File metadata

  • Download URL: climalab-4.3.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for climalab-4.3.1.tar.gz
Algorithm Hash digest
SHA256 b26b67979c6883a1e92083de302263d483942c9db2725f203ba2dc15d957a9a8
MD5 d0e3b0ff1548c44380b9c5ec75ed5f35
BLAKE2b-256 c8d2a0a810aad033c8bab353e16beacac46c74b4104e0874fd146bbbe5d108d6

See more details on using hashes here.

File details

Details for the file climalab-4.3.1-py3-none-any.whl.

File metadata

  • Download URL: climalab-4.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for climalab-4.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f60872a5b99d42cf49c0bd3ce8ec7558893e87cccef0471cb25190c8482956f
MD5 fb4bbc10e48748c79e6755268cc8fa07
BLAKE2b-256 775a6516657d044fc2370247e9fffced8a2869bdc4fd30855961d6600691a919

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