mirror of https://gitlab.com/pamhyr/pamhyr2
debug
parent
539b63f765
commit
0a0eeb3c3f
|
|
@ -880,29 +880,29 @@ class AdisTSwc(AdisTS):
|
||||||
) - k)
|
) - k)
|
||||||
data = np.fromfile(f, dtype=np.int32, count=1) # (end)
|
data = np.fromfile(f, dtype=np.int32, count=1) # (end)
|
||||||
|
|
||||||
# fifth line (useless)
|
# fifth line (useless)
|
||||||
|
data = np.fromfile(f, dtype=np.int32, count=1) # (start)
|
||||||
|
zmin_OLD = np.fromfile(f, dtype=np.float32, count=1)[0]
|
||||||
|
data = np.fromfile(f, dtype=np.int32, count=1) # (end)
|
||||||
|
# sixth line
|
||||||
|
zf = np.zeros(ismax, dtype=np.float32)
|
||||||
|
z = np.zeros(ismax * 3, dtype=np.float32)
|
||||||
|
for k in range(0, ismax, kbl):
|
||||||
data = np.fromfile(f, dtype=np.int32, count=1) # (start)
|
data = np.fromfile(f, dtype=np.int32, count=1) # (start)
|
||||||
zmin_OLD = np.fromfile(f, dtype=np.float32, count=1)[0]
|
z[3 * k:3 * min(k + kbl, ismax)] = \
|
||||||
|
np.fromfile(f,
|
||||||
|
dtype=np.float32,
|
||||||
|
count=3 * (min(k + kbl, ismax) - k)
|
||||||
|
)
|
||||||
|
# z[i*3+1] and z[i*3+2] are useless
|
||||||
data = np.fromfile(f, dtype=np.int32, count=1) # (end)
|
data = np.fromfile(f, dtype=np.int32, count=1) # (end)
|
||||||
# sixth line
|
zf = [z[i * 3] for i in range(ismax)]
|
||||||
zf = np.zeros(ismax, dtype=np.float32)
|
# seventh line (useless)
|
||||||
z = np.zeros(ismax * 3, dtype=np.float32)
|
for k in range(0, ismax, kbl):
|
||||||
for k in range(0, ismax, kbl):
|
data = np.fromfile(f, dtype=np.int32, count=1) # (start)
|
||||||
data = np.fromfile(f, dtype=np.int32, count=1) # (start)
|
zero = np.fromfile(f, dtype=np.int32, count=ismax)
|
||||||
z[3 * k:3 * min(k + kbl, ismax)] = \
|
data = np.fromfile(f, dtype=np.int32, count=1) # (end)
|
||||||
np.fromfile(f,
|
# end header
|
||||||
dtype=np.float32,
|
|
||||||
count=3 * (min(k + kbl, ismax) - k)
|
|
||||||
)
|
|
||||||
# z[i*3+1] and z[i*3+2] are useless
|
|
||||||
data = np.fromfile(f, dtype=np.int32, count=1) # (end)
|
|
||||||
zf = [z[i * 3] for i in range(ismax)]
|
|
||||||
# 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)
|
|
||||||
data = np.fromfile(f, dtype=np.int32, count=1) # (end)
|
|
||||||
# end header
|
|
||||||
|
|
||||||
def ip_to_r(i):
|
def ip_to_r(i):
|
||||||
return iprofiles[
|
return iprofiles[
|
||||||
|
|
@ -924,6 +924,7 @@ class AdisTSwc(AdisTS):
|
||||||
for file_bin in path_files:
|
for file_bin in path_files:
|
||||||
key_pol = os.path.basename(file_bin)[0:-4]
|
key_pol = os.path.basename(file_bin)[0:-4]
|
||||||
data_tmp[key_pol] = {}
|
data_tmp[key_pol] = {}
|
||||||
|
logger.info(f"read_bin: Start reading '{file_bin}' ...")
|
||||||
with open(file_bin, 'rb') as f:
|
with open(file_bin, 'rb') as f:
|
||||||
# header
|
# header
|
||||||
# first line
|
# first line
|
||||||
|
|
@ -975,7 +976,7 @@ class AdisTSwc(AdisTS):
|
||||||
# seventh line (useless)
|
# seventh line (useless)
|
||||||
for k in range(0, ismax, kbl):
|
for k in range(0, ismax, kbl):
|
||||||
data = np.fromfile(f, dtype=np.int32, count=1) # (start)
|
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)
|
data = np.fromfile(f, dtype=np.int32, count=1) # (end)
|
||||||
# end header
|
# end header
|
||||||
# data
|
# data
|
||||||
|
|
@ -1006,7 +1007,6 @@ class AdisTSwc(AdisTS):
|
||||||
for r, reach in enumerate(reachs):
|
for r, reach in enumerate(reachs):
|
||||||
for i in range(is1[r]-1, is2[r]):
|
for i in range(is1[r]-1, is2[r]):
|
||||||
p_i = ip_to_ri(reach, i)
|
p_i = ip_to_ri(reach, i)
|
||||||
|
|
||||||
for t_data in timestamps_keys:
|
for t_data in timestamps_keys:
|
||||||
pol_view = []
|
pol_view = []
|
||||||
for pol in pollutants_keys:
|
for pol in pollutants_keys:
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import time
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
from tools import timer, trace, logger_exception
|
from tools import timer, trace, logger_exception
|
||||||
|
|
@ -946,6 +947,7 @@ class Mage8(Mage):
|
||||||
@timer
|
@timer
|
||||||
def read_bin(self, study, fname, results, qlog=None, name="0"):
|
def read_bin(self, study, fname, results, qlog=None, name="0"):
|
||||||
logger.info(f"read_bin: Start reading '{fname}' ...")
|
logger.info(f"read_bin: Start reading '{fname}' ...")
|
||||||
|
start = time.time()
|
||||||
|
|
||||||
with mage_file_open(fname, "r") as f:
|
with mage_file_open(fname, "r") as f:
|
||||||
def newline(): return np.fromfile(f, dtype=np.int32, count=1)
|
def newline(): return np.fromfile(f, dtype=np.int32, count=1)
|
||||||
|
|
@ -1092,8 +1094,7 @@ class Mage8(Mage):
|
||||||
logger.info(f"compute tab...")
|
logger.info(f"compute tab...")
|
||||||
for r in reachs:
|
for r in reachs:
|
||||||
for p in r.profiles:
|
for p in r.profiles:
|
||||||
if not p.geometry.tab_up_to_date:
|
p.geometry.compute_tabulation()
|
||||||
p.geometry.compute_tabulation()
|
|
||||||
|
|
||||||
logger.info(f"compute velocily...")
|
logger.info(f"compute velocily...")
|
||||||
|
|
||||||
|
|
@ -1110,6 +1111,7 @@ class Mage8(Mage):
|
||||||
results.bufferize("Z")
|
results.bufferize("Z")
|
||||||
results.bufferize("Q")
|
results.bufferize("Q")
|
||||||
results.bufferize("V")
|
results.bufferize("V")
|
||||||
|
logger.info(f"reading time: '{time.time() - start}'")
|
||||||
|
|
||||||
@timer
|
@timer
|
||||||
def read_gra(self, study, repertory, results, qlog=None, name="0"):
|
def read_gra(self, study, repertory, results, qlog=None, name="0"):
|
||||||
|
|
@ -1118,6 +1120,7 @@ class Mage8(Mage):
|
||||||
|
|
||||||
fname = os.path.join(repertory, f"{name}.GRA")
|
fname = os.path.join(repertory, f"{name}.GRA")
|
||||||
logger.info(f"read_gra: Start reading '{fname}' ...")
|
logger.info(f"read_gra: Start reading '{fname}' ...")
|
||||||
|
start = time.time()
|
||||||
|
|
||||||
with mage_file_open(fname, "r") as f:
|
with mage_file_open(fname, "r") as f:
|
||||||
def newline(): return np.fromfile(f, dtype=np.int32, count=1)
|
def newline(): return np.fromfile(f, dtype=np.int32, count=1)
|
||||||
|
|
@ -1313,6 +1316,7 @@ class Mage8(Mage):
|
||||||
|
|
||||||
results.set("sediment_timestamps", ts)
|
results.set("sediment_timestamps", ts)
|
||||||
logger.info(f"read_gra: ... end with {len(ts)} timestamp read")
|
logger.info(f"read_gra: ... end with {len(ts)} timestamp read")
|
||||||
|
logger.debug(f"reading time: '{time.time() - start}'")
|
||||||
|
|
||||||
@timer
|
@timer
|
||||||
def results(self, study, repertory,
|
def results(self, study, repertory,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue