From 00eb9caf187f861c880e178f0f5e0eb8dab4b66c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Chi-Tu=C3=A2n=20Pham?= <chi-tuan.pham@edf.fr>
Date: Wed, 26 Mar 2025 12:12:05 +0100
Subject: [PATCH 1/4] [fix] Update after deletion of keyword, new default
 value, modifications to be used for other modules different from T2D+T3D

---
 scripts/python3/pretel/check_cas.py | 324 ++++++++++++----------------
 1 file changed, 141 insertions(+), 183 deletions(-)

diff --git a/scripts/python3/pretel/check_cas.py b/scripts/python3/pretel/check_cas.py
index 6cdefb2b77..b7b0aa057b 100644
--- a/scripts/python3/pretel/check_cas.py
+++ b/scripts/python3/pretel/check_cas.py
@@ -5,7 +5,6 @@ from datetime import datetime, timedelta
 import re
 import numpy as np
 from data_manip.extraction.telemac_file import TelemacFile
-from utils.exceptions import TelemacException
 
 def check_cas(module, cas):
     """
@@ -45,16 +44,16 @@ def get_simulation_date(module, cas):
 
         ntimestep = max(ntimestep, int(duration/time_step + 0.5))
 
-        previous_comp = cas.get('COMPUTATION CONTINUED')
+        previous_file = cas.get("PREVIOUS COMPUTATION FILE")
         tel_date = get_cas_date(module, cas)
 
-        if previous_comp:
+        if previous_file != '':
             # Get time from previous computation file
-            previous_file = cas.get("PREVIOUS COMPUTATION FILE")
             record_prev = cas.get('RECORD NUMBER FOR RESTART')
             # Record are starting from 0 in python 1 n the steering file
-            # 0 in steering file means last time step
-            record_prev -= 1
+            # -1 in steering file means last time step
+            if record_prev != -1:
+                record_prev -= 1
             date, _, time = get_file_date(previous_file, last=record_prev)
             start_date = date + timedelta(seconds=time)
         else:
@@ -152,47 +151,6 @@ def get_lid_date(file_name):
 
     return time_start, time_end, date
 
-def check_previous_comp(module, cas, comp_cont="COMPUTATION CONTINUED",
-                        prev_file="PREVIOUS COMPUTATION FILE"):
-    """
-    Check for compuration continued
-    """
-    # Checking that same date in steering file and previous computation file
-    previous_comp = cas.get(comp_cont)
-
-
-    if previous_comp:
-        print("  ~> Checking {} coherence".format(comp_cont.lower()))
-
-        tel_date = get_cas_date(module, cas)
-        reset_time = cas.get('INITIAL TIME SET TO ZERO')
-        record_prev = cas.get('RECORD NUMBER FOR RESTART')
-        # Record are starting from 0 in python 1 n the steering file
-        # 0 in steering file means last time step
-        record_prev -= 1
-
-        previous_file = cas.get(prev_file)
-        prev_date, _, end = get_file_date(previous_file, last=record_prev)
-
-        prev_date = prev_date + timedelta(seconds=end)
-
-
-        if not reset_time:
-            tel_date = tel_date + timedelta(seconds=end)
-
-        if tel_date != prev_date:
-            raise TelemacException(
-                "Warning:\nMissmatch between previous computation date ({}) "
-                "and steering file date ({})\n"
-                "The good values should be:\n"
-                "if reset time to zero:\n"
-                "steering date = previous_file date + last_timestep"
-                "else\n"
-                "steering date = previous_file date"
-                .format(prev_date, tel_date))
-
-
-
 def check_time(module, cas):
     """
     Checking time coherence between input files and steering file info
@@ -202,144 +160,144 @@ def check_time(module, cas):
 
     passed = True
 
-    if module in ['telemac2d', 'telemac3d']:
-        check_previous_comp(module, cas)
-
-    if module == 'telemac3d':
-        # Checkgin for 2d continuation
-        check_previous_comp(module, cas, comp_cont="2D CONTINUATION",
-                            prev_file="FILE FOR 2D CONTINUATION")
-
     print("  ~> Displaying simulation date")
     start_date, end_date = get_simulation_date(module, cas)
     print("Starting date: {}".format(start_date))
     print("Ending date:   {}".format(end_date))
 
-    atmospheric_file = cas.get('BINARY ATMOSPHERIC DATA FILE')
-    if atmospheric_file != '' and module in ['telemac2d', 'telemac3d']:
-        print('  ~> Checking atmo binary file time coherence')
-        meteo_date, time_start, time_end = get_file_date(atmospheric_file)
-        meteo_start = meteo_date + timedelta(seconds=time_start)
-        meteo_end = meteo_date + timedelta(seconds=time_end)
-        print("Time range of the atmospheric data  {} to {}"
-              .format(meteo_start, meteo_end))
-
-        if start_date < meteo_start:
-            print("The simulation start at {} wheras the atmo binary "
-                  "file start at {}"
-                  .format(start_date, meteo_start))
-            passed = False
-        if end_date > meteo_end:
-            print("The simulation ends at {} wheras the atmo binary "
-                  "file ends at {}"
-                  .format(end_date, meteo_end))
-            passed = False
-
-        if passed:
-            print("  ~> OK")
-        else:
-            print("  ~> Failed")
-
-    ascii_meteo_file = cas.get('ASCII ATMOSPHERIC DATA FILE')
-    if ascii_meteo_file != '' and module in ['telemac2d', 'telemac3d']:
-        print('  ~> Checking atmo ascii file time coherence')
-        time_start, time_end, date = get_lid_date(ascii_meteo_file)
-
-        meteo_start = date + timedelta(seconds=time_start)
-        meteo_end = date + timedelta(seconds=time_end)
-        print("Time range of the atmospheric data  {} to {}"
-              .format(meteo_start, meteo_end))
-
-        if start_date < meteo_start:
-            print("The simulation start at {} wheras the atmo ascii "
-                  "file start at {}"
-                  .format(start_date, meteo_start))
-            passed = False
-        if end_date > meteo_end:
-            print("The simulation ends at {} wheras the atmo ascii "
-                  "file ends at {}"
-                  .format(end_date, meteo_end))
-            passed = False
-
-        if passed:
-            print("  ~> OK")
-        else:
-            print("  ~> Failed")
-
-    liq_bnd_file = cas.get('LIQUID BOUNDARIES FILE')
-    if liq_bnd_file != '' and module in ['telemac2d', 'telemac3d']:
-        print('  ~> Checking liquid boundaries file time coherence')
-        time_start, time_end, date = get_lid_date(liq_bnd_file)
-
-        liq_start = date + timedelta(seconds=time_start)
-        liq_end = date + timedelta(seconds=time_end)
-        print("Time range of the liquid boundary data  {} to {}"
-              .format(liq_start, liq_end))
-
-        if start_date < liq_start:
-            print("The simulation start at {} wheras the liquid boundaries "
-                  "file start at {}"
-                  .format(start_date, liq_start))
-            passed = False
-        if end_date > liq_end:
-            print("The simulation ends at {} wheras the liquid boundaries "
-                  "file ends at {}"
-                  .format(end_date, liq_end))
-            passed = False
-
-        if passed:
-            print("  ~> OK")
-        else:
-            print("  ~> Failed")
-
-
-    src_file = cas.get('SOURCES FILE')
-    if src_file != '' and module in ['telemac2d', 'telemac3d']:
-        print('  ~> Checking liquid boundaries file time coherence')
-        time_start, time_end, date = get_lid_date(src_file)
-
-        src_start = date + timedelta(seconds=time_start)
-        src_end = date + timedelta(seconds=time_end)
-        print("Time range of the source data  {} to {}"
-              .format(src_start, src_end))
-
-        if start_date < src_start:
-            print("The simulation start at {} wheras the sources "
-                  "file start at {}"
-                  .format(start_date, src_start))
-            passed = False
-        if end_date > src_end:
-            print("The simulation ends at {} wheras the sources "
-                  "file ends at {}"
-                  .format(end_date, src_end))
-            passed = False
-
-        if passed:
-            print("  ~> OK")
-        else:
-            print("  ~> Failed")
-
-    bnd_bin_file = cas.get('BINARY BOUNDARY DATA FILE', '')
-    if bnd_bin_file != '' and module in ['telemac3d']:
-        print('  ~> Checking atmo binary file time coherence')
-        bnd_bin_date, time_start, time_end = get_file_date(bnd_bin_file)
-        bnd_bin_start = bnd_bin_date + timedelta(seconds=time_start)
-        bnd_bin_end = bnd_bin_date + timedelta(seconds=time_end)
-        print("Time range of the atmospheric data  {} to {}"
-              .format(bnd_bin_start, bnd_bin_end))
-
-        if start_date < bnd_bin_start:
-            print("The simulation start at {} wheras the binary boundary"
-                  "file start at {}"
-                  .format(start_date, bnd_bin_start))
-            passed = False
-        if end_date > bnd_bin_end:
-            print("The simulation ends at {} wheras the binary boundary "
-                  "file ends at {}"
-                  .format(end_date, bnd_bin_end))
-            passed = False
-
-        if passed:
-            print("  ~> OK")
-        else:
-            print("  ~> Failed")
+    if module in ['telemac2d', 'telemac3d']:
+        atmospheric_file = cas.get('BINARY ATMOSPHERIC DATA FILE')
+        if atmospheric_file != '':
+            print('  ~> Checking atmo binary file time coherence')
+            meteo_date, time_start, time_end = get_file_date(atmospheric_file)
+            meteo_start = meteo_date + timedelta(seconds=time_start)
+            meteo_end = meteo_date + timedelta(seconds=time_end)
+            print("Time range of the atmospheric data  {} to {}"
+                  .format(meteo_start, meteo_end))
+
+            if start_date < meteo_start:
+                print("The simulation starts at {} whereas the atmo binary "
+                      "file starts at {}"
+                      .format(start_date, meteo_start))
+                passed = False
+            if end_date > meteo_end:
+                print("The simulation ends at {} whereas the atmo binary "
+                      "file ends at {}"
+                      .format(end_date, meteo_end))
+                passed = False
+
+            if passed:
+                print("  ~> OK")
+            else:
+                print("  ~> Failed")
+
+    if module in ['telemac2d', 'telemac3d']:
+        ascii_meteo_file = cas.get('ASCII ATMOSPHERIC DATA FILE')
+        if ascii_meteo_file != '':
+            free_atmo = cas.get('FREE FORMAT FOR ATMOSPHERIC DATA FILE')
+            if free_atmo == False:
+                print('  ~> Checking atmo ascii file time coherence')
+                time_start, time_end, date = get_lid_date(ascii_meteo_file)
+
+                meteo_start = date + timedelta(seconds=time_start)
+                meteo_end = date + timedelta(seconds=time_end)
+                print("Time range of the atmospheric data  {} to {}"
+                      .format(meteo_start, meteo_end))
+
+                if start_date < meteo_start:
+                    print("The simulation starts at {} whereas the atmo ascii "
+                          "file starts at {}"
+                          .format(start_date, meteo_start))
+                    passed = False
+                if end_date > meteo_end:
+                    print("The simulation ends at {} whereas the atmo ascii "
+                          "file ends at {}"
+                          .format(end_date, meteo_end))
+                    passed = False
+
+                if passed:
+                    print("  ~> OK")
+                else:
+                    print("  ~> Failed")
+            else:
+                print('  ~> No checking atmo ascii file time coherence as free format')
+
+    if module in ['telemac2d', 'telemac3d']:
+        liq_bnd_file = cas.get('LIQUID BOUNDARIES FILE')
+        if liq_bnd_file != '':
+            print('  ~> Checking liquid boundaries file time coherence')
+            time_start, time_end, date = get_lid_date(liq_bnd_file)
+
+            liq_start = date + timedelta(seconds=time_start)
+            liq_end = date + timedelta(seconds=time_end)
+            print("Time range of the liquid boundary data  {} to {}"
+                  .format(liq_start, liq_end))
+
+            if start_date < liq_start:
+                print("The simulation starts at {} whereas the liquid boundaries "
+                      "file starts at {}"
+                      .format(start_date, liq_start))
+                passed = False
+            if end_date > liq_end:
+                print("The simulation ends at {} whereas the liquid boundaries "
+                      "file ends at {}"
+                      .format(end_date, liq_end))
+                passed = False
+
+            if passed:
+                print("  ~> OK")
+            else:
+                print("  ~> Failed")
+
+    if module in ['telemac2d', 'telemac3d']:
+        src_file = cas.get('SOURCES FILE')
+        if src_file != '':
+            print('  ~> Checking sources file time coherence')
+            time_start, time_end, date = get_lid_date(src_file)
+
+            src_start = date + timedelta(seconds=time_start)
+            src_end = date + timedelta(seconds=time_end)
+            print("Time range of the source data  {} to {}"
+                  .format(src_start, src_end))
+
+            if start_date < src_start:
+                print("The simulation starts at {} whereas the sources "
+                      "file starts at {}"
+                      .format(start_date, src_start))
+                passed = False
+            if end_date > src_end:
+                print("The simulation ends at {} whereas the sources "
+                      "file ends at {}"
+                      .format(end_date, src_end))
+                passed = False
+
+            if passed:
+                print("  ~> OK")
+            else:
+                print("  ~> Failed")
+
+    if module in ['telemac3d']:
+        bnd_bin_file = cas.get('BINARY BOUNDARY DATA FILE', '')
+        if bnd_bin_file != '':
+            print('  ~> Checking binary boundary file time coherence')
+            bnd_bin_date, time_start, time_end = get_file_date(bnd_bin_file)
+            bnd_bin_start = bnd_bin_date + timedelta(seconds=time_start)
+            bnd_bin_end = bnd_bin_date + timedelta(seconds=time_end)
+            print("Time range of the atmospheric data  {} to {}"
+                  .format(bnd_bin_start, bnd_bin_end))
+
+            if start_date < bnd_bin_start:
+                print("The simulation starts at {} whereas the binary boundary"
+                      "file starts at {}"
+                      .format(start_date, bnd_bin_start))
+                passed = False
+            if end_date > bnd_bin_end:
+                print("The simulation ends at {} whereas the binary boundary "
+                      "file ends at {}"
+                      .format(end_date, bnd_bin_end))
+                passed = False
+
+            if passed:
+                print("  ~> OK")
+            else:
+                print("  ~> Failed")
-- 
GitLab


From 50bd26fc852be737274ffa9b897deabdbd0d8972 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Chi-Tu=C3=A2n=20Pham?= <chi-tuan.pham@edf.fr>
Date: Wed, 26 Mar 2025 12:38:49 +0100
Subject: [PATCH 2/4] Update NEWS.txt file

---
 NEWS.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NEWS.txt b/NEWS.txt
index 84d80f3356..4ec8d4a1b8 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,9 @@
 Latest changes
 ==============
 
+Python: fix several bugs when using manip_cas.py script to check steering files
+and time consistence with input files
+
 HERMES: read boundary information in MED files regardless of the presence or
 not of a boundary conditions file
 
-- 
GitLab


From a180c85690754383c2b2e8fc71451e69d681e266 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Chi-Tu=C3=A2n=20Pham?= <chi-tuan.pham@edf.fr>
Date: Wed, 26 Mar 2025 12:40:59 +0100
Subject: [PATCH 3/4] [scripts] Change after running last pylint

---
 scripts/python3/pretel/check_cas.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/python3/pretel/check_cas.py b/scripts/python3/pretel/check_cas.py
index b7b0aa057b..6631d3f53e 100644
--- a/scripts/python3/pretel/check_cas.py
+++ b/scripts/python3/pretel/check_cas.py
@@ -195,7 +195,7 @@ def check_time(module, cas):
         ascii_meteo_file = cas.get('ASCII ATMOSPHERIC DATA FILE')
         if ascii_meteo_file != '':
             free_atmo = cas.get('FREE FORMAT FOR ATMOSPHERIC DATA FILE')
-            if free_atmo == False:
+            if free_atmo is False:
                 print('  ~> Checking atmo ascii file time coherence')
                 time_start, time_end, date = get_lid_date(ascii_meteo_file)
 
-- 
GitLab


From 1f00d381c30ca1ecb7d299edca1e6256a14c2cc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Chi-Tu=C3=A2n=20Pham?= <chi-tuan.pham@edf.fr>
Date: Wed, 2 Apr 2025 12:28:15 +0200
Subject: [PATCH 4/4] Apply suggestions from reviewer Boris Basic

---
 scripts/python3/pretel/check_cas.py | 241 ++++++++++++++--------------
 1 file changed, 121 insertions(+), 120 deletions(-)

diff --git a/scripts/python3/pretel/check_cas.py b/scripts/python3/pretel/check_cas.py
index 6631d3f53e..a84d9da562 100644
--- a/scripts/python3/pretel/check_cas.py
+++ b/scripts/python3/pretel/check_cas.py
@@ -165,23 +165,53 @@ def check_time(module, cas):
     print("Starting date: {}".format(start_date))
     print("Ending date:   {}".format(end_date))
 
-    if module in ['telemac2d', 'telemac3d']:
-        atmospheric_file = cas.get('BINARY ATMOSPHERIC DATA FILE')
-        if atmospheric_file != '':
-            print('  ~> Checking atmo binary file time coherence')
-            meteo_date, time_start, time_end = get_file_date(atmospheric_file)
-            meteo_start = meteo_date + timedelta(seconds=time_start)
-            meteo_end = meteo_date + timedelta(seconds=time_end)
+    if module not in ['telemac2d', 'telemac3d']:
+        return
+
+    atmospheric_file = cas.get('BINARY ATMOSPHERIC DATA FILE')
+    if atmospheric_file != '':
+        print('  ~> Checking atmo binary file time coherence')
+        meteo_date, time_start, time_end = get_file_date(atmospheric_file)
+        meteo_start = meteo_date + timedelta(seconds=time_start)
+        meteo_end = meteo_date + timedelta(seconds=time_end)
+        print("Time range of the atmospheric data  {} to {}"
+              .format(meteo_start, meteo_end))
+
+        if start_date < meteo_start:
+            print("The simulation starts at {} whereas the atmo binary "
+                  "file starts at {}"
+                  .format(start_date, meteo_start))
+            passed = False
+        if end_date > meteo_end:
+            print("The simulation ends at {} whereas the atmo binary "
+                  "file ends at {}"
+                  .format(end_date, meteo_end))
+            passed = False
+
+        if passed:
+            print("  ~> OK")
+        else:
+            print("  ~> Failed")
+
+    ascii_meteo_file = cas.get('ASCII ATMOSPHERIC DATA FILE')
+    if ascii_meteo_file != '':
+        free_atmo = cas.get('FREE FORMAT FOR ATMOSPHERIC DATA FILE')
+        if free_atmo is False:
+            print('  ~> Checking atmo ascii file time coherence')
+            time_start, time_end, date = get_lid_date(ascii_meteo_file)
+
+            meteo_start = date + timedelta(seconds=time_start)
+            meteo_end = date + timedelta(seconds=time_end)
             print("Time range of the atmospheric data  {} to {}"
                   .format(meteo_start, meteo_end))
 
             if start_date < meteo_start:
-                print("The simulation starts at {} whereas the atmo binary "
+                print("The simulation starts at {} whereas the atmo ascii "
                       "file starts at {}"
                       .format(start_date, meteo_start))
                 passed = False
             if end_date > meteo_end:
-                print("The simulation ends at {} whereas the atmo binary "
+                print("The simulation ends at {} whereas the atmo ascii "
                       "file ends at {}"
                       .format(end_date, meteo_end))
                 passed = False
@@ -190,114 +220,85 @@ def check_time(module, cas):
                 print("  ~> OK")
             else:
                 print("  ~> Failed")
-
-    if module in ['telemac2d', 'telemac3d']:
-        ascii_meteo_file = cas.get('ASCII ATMOSPHERIC DATA FILE')
-        if ascii_meteo_file != '':
-            free_atmo = cas.get('FREE FORMAT FOR ATMOSPHERIC DATA FILE')
-            if free_atmo is False:
-                print('  ~> Checking atmo ascii file time coherence')
-                time_start, time_end, date = get_lid_date(ascii_meteo_file)
-
-                meteo_start = date + timedelta(seconds=time_start)
-                meteo_end = date + timedelta(seconds=time_end)
-                print("Time range of the atmospheric data  {} to {}"
-                      .format(meteo_start, meteo_end))
-
-                if start_date < meteo_start:
-                    print("The simulation starts at {} whereas the atmo ascii "
-                          "file starts at {}"
-                          .format(start_date, meteo_start))
-                    passed = False
-                if end_date > meteo_end:
-                    print("The simulation ends at {} whereas the atmo ascii "
-                          "file ends at {}"
-                          .format(end_date, meteo_end))
-                    passed = False
-
-                if passed:
-                    print("  ~> OK")
-                else:
-                    print("  ~> Failed")
-            else:
-                print('  ~> No checking atmo ascii file time coherence as free format')
-
-    if module in ['telemac2d', 'telemac3d']:
-        liq_bnd_file = cas.get('LIQUID BOUNDARIES FILE')
-        if liq_bnd_file != '':
-            print('  ~> Checking liquid boundaries file time coherence')
-            time_start, time_end, date = get_lid_date(liq_bnd_file)
-
-            liq_start = date + timedelta(seconds=time_start)
-            liq_end = date + timedelta(seconds=time_end)
-            print("Time range of the liquid boundary data  {} to {}"
-                  .format(liq_start, liq_end))
-
-            if start_date < liq_start:
-                print("The simulation starts at {} whereas the liquid boundaries "
-                      "file starts at {}"
-                      .format(start_date, liq_start))
-                passed = False
-            if end_date > liq_end:
-                print("The simulation ends at {} whereas the liquid boundaries "
-                      "file ends at {}"
-                      .format(end_date, liq_end))
-                passed = False
-
-            if passed:
-                print("  ~> OK")
-            else:
-                print("  ~> Failed")
-
-    if module in ['telemac2d', 'telemac3d']:
-        src_file = cas.get('SOURCES FILE')
-        if src_file != '':
-            print('  ~> Checking sources file time coherence')
-            time_start, time_end, date = get_lid_date(src_file)
-
-            src_start = date + timedelta(seconds=time_start)
-            src_end = date + timedelta(seconds=time_end)
-            print("Time range of the source data  {} to {}"
-                  .format(src_start, src_end))
-
-            if start_date < src_start:
-                print("The simulation starts at {} whereas the sources "
-                      "file starts at {}"
-                      .format(start_date, src_start))
-                passed = False
-            if end_date > src_end:
-                print("The simulation ends at {} whereas the sources "
-                      "file ends at {}"
-                      .format(end_date, src_end))
-                passed = False
-
-            if passed:
-                print("  ~> OK")
-            else:
-                print("  ~> Failed")
-
-    if module in ['telemac3d']:
-        bnd_bin_file = cas.get('BINARY BOUNDARY DATA FILE', '')
-        if bnd_bin_file != '':
-            print('  ~> Checking binary boundary file time coherence')
-            bnd_bin_date, time_start, time_end = get_file_date(bnd_bin_file)
-            bnd_bin_start = bnd_bin_date + timedelta(seconds=time_start)
-            bnd_bin_end = bnd_bin_date + timedelta(seconds=time_end)
-            print("Time range of the atmospheric data  {} to {}"
-                  .format(bnd_bin_start, bnd_bin_end))
-
-            if start_date < bnd_bin_start:
-                print("The simulation starts at {} whereas the binary boundary"
-                      "file starts at {}"
-                      .format(start_date, bnd_bin_start))
-                passed = False
-            if end_date > bnd_bin_end:
-                print("The simulation ends at {} whereas the binary boundary "
-                      "file ends at {}"
-                      .format(end_date, bnd_bin_end))
-                passed = False
-
-            if passed:
-                print("  ~> OK")
-            else:
-                print("  ~> Failed")
+        else:
+            print('  ~> No checking atmo ascii file time coherence as free format')
+
+    liq_bnd_file = cas.get('LIQUID BOUNDARIES FILE')
+    if liq_bnd_file != '':
+        print('  ~> Checking liquid boundaries file time coherence')
+        time_start, time_end, date = get_lid_date(liq_bnd_file)
+
+        liq_start = date + timedelta(seconds=time_start)
+        liq_end = date + timedelta(seconds=time_end)
+        print("Time range of the liquid boundary data  {} to {}"
+              .format(liq_start, liq_end))
+
+        if start_date < liq_start:
+            print("The simulation starts at {} whereas the liquid boundaries "
+                  "file starts at {}"
+                  .format(start_date, liq_start))
+            passed = False
+        if end_date > liq_end:
+            print("The simulation ends at {} whereas the liquid boundaries "
+                "file ends at {}"
+                  .format(end_date, liq_end))
+            passed = False
+
+        if passed:
+            print("  ~> OK")
+        else:
+            print("  ~> Failed")
+
+    src_file = cas.get('SOURCES FILE')
+    if src_file != '':
+        print('  ~> Checking sources file time coherence')
+        time_start, time_end, date = get_lid_date(src_file)
+
+        src_start = date + timedelta(seconds=time_start)
+        src_end = date + timedelta(seconds=time_end)
+        print("Time range of the source data  {} to {}"
+              .format(src_start, src_end))
+
+        if start_date < src_start:
+            print("The simulation starts at {} whereas the sources "
+                  "file starts at {}"
+                  .format(start_date, src_start))
+            passed = False
+        if end_date > src_end:
+            print("The simulation ends at {} whereas the sources "
+                  "file ends at {}"
+                  .format(end_date, src_end))
+            passed = False
+
+        if passed:
+            print("  ~> OK")
+        else:
+            print("  ~> Failed")
+
+    if module != 'telemac3d':
+        return
+
+    bnd_bin_file = cas.get('BINARY BOUNDARY DATA FILE', '')
+    if bnd_bin_file != '':
+        print('  ~> Checking binary boundary file time coherence')
+        bnd_bin_date, time_start, time_end = get_file_date(bnd_bin_file)
+        bnd_bin_start = bnd_bin_date + timedelta(seconds=time_start)
+        bnd_bin_end = bnd_bin_date + timedelta(seconds=time_end)
+        print("Time range of the atmospheric data  {} to {}"
+              .format(bnd_bin_start, bnd_bin_end))
+
+        if start_date < bnd_bin_start:
+            print("The simulation starts at {} whereas the binary boundary"
+                  "file starts at {}"
+                  .format(start_date, bnd_bin_start))
+            passed = False
+        if end_date > bnd_bin_end:
+            print("The simulation ends at {} whereas the binary boundary "
+                  "file ends at {}"
+                  .format(end_date, bnd_bin_end))
+            passed = False
+
+        if passed:
+            print("  ~> OK")
+        else:
+            print("  ~> Failed")
-- 
GitLab