From 41c1c60a09d283d44052bc2e2191acf7225bddd1 Mon Sep 17 00:00:00 2001
From: Lene Wasskog <lene.wasskog@nibio.no>
Date: Fri, 21 Feb 2025 13:38:50 +0100
Subject: [PATCH] feat: Ensure query templates are copied to mapserver dir

---
 ADASMELIAE.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ADASMELIAE.py b/ADASMELIAE.py
index 572fbb5..8baa4f3 100755
--- a/ADASMELIAE.py
+++ b/ADASMELIAE.py
@@ -23,6 +23,7 @@
 # * For Python: See requirements.txt
 
 import os
+import shutil
 import time
 import subprocess
 import glob
@@ -325,6 +326,7 @@ if __name__ == "__main__":
 
     env = Environment(loader=FileSystemLoader(template_dir))
     template = env.get_template(template_file_name)
+
     output = template.render(
         {
             "model_id": model_id,
@@ -340,7 +342,11 @@ if __name__ == "__main__":
     )
     with open(f"{result_mapfile_year_dir}/{model_id}.map", "w") as f:
         f.write(output)
-    # remove_temporary_files()
+
+    query_template = os.path.join(home_dir, "mapfile/query_template.xml")
+    query_template_temperature = os.path.join(home_dir, "mapfile/query_template_temperature.xml")
+    shutil.copy(query_template, result_mapfile_year_dir)
+    shutil.copy(query_template_temperature, result_mapfile_year_dir)
 
     end_time = time.time()
     logging.info(
-- 
GitLab