Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
anne-df authored May 17, 2024
1 parent 9e34c85 commit 0891d41
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,28 @@

**Method**: Convolutional Variational AutoEncoder.

**Input**: "3D daily images", daily screenshots of Europe for three climate variables (maximum temperature, precipitation, wind).
**Input**: "Daily images", daily screenshots of Europe for maximum temperature (CMCC-ESM2 model, 1° spatial resolution).

**Output**: Error between original and reconstructed image: postprocessed for analysis in the "scenario_season_comparison.ipynb" file.

**Idea**: The more unusual an image (anomaly), the higher error.

**Use**:
- Run "python train.py" once in the right working directory to train the network. Caution: It will overwrite the model saved in outputs unless you change the path name '../outputs/cvae_model_3d.pth' in the script.
**Folder Architecture**:
<img width="283" alt="image" src="https://github.com/cerfacs-globc/xtclim/assets/44207112/97813269-1632-4ae1-b30d-c0e17940734c">

- Run "python anomaly.py" once in the right working directory to evaluate the model on the three available datasets - train, test, and projection.

- The "data" folder could not be uploaded because of its weight. It contains the NetCDF files tasmax_day_CMCC-ESM2_historical_r1i1p1f1_gn_19750101-19991231.nc for both historical (1975-1999) and projection (2065-2089) time periods.
**How to Run**:

- The "input" folder is incomplete for the same reason. Only preprocessed test data could be uploaded. The missing files can be obtained by running "preprocessing/preprocess_functions_1d_temp_members.ipynb" then "preprocessing/preprocess_3d_seasons.ipynb" to split the files into seasons.
_In the following part, "network" refers to the deep learning model, the Convolutional Variational Auto-Encoder (CVAE)._

The 3D version on the "3d_cvae" branch has the same structure but for three climate variables simultaneously.
- In the preprocessing folder, first run "preprocess_functions_2d_ssp.py" to load NetCDF files from the data folder. It will normalize and adjust the data for the network. Then run "preprocess_2d_seasons.py" to split the data into seasonal files. Preprocessed data is stored in the "input" folder.

Estimation of the carbon footprint of the training with the codecarbon package (see first and last lines of "src/train.py").
- Run "python train.py" to train the network. Caution: It will overwrite the weights of the network already saved in outputs (unless you change the path name '../outputs/cvae_model_3d.pth' in the script).

- Run "python anomaly.py" to evaluate the network on the available datasets - train, test, and projection.

- The "data" folder is too heavy to be stored on the repository. It should contain tasmax NetCDF files for both historical (1950-1999) and projection (2015-2100) time periods (e.g. tasmax_day_CMCC-ESM2_historical_r1i1p1f1_gn_19500101-19991231.nc).

**More Details**:
- "model.py" contains the details of the architecture of the network, and "engine.py" defines the train and evaluate functions.
- The carbon footprint of the training is estimated with the codecarbon package (see first and last lines of "src/train.py").

0 comments on commit 0891d41

Please sign in to comment.