Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
JOSSOUD Olivier
CFA Tools
Commits
d8814a92
Commit
d8814a92
authored
Dec 06, 2021
by
JOSSOUD Olivier
Browse files
Flow. Get conductivity by melting time.
parent
77422a0c
Pipeline
#152027
passed with stages
in 1 minute and 38 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
cfatools/processor/flow.py
cfatools/processor/flow.py
+48
-0
No files found.
cfatools/processor/flow.py
View file @
d8814a92
...
...
@@ -433,6 +433,54 @@ def add_flask_info(arrival_df: pd.DataFrame, collector_df: pd.DataFrame) -> pd.D
return
arrival_df
def
get_conduct_by_melt_time
(
arrival_df
:
pd
.
DataFrame
,
conduct_df
:
pd
.
DataFrame
,
probes
:
list
=
[
"C1"
,
"C2"
,
"C3"
,
"C4"
,
"C5"
],
reference_datetime
:
str
=
None
,
export_in_dataset
:
DatasetReader
=
None
)
->
pd
.
DataFrame
:
"""Get the conductivity values as a function of the sample melting time.
Parameters
----------
arrival_df: pd.DataFrame
Output of :func:`get_arrival_df` function.
conduct_df: pd.DataFrame
Conductivity's timestamped data, as obtained with :func:`get_datasets_data` function.
probes: list, optional
List of probes (e.g. `["C1", "C2", "C3"]`) which should be computed.
reference_datetime: str, optional
If set, all the values of a probe will be subtracted by the value at the reference point. This is used in order
to "gather" all probes in the same area of the plot, thus minimizing the gap induced by the values of the
non-calibrated probes. It eases the conductivity peak's comparison over several probes.
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 conductivity value of this ice
section.
"""
conduct_arrival_df
=
arrival_df
[
probes
]
conduct_rescaled_df
=
pd
.
DataFrame
(
columns
=
probes
)
for
probe
in
probes
:
df
=
pd
.
merge_asof
(
conduct_arrival_df
[
probe
],
conduct_df
[
probe
],
left_on
=
probe
,
right_index
=
True
)
df
=
df
[
probe
+
"_y"
].
rename
(
probe
)
if
reference_datetime
is
not
None
:
idx_ref
=
df
.
index
.
searchsorted
(
reference_datetime
)
df
=
df
-
df
.
iloc
[
idx_ref
]
conduct_rescaled_df
[
probe
]
=
df
if
export_in_dataset
is
not
None
:
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
"
)
return
conduct_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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment