This repository applies the pre-trained Deep Generative Model of Rainfall (DGMR) developed by Google DeepMind to Meteo-France rainfall data. The goal of this project is to provide real-time, high-quality short-term rainfall forecasts (nowcasting) for France.
- Download radar data through the Meteo-France public data API
- Short-term rainfall forecasting: max lead time 2h, timestep 5min, resolution 1km
- Utilizes the DGMR pre-trained (UK data) model for realistic forecasts
- Visualizations of rainfall predictions with GIFs
git clone https://github.com/meteofrance/dgmr
cd dgmr
With micromamba or conda:
micromamba create -f environment.yml
micromamba activate dgmr
If you don't already have an account on the Météo-France Public Data portal, please create one.
-
Once connected, subscribe to the Radar data API (not the "Radar Package" one).
-
Then click on Configure the API.
-
Select API Key as the token type, enter the duration (in seconds), and Generate Token.
-
Copy the token; you will need it in the next step.
Go to this Google Cloud Storage link and download the whole folder dm-nowcasting-example-data/tfhub_snapshots/1536x1280
(this folder contains the pre-trained model with a size of 1536x1280).
Note that the AI model is licensed under Creative Commons BY 4.0.
Create a .env
file in the root directory and add your configuration settings:
METEO_FRANCE_API_KEY="<your_meteo_france_api_key>"
METEO_FRANCE_DATA_PATH="<path_to_save_the_downloaded_data>" # If empty, downloaded data will be saved in ./data
DGMR_MODEL_PATH="<path_to_the_pretrained_dgmr_folder>/1536x1280/"
DGMR_PLOT_PATH="<path_to_save_the_plots>" # If empty, forecast GIFs will be saved in ./plot
Simply run the script ./dgmr/download_data.sh
to download the latest radar images.
For real-time forecasting, we need to download the radar data every 5 minutes.
To automate the data downloading process using a cron job, follow these steps:
-
Open your terminal and type
crontab -e
to edit the cron table. -
Add a new line at the end of the file to define the cron job. The general syntax for a cron task is:
*/5 * * * * <ABSOLUTE_PATH_TO_REPO>/dgmr/download_data.sh
To make a real-time rainfall nowcast, use:
python main.py
This script expects that you have already downloaded the 4 latest radar images.
It saves the forecast as a GIF in the plot folder defined by the DGMR_PLOT_PATH
env variable.
This project uses rainfall data from Meteo-France.
The H5 files contain 5-minute cumulated rainfall data over France, with a 500m resolution.
To match the pre-trained model inputs, we convert the data to instantaneous rainfall (mm/h) and downgrade the resolution to 1km.
The DGMR model is a state-of-the-art generative model designed for weather nowcasting. It leverages a combination of convolutional neural networks (CNNs) and generative adversarial networks (GANs) to produce high-resolution, realistic rainfall forecasts.
For more details, please see Ravuri, S., Lenc, K., Willson, M. et al. Skilful precipitation nowcasting using deep generative models of radar. Nature 597, 672–677 (2021).
A notebook is also available as a supplement to the article: notebook.
The DGMR model is under the terms of the Creative Commons Attribution 4.0 International License.
- The DGMR pre-trained model is licensed under the Creative Commons Attribution 4.0 International License.
- Radar data from Météo-France are licensed under the Open Licence.
- The code in this repository is licensed under the Apache License, Version 2.0.
- From Météo-France's AI Lab: Théo Tournier, Léa Berthomier, Frank Guibert, Bruno Pradel
- From the French National School of Meteorology: Flora Chapelle, Hugo Germain, Paul Lacotte & Ariadna Perello