47 lines
2.2 KiB
Python
47 lines
2.2 KiB
Python
import numpy as np
|
|
import pandas as pd
|
|
|
|
|
|
class GranuloLoader:
|
|
|
|
""" This class allows to load granulo data file """
|
|
|
|
def __init__(self, path_fine: str, path_sand: str):
|
|
|
|
# --- Load fine sediments data file ---
|
|
self.path_fine = path_fine
|
|
self._data_fine = pd.read_excel(self.path_fine, engine="odf", header=0)
|
|
|
|
self._y = np.array(self._data_fine.iloc[:, 0]) # distance from left bank (m)
|
|
self._z = np.array(self._data_fine.iloc[:, 1]) # depth (m)
|
|
self._r_grain = np.array(self._data_fine.columns.values)[4:] # grain radius (um)
|
|
|
|
self._Ctot_fine = np.array(self._data_fine.iloc[:, 2]) # Total concentration (g/L)
|
|
self._D50_fine = np.array(self._data_fine.iloc[:, 3]) # median diameter (um)
|
|
self._frac_vol_fine = np.array(self._data_fine.iloc[:, 4:]) # Volume fraction (%)
|
|
|
|
self._frac_vol_fine_cumul = np.cumsum(self._frac_vol_fine, axis=1) # Cumulated volume fraction (%)
|
|
|
|
# --- Load sand sediments data file ---
|
|
self.path_sand = path_sand
|
|
self._data_sand = pd.read_excel(self.path_sand, engine="odf", header=0)
|
|
|
|
self._Ctot_sand = np.array(self._data_sand.iloc[:, 2]) # Total concentration (g/L)
|
|
self._D50_sand = np.array(self._data_sand.iloc[:, 3]) # median diameter (um)
|
|
self._frac_vol_sand = np.array(self._data_sand.iloc[:, 4:]) # Volume fraction (%)
|
|
|
|
self._frac_vol_sand_cumul = np.cumsum(self._frac_vol_sand, axis=1) # Cumulated volume fraction (%)
|
|
|
|
# --- Compute % of fine and % of sand sediment in total concentration ---
|
|
|
|
self._Ctot_fine_per_cent = 100 * self._Ctot_fine / (self._Ctot_fine + self._Ctot_sand)
|
|
self._Ctot_sand_per_cent = 100 * self._Ctot_sand / (self._Ctot_fine + self._Ctot_sand)
|
|
|
|
|
|
# if __name__ == "__main__":
|
|
# GranuloLoader("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/Granulo_data/"
|
|
# "fine_sample_file.ods",
|
|
# "/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/Granulo_data/"
|
|
# "sand_sample_file.ods")
|
|
|