From d200c67f854051abe730f91cbe54181131962095 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Oriol=20Tint=C3=B3=20Prims?= <oriol.tinto@lmu.de>
Date: Fri, 17 Mar 2023 14:32:00 +0100
Subject: [PATCH] Remove useless variables and rename grid files.

---
 templates/common/prepare_experiment.sh | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/templates/common/prepare_experiment.sh b/templates/common/prepare_experiment.sh
index c139986..5d9b03d 100644
--- a/templates/common/prepare_experiment.sh
+++ b/templates/common/prepare_experiment.sh
@@ -2,13 +2,9 @@
 
 # Get some variables provided by autosubmit.
 WORKDIR=%HPCROOTDIR%
-ICON_VERSION=%ICON_VERSION%
-
-BGRID_GLOBAL=%simulation.BGRID_GLOBAL%
-RGRID_GLOBAL=%simulation.RGRID_GLOBAL%
-BGRID=%simulation.BGRID%
-RGRID=%simulation.RGRID%
-BEXTPAR=%simulation.BEXTPAR%
+DYNAMICS_GRID_FILENAME=%simulation.dynamics_grid_filename%
+RADIATION_GRID_FILE=%simulation.radiation_grid_filename%
+EXTERNAL_PARAMETERS_FILE=%simulation.external_parameters_filename%
 
 
 # Activate spack
@@ -26,18 +22,18 @@ cd "${COMMON_INIDATA_FOLDER}" || exit
 # Download or copy required input files
 function download_file() {
   URL=$1
-  FILE=${2:-$(basename $URL)}
-  if [ ! -e $FILE ]; then
+  FILE=${2:-$(basename "$URL")}
+  if [ ! -e "$FILE" ]; then
     echo "Download $URL => $FILE"
-    wget -q $URL -O $FILE
+    wget -q "$URL" -O "$FILE"
   fi
 }
 
 # Download grid files and external parameters
 BASEURL=http://icon-downloads.mpimet.mpg.de/grids/public/edzw
-download_file $BASEURL/$BGRID
-download_file $BASEURL/$RGRID
-download_file $BASEURL/$BEXTPAR
+download_file $BASEURL/${DYNAMICS_GRID_FILENAME}
+download_file $BASEURL/${RADIATION_GRID_FILE}
+download_file $BASEURL/${EXTERNAL_PARAMETERS_FILE}
 
 # Link input for radiation
 ln -sf "${ICON_DATA_PATH}/rrtmg_lw.nc" .
-- 
GitLab