Testing Philosophy (Read This First)
Each module in IPSL-AID comes with its own dedicated tests.
The repository currently includes test suites for:
IPSL_AID, covering diffusion-based climate downscaling;AID_BC, covering bias correction using Quantile Mapping and Optimal Transport.
Before running large-scale training or bias-correction experiments, users are strongly encouraged to:
Explore the test suite
Understand data handling and normalization
Validate diffusion and architecture choices
Tune hyperparameters using small debug runs
This approach minimizes wasted compute time and ensures correct scientific usage.
Why Testing is Essential
Climate downscaling and bias-correction workflows involve:
Complex neural architectures
Sophisticated diffusion formulations
Large-scale data processing
Multi-GPU parallelization
Numerical precision requirements
Statistical bias-correction methods
Without proper testing, errors can:
Waste computational resources (days of GPU time)
Produce scientifically invalid results
Mask underlying implementation bugs
Compromise reproducibility
Recommended Workflow
Run the complete test suite
The global test runner executes both the
IPSL_AIDandAID_BCtest suites:python -m tests.test_all
Run one test suite independently
# IPSL_AID python -m tests.IPSL_AID.test_runner # AID_BC python -m tests.AID_BC.test_runner
Run targeted tests
Individual modules, classes, or test methods can be executed directly.
# IPSL_AID module python -m unittest tests.IPSL_AID.test_utils # IPSL_AID class python -m unittest tests.IPSL_AID.test_utils.TestEasyDict # IPSL_AID single test python -m unittest \ tests.IPSL_AID.test_utils.TestEasyDict.test_empty_initialization # AID_BC module python -m unittest tests.AID_BC.test_quantile_mapping
Integration Tests: Test data loading and model initialization
python tests/IPSL_AID/test_integration.pySmall-scale Debug Runs: Train on a small subset
# Use debug mode in setup script debug=true num_epochs=1 batch_size=4
Validation: Check against known baselines
Test Coverage
The IPSL_AID test suite covers:
Data loading and preprocessing
Diffusion model implementations (VE, VP, EDM, iDDPM)
UNet architectures and variants
Loss functions and training loops
Inference and sampling procedures
Evaluation metrics and diagnostics
The AID_BC test suite covers:
ERA5 and CMIP6 data loading
ERA5-on-CMIP6 preprocessing
Quantile Mapping
Optimal Transport
Bias-correction workflows
Evaluation metrics and diagnostics
Debugging Tips
Use torch.autograd.set_detect_anomaly(True) during development
Monitor GPU memory usage with nvidia-smi
Check numerical stability with gradient norms
Validate data normalization and scaling
Remember: Test first, scale later. A few hours of testing can save days of wasted computation.