philippmwirth/Predicting-Rain-from-Satellite-Images
Code for the TDS article "Predicting Rain from Satellite Images"
Predicting Rain from Satellite Images
How to train a neural network to predict precipitation based on satellite images pulled from the Meteomatics API.
Usage
Download Data
In order to download data from the Meteomatics API, you need to have a user and password. Then, you can simply use the download.py script:
usage: download.py [-h] [--data DATA] user pwd
This script will download a single input/output pair for each of the three predefined regions (Central Europe, North America, and Mexico) at the current timestamp. In order to use this data for training, it needs to be processed first, see Process Data.
Process Data
To process the data, use
usage: convert.py [-h] [--mode MODE] [--data DATA] region
where --data is the path to the data downloaded above and region is one of central_europe, north_america, or mexico. If you want to mask out all convective or stratiform areas, use modes stratiform or convective respectively.
Train
To train a model on the downloaded data, use the following commands:
cd Pytorch-ENet
python main.py \
--save-dir ./save/ \
--dataset meteomatics \
--dataset-dir PATH/TO/YOUR/DATASET \
--with-unlabeled \
--weighing mfb
cd ..
Test
To test a model, use:
cd Pytorch-ENet
python main.py \
-m test \
--save-dir ./save/ \
--dataset meteomatics \
--dataset-dir PATH/TO/YOUR/DATASET \
--with-unlabeled \
--imshow-batch
cd ..