Skip to content
Snippets Groups Projects
Commit 6143c92e authored by David Schäfer's avatar David Schäfer
Browse files

[FIX] excess history column for new variables through generic.flag

parent 5c97a4de
No related branches found
No related tags found
2 merge requests!271Static expansion of regular expressions,!260Follow-Up Translations
Pipeline #24687 passed with stage
in 1 minute and 57 seconds
......@@ -3,7 +3,7 @@
from functools import partial
from inspect import signature
from typing import Tuple, Any, Union, Callable
from typing import Tuple, Union, Callable
import numpy as np
import pandas as pd
......@@ -144,8 +144,8 @@ def process(
>>> lambda temperature, uncertainty: np.round(temperature) * np.sqrt(uncertainty)
"""
# we get the data unmaskes in order to also receive flags,
# so let's ge to the masking manually
# we get the data unmasked in order to also receive flags,
# so let's do to the masking manually
data_masked, _ = _maskData(data, flags, data.columns, to_mask)
data[field] = _execGeneric(flags, data_masked, func, field, nodata).squeeze()
......@@ -245,8 +245,8 @@ def flag(
>>> lambda level: np.sqrt(level) > 7
"""
# we get the data unmaskes in order to also receive flags,
# so let's ge to the masking manually
# we get the data unmasked, in order to also receive flags,
# so let's do to the masking manually
data_masked, _ = _maskData(data, flags, data.columns, to_mask)
mask = _execGeneric(flags, data_masked, func, field, nodata).squeeze()
......@@ -255,9 +255,6 @@ def flag(
if not np.issubdtype(mask.dtype, np.bool_):
raise TypeError(f"generic expression does not return a boolean array")
if field not in flags.columns:
flags[field] = pd.Series(UNFLAGGED, index=mask.index, name=field)
flags[mask, field] = flag
flags[field] = mask.replace({False: UNFLAGGED, True: BAD})
return data, flags
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment