Commit 83d776be authored by JOSSOUD Olivier's avatar JOSSOUD Olivier
Browse files

Flow. Use intermediate iceblocks.csv file for more convenient viewing/editing.

parent 5f4f24b7
Pipeline #153663 passed with stages
in 1 minute and 25 seconds
......@@ -238,7 +238,7 @@ def get_bubble_density_from_conduct(dataset: DatasetReader):
return compump_df
def get_datasets_data(dataset: DatasetReader)\
def get_datasets_data(dataset: DatasetReader, retrieve_iceblocks_from_processed_csv: bool = True)\
-> typing.Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]:
"""Get the dataframes useful for flow analysis
......@@ -246,6 +246,10 @@ def get_datasets_data(dataset: DatasetReader)\
dataset: DatasetReader
Dataset whose data should be retrieved.
retrieve_iceblocks_from_processed_csv: bool, optional
If `True`, the information about the iceblock sequence will be read from a processed file
(`processed/iceblocks.csv`; if it exists, otherwise it will be created). If `False`, the information will be
re-processed from `yyyymmdd_[dataset_name]_ICBKCTRL_instant.log` file. Default is `True`.
......@@ -257,8 +261,13 @@ def get_datasets_data(dataset: DatasetReader)\
encoder_df = encoder_df.drop(columns="speed_avg")
# Iceblock
iceblock_df = dataset.get_timeseries("ICBKCTRL_instant")
iceblock_df = iceblock.get_clean_iceblock_df(iceblock_df)
iceblock_filename = os.path.join(dataset.dataset_path, "processed", "iceblocks.csv")
if retrieve_iceblocks_from_processed_csv and os.path.exists(iceblock_filename):
iceblock_df = pd.read_csv(iceblock_filename, parse_dates=["datetime_start", "datetime_end", "datetime_stacked"])
iceblock_df = dataset.get_timeseries("ICBKCTRL_instant")
iceblock_df = iceblock.get_clean_iceblock_df(iceblock_df)
iceblock_df.to_csv(iceblock_filename, index=False, date_format="%Y-%m-%dT%H:%M:%SZ")
# Conductivity
conduct_df = dataset.get_timeseries("CONDUCTI_periodic")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment