OneScience-Group/RF-ClimParam
<p align="center"> <strong><span style="font-size: 30px;">RF-ClimParam</span></strong> </p>
Model Introduction
RF-ClimParam learns unresolved convection, cloud microphysics, radiation, turbulent diffusion, and surface-flux processes from high-resolution atmospheric simulations and provides stable subgrid parameterizations for coarse climate models at multiple horizontal resolutions. Its primary uses are multi-resolution climate simulation, analysis of parameterization scale dependence, and reconstruction of precipitation climate statistics.
Paper: Stable machine-learning parameterization of subgrid processes for climate modeling at a range of resolutions https://arxiv.org/abs/2001.03151
Model Description
The method reproduced by RF-ClimParam was proposed by Janni Yuval and Paul A. O'Gorman at the Massachusetts Institute of Technology. The paper trains random forests with coarse-grained states, instantaneous physical tendencies, turbulent diffusivity, and surface fluxes from a three-dimensional high-resolution System for Atmospheric Modeling aquaplanet simulation. The model is suitable for multi-resolution atmospheric subgrid parameterization, coarse-resolution climate simulation, and evaluation of mean and extreme precipitation statistics.
Use Cases
Usage Instructions
1.OneCode
Experience intelligent, one-click AI4S programming through the OneCode online environment:
Try intelligent, one-click AI4S programming
2. Download and Installation
hf download OneScience-Group/RF-ClimParam --local-dir ./RF-ClimParam
cd RF-ClimParamEnvironment Dependencies
Hardware Requirements
- A GPU or DCU is recommended; the random forest itself runs on CPU with NumPy.
- A CPU supports the complete default small-sample connectivity test.
- DCU users must install DTK first. DTK 25.04.2 or later, or the OneScience-recommended version matching the cluster, is recommended.
DCU Environment
# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.aiGPU Environment
# Activate Conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.aiTraining Data
python scripts/fake_data.pyThis repository uses a small number of structured synthetic atmospheric-column samples to validate the engineering workflow and retains complete 144×360, 72×180, 36×90, and 18×45 coarse-grid snapshots for x4, x8, x16, and x32. The data preserve all 48 levels and the real 145→144 and 62→17 random-forest interfaces while reducing only the number of snapshots, sampled training columns, and trees. Synthetic temperature, moisture, condensate, wind, and flux fields contain spatial and vertical relationships and validate multi-resolution parameterization, training, inference, and evaluation only; they do not represent the official SAM distribution or paper performance.
Training
For single-device training, use:
python scripts/train.pyFor multi-GPU training, use:
torchrun --nproc_per_node=8 --nnodes=1 --rdzv_id=1000 --rdzv_backend=c10d --max_restarts=0 --master_addr="localhost" --master_port=29500 scripts/train.pyTraining samples a small number of atmospheric columns from the complete spatial field at each resolution and fits the two joint multi-output random forests separately. It produces model parameters and training-sample statistics for all four resolutions, saved to:
result/checkpoints/rf_climparam.pt
result/training/metrics.jsonTrained Weights
This repository does not include weights under weight/. The original paper provides random-forest estimators at different resolutions; refer to the authors' OSF archive for the released weights and model artifacts: https://doi.org/10.17605/OSF.IO/36YPT.
Inference
python scripts/inference.pyInference results include reference targets and subgrid-process predictions at the x4, x8, x16, and x32 resolutions. They also contain complete spatial fields, diagnosed precipitation, grid-location information for each scale, and native x32-grid results. All numerical results are saved to result/output/predictions.npz.
Evaluation and Visualization
python scripts/result.pyEvaluation results include subgrid-process prediction performance at all four resolutions and an online proxy for coarse-grid precipitation. The visualization compares results across resolutions and shows the zonal distributions of target and predicted precipitation. Structured results and the auxiliary figure are saved to result/evaluation/metrics.json and result/evaluation/comparison.png. Synthetic-data results validate the engineering workflow only and do not represent the paper's formal SAM online performance.
Official OneScience Information
Citation and License
This repository is an independent engineering reproduction of the public RF-ClimParam specifications.
Use of this repository's code, official model weights, and data remains subject to the licenses and terms of their respective projects.
