Deep-learning Based Super-resolution Model in Climate Downscaling of Precipitation Data: this is the source code of Climate Downscaling: A Deep-Learning Based Super-resolution Model of Precipitation Data with Attention Block and Skip Connections.
National Taiwan Normal University 110 semester
Advisor: Ko-Chih Wang
Author: Chia-Hao Chiang
Composed of CBAMs (channel attention, spatial attention block), convolutional layers, and upsampling layer (Subpixel manner).
To generate high-resolution precipitation data in Taiwan. Check the links below for more data information:
-
Training input: ERA5 Reanalysis Data
-
Label (ground truth): TCCIP Observations
Set your own parameters in config.ini
and put your training dataset in the folder: data/input/
, which should have the naming of *yyyymmdd.npy
!
Similarly, put your label data (ground truth) dataset in the folder: data/label/
, which should also have namings of yyyymmdd.npy
.
The dataloader.py
is constructed based on the file namings and therefore they have to contain *yyyymmdd.npy
suffix.
Direct to the root folder of main.py
and then just run it: $ python main.py
.
The model would be saved in the model_save_dir
set in config.ini
, by default, at weights/
.
After put the inputs you want to predict into the folder: pred_inputs/
just run pred.py
: $ python pred.py
. The results will be saved in the folder: pred_results
.
The paths of inputs and outputs for inferencing are defined as pred_input_dir
and pred_save_dir
in config.ini
Prediction on the date in 2019.03.25:
- data Contains the dataset for training.
NOTICE THAT: all namings are currently hard-coded to be used in the format of *yyyymmdd.npy
.
- model_utils Contains 4 .py files:
dataloader.py
, as it's named, pulls chunks of training data paths and load one batch of training data vianp.load(path).
MyLayersNonSeq.py
contains some module or layer blocks.MyModelsNonSeq.py
assembles the layers or blocks fromMyLayers.py
to construct models.train.py
build training class and training related functions.
-
pred_input When operating in the inference mode, that is, running the
pred.py
, put the input you want to feed here. -
pretrained_results When operating in the inference mode, that is, running the
pred.py
, the prediction is saved here. -
pretrained_weights The pre-trained weights by the author.
-
results where the loss histories are stored.
-
weights where the model weights are stored when running
main.py
to train your own.
Update the environment.yml
file. Run $ conda env create -f environment.yml
to install the environment (env default name = climate). This may take minutes.
- platform: Windows11
- python == 3.9.19
- tensorflow == 2.15.0 (tested on 2024.08.19)
Tested on TWCC
- platform: Windows10
- python == 3.10.3
- tensorflow == 2.12.0 (tested on 2023.07.05)