This repository contains the code and data associated with the paper Deep decoupled structural-statistical bias-correction framework for precipitation and temperature prediction.
main.py defines the training task, constructs the model and datasets, sets the hyperparameters, and launches all experiments.
model.py implements the RUNet architecture used for bias correction.
dataset.py prepares the train/validation/test datasets, applies normalization, and computes the statistical terms used during inference.
utils.py provides data loading, variable-specific preprocessing, regional subsetting, and normalization utilities.
train.py contains the training loop, validation procedure, learning-rate scheduling, checkpoint saving, and test-time reconstruction.
evaluate.py loads the saved checkpoints, performs inference for all test splits, and saves the final corrected outputs.
Install a PyTorch version compatible with your CUDA environment first, and then install the remaining dependencies, including numpy, netCDF4, tqdm, and visdom.
The SEAS5 monthly mean forecasts are downloaded from https://cds.climate.copernicus.eu/datasets/seasonal-monthly-single-levels?tab=download. The ERA5 monthly averaged data are downloaded from https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels-monthly-means?tab=download.
Before running the experiments, the ERA5 data must be remapped from 0.25° × 0.25° to 1° × 1° using CDO. The target grid configuration is provided in config_remap.txt. For 2 m temperature (t2m), bilinear interpolation should be applied with -remapbil. For total precipitation (tp), conservative remapping should be applied with -remapcon.
Example commands:
cdo -remapbil,config_remap.txt <raw_era5_t2m_file.nc> <remapped_era5_t2m_file.nc>
cdo -remapcon,config_remap.txt <raw_era5_tp_file.nc> <remapped_era5_tp_file.nc>Here, <raw_era5_*.nc> refers to the original ERA5 file before remapping, and <remapped_era5_*.nc> refers to the processed ERA5 file after remapping.
After preprocessing, the data files should be organized as follows. The folder names and filenames must exactly match this structure:
root/
├── ddsc/
│ ├── main.py
│ ├── model.py
│ ├── train.py
│ ├── evaluate.py
│ ├── dataset.py
│ └── utils.py
└── dataset/
├── SEAS5_ERA5_12_init_t2m/
│ ├── seas5_12_t2m.nc
│ └── era5_12_t2m.nc
├── SEAS5_ERA5_12_init_tp/
│ ├── seas5_12_tp.nc
│ └── era5_12_tp.nc
├── SEAS5_ERA5_6_init_t2m/
│ ├── seas5_6_t2m.nc
│ └── era5_6_t2m.nc
└── SEAS5_ERA5_6_init_tp/
├── seas5_6_tp.nc
└── era5_6_tp.nc
To reproduce the experiments, first prepare the SEAS5 and ERA5 data as described in the Data section and make sure the directory names and filenames exactly match the required structure. If training curves need to be monitored in real time, start a Visdom server before launching training.
Train the model by running:
python main.pyAfter training, generate the corrected outputs by running:
python evaluate.pyFor any questions, please contact dingxin@nuist.edu.cn.