| --- |
| license: mit |
| tags: |
| - solar-radiation |
| - deep-learning |
| - nowcasting |
| - ddpm |
| - MCVD |
| --- |
| |
| # DDPM Solar Radiation model |
| A deep learning model for solar radiation nowcasting using modified [MCVD](https://arxiv.org/pdf/2205.09853) model, a kind of DDPM model for video generation. The model predicts clearsky index and converts it to solar radiation for up to 6 or 36 time steps ahead. |
|
|
| <br> |
|
|
| Below is an example of DDPM generation process for 1-hour solar radiation prediction (6 time steps). The total iteration is 1000 steps, and every 50 steps are shown in the gif. |
|
|
|  |
|
|
| ## Overview |
|
|
| This repository contains two trained models (1hr & 6hr) for solar radiation forecasting: |
| - **1hr DDPM Model**: Predicts solar radiation up to 1 hour ahead (6 time steps) |
| - **6hr DDPM Model**: Predicts solar radiation up to 6 hours ahead (36 time steps). |
|
|
| The model uses multiple input sources: |
| - **Himawari satellite data**: Clearsky index calculated from Himawari satellite data |
| - **WRF Prediction**: Clearsky index from WRF's solar irradiation prediction |
| - **Topography**: Static topographical features |
|
|
| ## Installation |
|
|
| 1. Clone the repository & install Git LFS: |
| ```bash |
| git lfs install |
| git clone <repository-url> |
| cd Diffusion_SolRad |
| git lfs pull |
| git lfs ls-files # confirm whether models weights & sample data are downloaded |
| ``` |
|
|
| 2. Install dependencies: |
| ```bash |
| pip install -r requirements.txt |
| ``` |
|
|
| ## Requirements |
|
|
| - Python 3.x |
| - PyTorch 2.4.0 |
| - NumPy 1.26.4 |
| - einops 0.8.0 |
|
|
| ## Usage |
|
|
| ### Basic Inference |
|
|
| Run solar radiation prediction using the pre-trained models: |
|
|
| ```bash |
| python inference.py --pred-hr [1hr/6hr] --pred-mode [DDPM/DDIM] --basetime 202504131100 |
| ``` |
|
|
| ### Command Line Arguments |
|
|
| - `pred-mode`: Choose between `DDPM` or `DDIM` sampling methods (default: `DDPM`) |
| - `pred-hr`: Choose between `1hr` or `6hr` prediction models (default: `1hr`) |
| - `--basetime`: Timestamp for input data in format YYYYMMDDHHMM (default: `202504131100`) |
|
|
| ### Example |
|
|
| ```bash |
| # DDIM sampling method for 1-hour prediction |
| python inference.py --pred-hr 1hr --pred-mode DDIM --basetime 202507151200 |
| ``` |
|
|
| ## Sample Data |
|
|
| The repository includes sample data files: |
| - `sample_202504131100.npz` |
| - `sample_202504161200.npz` |
| - `sample_202507151200.npz` |
|
|
| ## Model Weights |
|
|
| Pre-trained weights are available for both models: |
| - `model_weights/ft06_01hr/weights.ckpt` |
| - `model_weights/ft36_06hr/weights.ckpt` |
|
|
| ## License |
|
|
| This project is released under the MIT License. |
|
|