From 68595c2b10d69cd7b7588b83ccfe09502daffc9f Mon Sep 17 00:00:00 2001
From: Mireille Schneider <Mireille.Schneider@iter.org>
Date: Wed, 30 Apr 2025 11:22:47 +0200
Subject: [PATCH] Add flexibility to read/write ddv3 or ddv4

---
 input/scenario_iter.yaml           | 3 ++-
 python/config_muscle3.sh           | 6 ++++--
 python/run_chease_iwrap_choices.py | 4 ++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/input/scenario_iter.yaml b/input/scenario_iter.yaml
index a32dd9db..453e751c 100644
--- a/input/scenario_iter.yaml
+++ b/input/scenario_iter.yaml
@@ -19,7 +19,8 @@ shot:                134173
 run_in:              106
 input_user_or_path:  public
 input_database:      ITER
-input_backend:    HDF5
+input_backend:       HDF5
+input_ddv:           3
 
 # -----------------------------------
 # PARAMETERS TO SAVE THE OUTPUT DATA
diff --git a/python/config_muscle3.sh b/python/config_muscle3.sh
index 3f1aa303..eacd6f6a 100644
--- a/python/config_muscle3.sh
+++ b/python/config_muscle3.sh
@@ -1,7 +1,9 @@
 export FC=ifort
 module purge
-module load IMAS INTERPOS XMLlib iWrap MUSCLE3 iWrap-plugins-MUSCLE3 yMMSL-dot
+
+module load IMAS/4.0.0-2024.12-intel-2023b
+module load INTERPOS XMLlib iWrap MUSCLE3 iWrap-plugins-MUSCLE3 yMMSL-dot
 export PYTHONPATH=$PWD/..:$PYTHONPATH
 
-export IMAS_AL_DISABLE_OBSOLESCENT_WARNING=1
+#export IMAS_AL_DISABLE_OBSOLESCENT_WARNING=1
 #export IMAS_AL_DISABLE_VALIDATE=1
diff --git a/python/run_chease_iwrap_choices.py b/python/run_chease_iwrap_choices.py
index 2173546a..31e0fae0 100644
--- a/python/run_chease_iwrap_choices.py
+++ b/python/run_chease_iwrap_choices.py
@@ -119,14 +119,14 @@ def run_chease_iwrap_choices() -> None:
 
     # READ INPUT IDSS
     print('=> Open input datafile')
-    input = imas.DBEntry(get_backend_id(cc['input_backend']),cc['input_database'],cc['shot'],cc['run_in'],cc['input_user_or_path'])
+    input = imas.DBEntry(get_backend_id(cc['input_backend']),cc['input_database'],cc['shot'],cc['run_in'],cc['input_user_or_path'],data_version=str(cc['input_ddv']))
     input.open()
 
     # READ FULL TIME VECTOR OF EQUILIBRIUM IDS TO GET THE TIME BASE
     time_array,it,ntimes = time_compute(input,cc['time_slice'],cc['ntimes'],cc['dt_required'])
 
     # IF LOCAL DATABASE DOES NOT EXIST: CREATE IT
-    local_database = os.getenv("HOME") + "/public/imasdb/" + cc['output_database'] + "/3/0"
+    local_database = os.getenv("HOME") + "/public/imasdb/" + cc['output_database'] + '/'+imas.al_dd_version.split(".")[0]+'/0'
     if os.path.isdir(local_database) == False:
         print("-- Create local database " + local_database)
         os.makedirs(local_database)
-- 
GitLab