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.4.0.tar.gz (23.1 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.4.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for climalab-4.4.0.tar.gz
Algorithm Hash digest
SHA256 24a76556d37364a40b18bbd6148ea685f445d3b0c64bacef28f6485ea968ff82
MD5 72dc5b27e43125f0b786ce2514ef1670
BLAKE2b-256 eb600c9b700bd4f9ce994e16ff8775ea325fc890afbe143ea60164c077cf8d5c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for climalab-4.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c30435f3116f45e956e05b64477ea8b761ee2e307036ab9574834e2fa3aabdb
MD5 59bda9fbe213258c14d77f5a718f5d93
BLAKE2b-256 1b5130fecc7902f77754cbfd9445e14fd6b4e8f4b9652fff188c49231b6d8f0e

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