Commit 7d5c20f2 authored by JOSSOUD Olivier's avatar JOSSOUD Olivier
Browse files

Quickviz. Selectable Air ValveMask

parent 1e2bae02
Pipeline #59973 passed with stages
in 3 minutes and 32 seconds
......@@ -15,7 +15,7 @@ class Visualizator(utils.LogConfig):
utils.LogConfig.__init__(self, "VIZU", config_parser, log)
self.base_dir = self.config[self.object_id]["root_dir"]
def create_data_source_file(self, site_id: str, picarro_id: str, day: datetime.date):
def create_data_source_file(self, site_id: str, picarro_id: str, day: datetime.date, air_valve_mask: int = 1):
source_filepath = utils.get_standard_filepath(self.config["LOCAL"]["base_dir"], site_id, "picarro", picarro_id, day.strftime("%Y%m%d"), "lzma")
if not os.path.exists(source_filepath):
......@@ -25,7 +25,7 @@ class Visualizator(utils.LogConfig):
# Decompress, and read data as Pandas' DataFrame
with tempfile.TemporaryDirectory() as tmpdirname:
dat_files = utils.extract_compressed_file(source_filepath, tmpdirname)
df = self.get_data(dat_files)
df = self.get_data(dat_files, air_valve_mask)
# Save calibration data file
calib_dir = os.path.join(self.base_dir, site_id)
......@@ -38,7 +38,7 @@ class Visualizator(utils.LogConfig):
return True
def get_data(self, dat_files: list) -> pd.DataFrame:
def get_data(self, dat_files: list, air_valve_mask: int = 1) -> pd.DataFrame:
dateparse = lambda x: pd.datetime.strptime(x, '%Y-%m-%d %H:%M:%S.%f')
day_df = pd.DataFrame()
for dat_file in dat_files:
......@@ -47,7 +47,7 @@ class Visualizator(utils.LogConfig):
parse_dates={'datetime': ['DATE', 'TIME']},
date_parser=dateparse)
df = df[["datetime", "H2O", "Delta_18_16", "Delta_D_H", "ValveMask"]]
df = df[df["ValveMask"] != 1]
df = df[df["ValveMask"] != air_valve_mask]
if len(day_df.index) == 0:
day_df = df
......
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