SQL: Read table 'Calibration'.

dev-parouby
Pierre-Antoine 2025-03-26 13:32:37 +01:00
parent 7a41eace33
commit bec1b529a6
1 changed files with 52 additions and 19 deletions

View File

@ -81,6 +81,7 @@ class ReadTableForOpen:
self.read_table_settings()
self.read_table_sediment_file()
self.read_table_table_sediment_data()
self.read_table_table_calibration()
logger.debug(f"Reading '{stg.filename_open}' done")
@ -560,32 +561,32 @@ class ReadTableForOpen:
stg.frac_vol_sand = []
stg.frac_vol_sand_cumul = []
for f in range(len(data)):
stg.sample_fine.append((data[f][0], data[f][1]))
stg.distance_from_bank_fine.append(data[f][2])
stg.depth_fine.append(data[f][3])
stg.time_fine.append(data[f][4])
stg.Ctot_fine.append(data[f][5])
stg.Ctot_fine_per_cent.append(data[f][6])
stg.D50_fine.append(data[f][7])
for d in data:
stg.sample_fine.append((d[0], d[1]))
stg.distance_from_bank_fine.append(d[2])
stg.depth_fine.append(d[3])
stg.time_fine.append(d[4])
stg.Ctot_fine.append(d[5])
stg.Ctot_fine_per_cent.append(d[6])
stg.D50_fine.append(d[7])
stg.frac_vol_fine.append(
np_f64_parse(data[f][8])
np_f64_parse(d[8])
)
stg.frac_vol_fine_cumul.append(
np_f64_parse(data[f][9])
np_f64_parse(d[9])
)
stg.sample_sand.append((data[f][10], data[f][11]))
stg.distance_from_bank_sand.append(data[f][12])
stg.depth_sand.append(data[f][13])
stg.time_sand.append(data[f][14])
stg.Ctot_sand.append(data[f][15])
stg.Ctot_sand_per_cent.append(data[f][16])
stg.D50_sand.append(data[f][17])
stg.sample_sand.append((d[10], d[11]))
stg.distance_from_bank_sand.append(d[12])
stg.depth_sand.append(d[13])
stg.time_sand.append(d[14])
stg.Ctot_sand.append(d[15])
stg.Ctot_sand_per_cent.append(d[16])
stg.D50_sand.append(d[17])
stg.frac_vol_sand.append(
np_f64_parse(data[f][18])
np_f64_parse(d[18])
)
stg.frac_vol_sand_cumul.append(
np_f64_parse(data[f][19])
np_f64_parse(d[19])
)
stg.frac_vol_fine = np.array(stg.frac_vol_fine)
@ -594,3 +595,35 @@ class ReadTableForOpen:
stg.frac_vol_sand_cumul = np.array(stg.frac_vol_sand_cumul)
logger.debug(f"fine: {stg.Ctot_fine}, sand: {stg.sample_sand}")
def read_table_table_calibration(self):
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
query = f'''
SELECT
path_calibration_file,
filename_calibration_file,
range_lin_interp,
M_profile_fine,
ks, sv,
X_exponent,
alpha_s, zeta, FCB,
depth_real, lin_reg
FROM Calibration
'''
data = self.execute(query)
it = iter(data[0])
stg.path_calibration_file = next(it)
stg.filename_calibration_file = next(it)
stg.range_lin_interp = np_f64_parse(next(it))
stg.M_profile_fine = np_f64_parse(next(it))
stg.ks = np_f64_parse(next(it))
stg.sv = np_f64_parse(next(it))
stg.X_exponent = np_f64_parse(next(it))
stg.alpha_s = np_f64_parse(next(it))
stg.zeta = np_f64_parse(next(it))
stg.FCB = np_f64_parse(next(it))
stg.depth_real = np_f64_parse(next(it))
stg.lin_reg = np_f64_parse(next(it))