import numpy as np import pandas as pd class GranuloLoader: """ This class allows to load granulo data file """ def __init__(self, path: str): self._path = path self._data = pd.read_excel(self._path, engine="odf", header=0) self._time = np.array(self._data.iloc[:, 0]) self._y = np.array(self._data.iloc[:, 1]) # distance from left bank (m) self._z = np.array(self._data.iloc[:, 2]) # depth (m) self._r_grain = np.array(self._data.columns.values)[5:] # grain radius (um) self._Ctot = np.array(self._data.iloc[:, 3]) # Total concentration (g/L) self._D50 = np.array(self._data.iloc[:, 4]) # median diameter (um) self._frac_vol = np.array(self._data.iloc[:, 5:]) # Volume fraction (%) self._frac_vol_cumul = np.cumsum(self._frac_vol, 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) # print(self._time) # 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")