Commit 6f56c772 authored by JOSSOUD Olivier's avatar JOSSOUD Olivier
Browse files

Flow. Get picarro by melt time

parent da8de1d1
Pipeline #157724 passed with stages
in 1 minute and 30 seconds
......@@ -488,11 +488,45 @@ def get_conduct_by_melt_time(arrival_df: pd.DataFrame, conduct_df: pd.DataFrame,
conduct_rescaled_path = os.path.join(export_in_dataset.dataset_path,
export_in_dataset.dataset_name + "_CONDUCTI-R_periodic.log")
conduct_rescaled_df.index.name = 'datetime'
conduct_rescaled_df.to_csv(conduct_rescaled_path, date_format="%Y-%m-%dT%H:%M:%SZ", sep="\t")
conduct_rescaled_df.to_csv(conduct_rescaled_path, date_format="%Y-%m-%dT%H:%M:%S.fZ", sep="\t")
return conduct_rescaled_df
def get_picarro_by_melt_time(arrival_df: pd.DataFrame,
picarro_df: pd.DataFrame,
export_in_dataset: DatasetReader = None) -> pd.DataFrame:
"""Get the Picarro values as a function of the sample melting time.
Parameters
----------
arrival_df: pd.DataFrame
Output of :func:`get_arrival_df` function.
picarro_df: pd.DataFrame
Picarro's timestamped data, as obtained with :func:`get_datasets_data` function.
export_in_dataset: DatasetReader, optional
If set, the resulting dataset will be exported as .log file in the regular "Dataset" place and format, making it
readable by cfa-analysis software.
Returns
-------
pd.DataFrame
Index is the datetime when the ice section was melted. Each column give the Picarro (H2O & isotope) value of
this ice section.
"""
arrival_picarro_df = arrival_df[["picarro"]]
picarro_rescaled_df = pd.merge_asof(arrival_picarro_df["picarro"], picarro_df, left_on="picarro", right_index=True)
picarro_rescaled_df = picarro_rescaled_df.drop(columns=["picarro"])
if export_in_dataset is not None:
picarro_rescaled_path = os.path.join(export_in_dataset.dataset_path,
export_in_dataset.dataset_name + "_PICARRO-R_periodic.log")
picarro_rescaled_df.index.name = 'datetime'
picarro_rescaled_df.to_csv(picarro_rescaled_path, date_format="%Y-%m-%dT%H:%M:%S.%fZ", sep="\t")
return picarro_rescaled_df
def __compute_mm__(df: pd.DataFrame) -> pd.DataFrame:
df["datetime"] = df.index
df["mm_step"] = df["speed"].abs() * df["datetime"].diff().dt.total_seconds().fillna(0)
......
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