Skip to content
Snippets Groups Projects
Commit e39d2f70 authored by Lene Wasskog's avatar Lene Wasskog
Browse files

chore: Copy query templates to mapfile folder

parent 640965f4
Branches
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
import subprocess import subprocess
import os import os
import sys import sys
import shutil
from dotenv import load_dotenv from dotenv import load_dotenv
from datetime import datetime from datetime import datetime
import pytz import pytz
...@@ -41,7 +42,7 @@ else: ...@@ -41,7 +42,7 @@ else:
recurring_start_date = os.getenv("RECURRING_START_DATE") recurring_start_date = os.getenv("RECURRING_START_DATE")
weatherdata_path = f'{os.getenv("WEATHER_DATA_DIR")}{year}/' weatherdata_path = f'{os.getenv("WEATHER_DATA_DIR")}{year}/'
tmp_path = "tmp/" tmp_path = "tmp/"
home_dir = os.getenv("HOME_DIR")
out_path = f'{os.getenv("DATA_DIR")}{year}/' out_path = f'{os.getenv("DATA_DIR")}{year}/'
os.makedirs(out_path, exist_ok=True) os.makedirs(out_path, exist_ok=True)
...@@ -189,5 +190,11 @@ output = template.render( ...@@ -189,5 +190,11 @@ output = template.render(
) )
mapfile_outdir = f'{os.getenv("MAPFILE_DIR")}{year}/' mapfile_outdir = f'{os.getenv("MAPFILE_DIR")}{year}/'
os.makedirs(mapfile_outdir, exist_ok=True) os.makedirs(mapfile_outdir, exist_ok=True)
query_template = os.path.join(home_dir, "mapfile/query_template.xml")
query_template_DD = os.path.join(home_dir, "mapfile/query_template_DD.xml")
shutil.copy(query_template, mapfile_outdir)
shutil.copy(query_template_DD, mapfile_outdir)
with open(f"{mapfile_outdir}PSILARTEMP.map", "w") as f: with open(f"{mapfile_outdir}PSILARTEMP.map", "w") as f:
f.write(output) f.write(output)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment