Compare commits

...

2 Commits

Author SHA1 Message Date
Theophile Terraz b6a6d54a22 Merge branch 'scenarios' of gitlab.com:pamhyr/pamhyr2 into scenarios 2026-05-12 16:17:32 +02:00
Theophile Terraz 11a95cb391 debug 2026-05-12 16:16:56 +02:00
2 changed files with 29 additions and 25 deletions

View File

@ -793,6 +793,7 @@ class AdisTSwc(AdisTS):
for file_bin in path_files:
key_pol = os.path.basename(file_bin)[0:-4]
data_tmp[key_pol] = {}
logger.info(f"read_bin: Start reading '{file_bin}' ...")
with open(file_bin, 'rb') as f:
# header
# first line
@ -844,7 +845,7 @@ class AdisTSwc(AdisTS):
# seventh line (useless)
for k in range(0, ismax, kbl):
data = np.fromfile(f, dtype=np.int32, count=1) # (start)
zero = np.fromfile(f, dtype=np.int32, count=ismax)
zero = np.fromfile(f, dtype=np.int32, count=min(k + kbl, ismax) - k)
data = np.fromfile(f, dtype=np.int32, count=1) # (end)
# end header
# data
@ -875,7 +876,6 @@ class AdisTSwc(AdisTS):
for r, reach in enumerate(reachs):
for i in range(is1[r]-1, is2[r]):
p_i = ip_to_ri(reach, i)
for t_data in timestamps_keys:
pol_view = []
for pol in pollutants_keys:

View File

@ -19,6 +19,7 @@
import os
import logging
import numpy as np
import time
from functools import reduce
from itertools import chain
@ -1036,6 +1037,7 @@ class Mage8(Mage):
@timer
def read_bin(self, study, fname, results, qlog=None, name="0"):
logger.info(f"read_bin: Start reading '{fname}' ...")
start = time.time()
with mage_file_open(fname, "r") as f:
def newline(): return np.fromfile(f, dtype=np.int32, count=1)
@ -1182,7 +1184,6 @@ class Mage8(Mage):
logger.info(f"compute tab...")
for r in reachs:
for p in r.profiles:
if not p.geometry.tab_up_to_date:
p.geometry.compute_tabulation()
logger.info(f"compute velocily...")
@ -1200,6 +1201,7 @@ class Mage8(Mage):
results.bufferize("Z")
results.bufferize("Q")
results.bufferize("V")
logger.info(f"reading time: '{time.time() - start}'")
@timer
def read_gra(self, study, repertory, results, qlog=None, name="0"):
@ -1208,6 +1210,7 @@ class Mage8(Mage):
fname = os.path.join(repertory, f"{name}.GRA")
logger.info(f"read_gra: Start reading '{fname}' ...")
start = time.time()
with mage_file_open(fname, "r") as f:
def newline(): return np.fromfile(f, dtype=np.int32, count=1)
@ -1403,6 +1406,7 @@ class Mage8(Mage):
results.set("sediment_timestamps", ts)
logger.info(f"read_gra: ... end with {len(ts)} timestamp read")
logger.debug(f"reading time: '{time.time() - start}'")
@timer
def results(self, study, repertory,