From a7559f69aa4d1f8b7022a21bc1ae1bd317656014 Mon Sep 17 00:00:00 2001
From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu>
Date: Wed, 17 Nov 2021 10:28:26 +0100
Subject: [PATCH] Script for bootstrapped model training in batch mode.

---
 Scripts/bootstrap.sh | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Scripts/bootstrap.sh

diff --git a/Scripts/bootstrap.sh b/Scripts/bootstrap.sh
new file mode 100644
index 0000000..6e61cf9
--- /dev/null
+++ b/Scripts/bootstrap.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+# activate conda environment
+conda activate climax
+
+# move to project repository
+cd ~/git/climax
+
+# predictands
+PREDICTAND=(pr tasmin tasmax)
+
+# set number of ensemble members
+sed -i "s/BOOTSTRAP\s*=.*/BOOTSTRAP\=10/" ./climax/main/config.py
+
+# iterate over predictands
+for predictand in ${PREDICTAND[@]}; do
+
+    # change predictand in configuration
+    sed -i "s/PREDICTAND\s*=.*/PREDICTAND='$predictand'/" ./climax/main/config.py
+
+    # define available loss functions for current predictand
+    if [ "$predictand" = "pr" ]; then
+        LOSS=(L1Loss BernoulliGammaLoss MSELoss)
+    else
+        LOSS=(L1Loss MSELoss)
+    fi
+
+    # iterate over loss functions
+    for loss in ${LOSS[@]}; do
+
+        # change loss function in configuration
+        if [ "$loss" = "L1Loss" ] || [ "$loss" = "MSELoss" ]; then
+            sed -i "s/LOSS\s*=.*/LOSS=$loss()/" ./climax/main/config.py
+        else
+    	    sed -i "s/LOSS\s*=.*/LOSS=$loss(min_amount=1)/" ./climax/main/config.py
+        fi
+
+       	# run downscaling
+        python climax/main/downscale_bootstrap.py
+    done
+done
-- 
GitLab