Tool for climate data research
Project description
🌍 climatrix
Climatrix is a flexible toolbox for sampling and reconstructing climate datasets.
It provides utilities and an xarray accessor that simplifies the workflow of working with climate data arrays — from preprocessing to statistical sampling.
👤 Author
- Name: Jakub Walczak
- GitHub: @jamesWalczak
- Email: jakub.walczak@p.lodz.pl
👥 Contributors
- Name: Wojciech Żyndul
- GitHub: @wzyndul
- Email: 242575@edu.p.lodz.pl
📌 Version
Important This is an alpha release – features are still evolving, and breaking changes may occur.
📚 Table of Contents
⚙️ Usage
Getting started and API reference are available in the official documentation.
🧪 Examples
🔍 Click to expand example: Accessing `climatrix` features
import climatrix as cm
import xarray as xr
my_dataset = "/file/to/netcdf.nc
cm_dset = xr.open_dataset(my_dataset).cm
📊 Click to expand example: Getting values of coordinate
import climatrix as cm
import xarray as xr
my_dataset = "/file/to/netcdf.nc"
cm_dset = xr.open_dataset(my_dataset).cm
print("Latitude values: ", cm_dset.latitude)
print("Time values: ", cm_dset.time)
📊 Subsetting by bounding box
import climatrix as cm
import xarray as xr
my_dataset = "/file/to/netcdf.nc
cm_dset = xr.open_dataset(my_dataset).cm
europe = cm_dset.cm.subset(north=71, south=36, west=-24, east=35)
🛠️ Features
- 🧭 Easy access to coordinate data (similar to MetPy), using regex to locate lat/lon
- 📊 Sampling of climate data, both uniformly and using normal-like distributions
- 🔁 Reconstruction via:
- IDW (Inverse Distance Weighting)
- Ordinary Kriging
- SIREN (Sinusoidal INR)
- 🧪 Tools to compare reconstruction results
- 📈 Plotting utilities for visualizing inputs and outputs
- 🔧 Hyperparameter Optimization
🔧 Hyperparameter Optimization
Climatrix provides automated hyperparameter optimization for all reconstruction methods using Bayesian optimization. The HParamFinder class offers an intuitive interface for finding optimal parameters.
Quick Start
from climatrix.optim import HParamFinder
# Basic usage - optimize IDW parameters
finder = HParamFinder(train_dataset, validation_dataset, method="idw")
result = finder.optimize()
best_params = result['best_params']
# Use optimized parameters for reconstruction
optimized_reconstruction = train_dataset.reconstruct(
target=test_domain,
method="idw",
**best_params
)
Advanced Usage
# Optimize specific parameters only
finder = HParamFinder(
train_dataset, validation_dataset,
method="sinet",
include=["lr", "batch_size"], # Only optimize these parameters
exclude=["k"], # Or exclude specific parameters
metric="rmse", # Optimization metric (mae, mse, rmse)
explore=0.7, # Exploration vs exploitation (0-1)
n_iters=50, # Total optimization iterations
random_seed=123 # For reproducible results
)
result = finder.optimize()
print(f"Best parameters: {result['best_params']}")
print(f"Best {result['metric_name']} score: {result['best_score']}")
Installation
The hyperparameter optimization feature requires the bayesian-optimization package:
pip install climatrix[optim]
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
👥 Contributing
The rules for contributing on the project are described in CONTRIBUTING file in details.
🙏 Citation
If you are using this software in scientific work, cite us:
@article{walczak2025climatrix,
title={Climatrix: Xarray accessor for climate data sampling and reconstruction},
author={Walczak, Jakub and {\.Z}yndul, Wojciech},
journal={SoftwareX},
volume={31},
pages={102263},
year={2025},
publisher={Elsevier}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file climatrix-1.0a24.tar.gz.
File metadata
- Download URL: climatrix-1.0a24.tar.gz
- Upload date:
- Size: 6.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f9306e5dcc86ca9a582dbe543f2d7cc9c34200b262ff50a34aa7c89561cb168
|
|
| MD5 |
bf3252ae5c1a58fa81c4688c13601130
|
|
| BLAKE2b-256 |
496567b5611985dd6090755e17e947ac0876bca69f95727904ae3d4649dd0bcf
|
Provenance
The following attestation bundles were made for climatrix-1.0a24.tar.gz:
Publisher:
release_pypi.yml on jamesWalczak/climatrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
climatrix-1.0a24.tar.gz -
Subject digest:
5f9306e5dcc86ca9a582dbe543f2d7cc9c34200b262ff50a34aa7c89561cb168 - Sigstore transparency entry: 499463930
- Sigstore integration time:
-
Permalink:
jamesWalczak/climatrix@64fcc99897c456848d907f87e36103f067e68cab -
Branch / Tag:
refs/tags/v1.0a24 - Owner: https://github.com/jamesWalczak
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release_pypi.yml@64fcc99897c456848d907f87e36103f067e68cab -
Trigger Event:
release
-
Statement type:
File details
Details for the file climatrix-1.0a24-py3-none-any.whl.
File metadata
- Download URL: climatrix-1.0a24-py3-none-any.whl
- Upload date:
- Size: 134.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bbaf1d50409f8ef59e01a9670e5feb9c3be125cc07d376c3c4fa7fba8aa68e4
|
|
| MD5 |
719333af83b6b784cdf4cfa4cc191ca2
|
|
| BLAKE2b-256 |
3267cfabcebe51ca938923e743dbdf33053453cc104c49593bb7b16d9865c0f8
|
Provenance
The following attestation bundles were made for climatrix-1.0a24-py3-none-any.whl:
Publisher:
release_pypi.yml on jamesWalczak/climatrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
climatrix-1.0a24-py3-none-any.whl -
Subject digest:
9bbaf1d50409f8ef59e01a9670e5feb9c3be125cc07d376c3c4fa7fba8aa68e4 - Sigstore transparency entry: 499463966
- Sigstore integration time:
-
Permalink:
jamesWalczak/climatrix@64fcc99897c456848d907f87e36103f067e68cab -
Branch / Tag:
refs/tags/v1.0a24 - Owner: https://github.com/jamesWalczak
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release_pypi.yml@64fcc99897c456848d907f87e36103f067e68cab -
Trigger Event:
release
-
Statement type: