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
6f56c772
Commit
6f56c772
authored
Jan 20, 2022
by
JOSSOUD Olivier
Browse files
Flow. Get picarro by melt time
parent
da8de1d1
Pipeline
#157724
passed with stages
in 1 minute and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
cfatools/processor/flow.py
cfatools/processor/flow.py
+35
-1
No files found.
cfatools/processor/flow.py
View file @
6f56c772
...
...
@@ -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
.f
Z"
,
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
)
...
...
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