Yogesh verma | Markus Heinonen | Vikas Garg
The code repository for the paper ClimODE: Climate and Weather Forecasting With Physics-informed Neural ODEs. More information can be found on the project website.
If you find this repository useful in your research, please consider citing the following paper:
@inproceedings{
verma2024climode,
title={Clim{ODE}: Climate Forecasting With Physics-informed Neural {ODE}s},
author={Yogesh Verma and Markus Heinonen and Vikas Garg},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024},
url={https://openreview.net/forum?id=xuY33XhEGR}
}
- torchdiffeq : https://github.com/rtqichen/torchdiffeq.
- pytorch >= 1.12.0
- torch-scatter
- torch-sparse
- torch-cluster
- torch-spline-conv
- torchcubicspline: https://github.com/patrick-kidger/torchcubicspline
- properscoring (for CRPS scores) : https://pypi.org/project/properscoring/
First, download ERA5 data with 5.625deg from WeatherBench. The data directory should look like the following
era5_data
|-- 10m_u_component_of_wind
|-- 10m_v_component_of_wind
|-- 2m_temperature
|-- constants
|-- geopotential_500
|-- temperature_850
To train ClimODE for global forecast use,
python train_global.py --scale 0 --batch_size 8 --spectral 0 --solver "euler"
To train ClimODE for global monthly forecast use,
python train_monthly.py --scale 0 --batch_size 4 --spectral 0 --solver "euler"
To train ClimODE for regional forecasts among various regions of earth use,
python train_region.py --scale 0 --batch_size 8 --spectral 0 --solver "euler" --region 'NorthAmerica/SouthAmerica/Australia'
To evaluate ClimODE for global forecast on Lat. weighted RMSE and ACC use, (Make sure to change the model path in the file)
python evaluation_global.py --spectral 0 --scale 0 --batch_size 8
To evaluate ClimODE for global monthly forecast on Lat. weighted RMSE and ACC use, (Make sure to change the model path in the file)
python evaluation_monthly.py --spectral 0 --scale 0 --batch_size 4
To evaluate ClimODE for regional forecast on Lat. weighted RMSE and ACC use, (Make sure to change the model path in the file)
python evaluation_region.py --spectral 0 --scale 0 --region 'NorthAmerica/SouthAmerica/Australia' --batch_size 8
To train on a custom dataset, you need to follow the below guidelines
- Data Loading: You might want to change the data loading scheme depending on your data (e.g. seasonal, daily, etc., and with many different input channels), which can be found in
utils.py
in the data-loading function. - Fitting initial velocity: Depending on the data, you need to estimate the initial velocity to train and test the model (For more details, see the manuscript) via the
fit_velocity
function. - Model Function: Depending on the input observable quantities, you might need to modify the number of input channels to model function in
model_function.py
. - Training and evaluation: Depending on your dataset, you might want to fine-tune and change the various hyper-parameters in training and evaluation files. Make sure to make them consistent in both of them. Also, we report CRPS scores for global hourly forecast only, if you want to compute them for every task please include the
evaluation_crps_mm
function.
Note: We are also constantly updating and revising the repo to make it more adaptable in a general way, and finidng bugs and removing them and modifying certain parts.