From cc6476a1d32afa752e338745a217a0bb9248e4e4 Mon Sep 17 00:00:00 2001
From: lewa <lene.wasskog@nibio.no>
Date: Fri, 12 Jan 2024 09:53:59 +0100
Subject: [PATCH] feat: Add check for existence of weather data

---
 NAERSTADMO.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/NAERSTADMO.py b/NAERSTADMO.py
index 7c35ae8..5bf37c8 100644
--- a/NAERSTADMO.py
+++ b/NAERSTADMO.py
@@ -89,6 +89,11 @@ def create_dataset():
                 )
                 subprocess.run(f"rm {tmpfile_path}tmpfile.nc", shell=True)
 
+    # Ensure that model is not run if weather data is not available
+    if not os.path.exists(f"{tmpfile_path}weather_data.nc"):
+        print(f"{tmpfile_path}weather_data.nc does not exist. Exit.")
+        return
+
     subprocess.run(f"rm {outtmp_path}final_*", shell=True)
 
     create_saturation()
-- 
GitLab