From 45f0d16ec2781a2f864662ec10c2fa6d4e6e98f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Oriol=20Tint=C3=B3=20Prims?= <oriol.tinto@lmu.de>
Date: Fri, 24 Mar 2023 13:49:03 +0100
Subject: [PATCH] Fix prepare_experiment.sh to use spack_utils

---
 templates/real-from-dwd-ana/prepare_experiment.sh | 4 ++--
 templates/real-from-ideal/prepare_experiment.sh   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/templates/real-from-dwd-ana/prepare_experiment.sh b/templates/real-from-dwd-ana/prepare_experiment.sh
index 5d9b03d..677cc05 100644
--- a/templates/real-from-dwd-ana/prepare_experiment.sh
+++ b/templates/real-from-dwd-ana/prepare_experiment.sh
@@ -8,8 +8,8 @@ EXTERNAL_PARAMETERS_FILE=%simulation.external_parameters_filename%
 
 
 # Activate spack
-SPACK_ENV=${WORKDIR}/spack/share/spack/setup-env.sh
-source ${SPACK_ENV}
+. ${WORKDIR}/proj/platforms/common/spack_utils.sh
+load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack.compiler%" "%spack.disable_local_config%" "%spack.user_cache_path%" "%spack.user_config_path%"
 
 # Load icon module needed to retrieve some data
 spack load icon-nwp@%ICON_VERSION%
diff --git a/templates/real-from-ideal/prepare_experiment.sh b/templates/real-from-ideal/prepare_experiment.sh
index b25b40a..d7f3791 100644
--- a/templates/real-from-ideal/prepare_experiment.sh
+++ b/templates/real-from-ideal/prepare_experiment.sh
@@ -6,8 +6,8 @@ DYNAMICS_GRID_FILENAME=%simulation.dynamics_grid_filename%
 RADIATION_GRID_FILE=%simulation.radiation_grid_filename%
 
 # Activate spack
-SPACK_ENV=${WORKDIR}/spack/share/spack/setup-env.sh
-source ${SPACK_ENV}
+. ${WORKDIR}/proj/platforms/common/spack_utils.sh
+load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack.compiler%" "%spack.disable_local_config%" "%spack.user_cache_path%" "%spack.user_config_path%"
 
 # Load icon module needed to retrieve some data
 spack load icon-nwp@%ICON_VERSION%
-- 
GitLab