Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • berntm/saqc
  • rdm-software/saqc
  • schueler/saqc
3 results
Show changes
Commits on Source (23)
Showing
with 25085 additions and 23 deletions
...@@ -80,7 +80,7 @@ coverage: ...@@ -80,7 +80,7 @@ coverage:
- export DISPLAY=:99 - export DISPLAY=:99
- Xvfb :99 & - Xvfb :99 &
- pip install pytest-cov coverage - pip install pytest-cov coverage
- pytest --cov=saqc tests --ignore=tests/fuzzy -Werror - pytest --cov=saqc tests --ignore=tests/fuzzy tests/extras -Werror
after_script: after_script:
- coverage xml - coverage xml
# regex to find the coverage percentage in the job output # regex to find the coverage percentage in the job output
...@@ -99,7 +99,7 @@ python39: ...@@ -99,7 +99,7 @@ python39:
script: script:
- export DISPLAY=:99 - export DISPLAY=:99
- Xvfb :99 & - Xvfb :99 &
- pytest tests -Werror --junitxml=report.xml - pytest tests -Werror --junitxml=report.xml --ignore=tests/extras
- python -m saqc --config docs/resources/data/config.csv --data docs/resources/data/data.csv --outfile /tmp/test.csv - python -m saqc --config docs/resources/data/config.csv --data docs/resources/data/data.csv --outfile /tmp/test.csv
artifacts: artifacts:
when: always when: always
...@@ -113,7 +113,7 @@ python310: ...@@ -113,7 +113,7 @@ python310:
script: script:
- export DISPLAY=:99 - export DISPLAY=:99
- Xvfb :99 & - Xvfb :99 &
- pytest tests -Werror --junitxml=report.xml - pytest tests -Werror --junitxml=report.xml --ignore=tests/extras
- python -m saqc --config docs/resources/data/config.csv --data docs/resources/data/data.csv --outfile /tmp/test.csv - python -m saqc --config docs/resources/data/config.csv --data docs/resources/data/data.csv --outfile /tmp/test.csv
artifacts: artifacts:
when: always when: always
...@@ -126,7 +126,7 @@ python311: ...@@ -126,7 +126,7 @@ python311:
script: script:
- export DISPLAY=:99 - export DISPLAY=:99
- Xvfb :99 & - Xvfb :99 &
- pytest tests -Werror --junitxml=report.xml - pytest tests -Werror --junitxml=report.xml --ignore=tests/extras
- python -m saqc --config docs/resources/data/config.csv --data docs/resources/data/data.csv --outfile /tmp/test.csv - python -m saqc --config docs/resources/data/config.csv --data docs/resources/data/data.csv --outfile /tmp/test.csv
artifacts: artifacts:
when: always when: always
...@@ -139,7 +139,7 @@ python312: ...@@ -139,7 +139,7 @@ python312:
script: script:
- export DISPLAY=:99 - export DISPLAY=:99
- Xvfb :99 & - Xvfb :99 &
- pytest tests -Werror --junitxml=report.xml - pytest tests -Werror --junitxml=report.xml --ignore=tests/extras
- python -m saqc --config docs/resources/data/config.csv --data docs/resources/data/data.csv --outfile /tmp/test.csv - python -m saqc --config docs/resources/data/config.csv --data docs/resources/data/data.csv --outfile /tmp/test.csv
artifacts: artifacts:
when: always when: always
......
...@@ -8,9 +8,14 @@ SPDX-License-Identifier: GPL-3.0-or-later ...@@ -8,9 +8,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
## Unreleased ## Unreleased
[List of commits](https://git.ufz.de/rdm-software/saqc/-/compare/v2.6.0...develop) [List of commits](https://git.ufz.de/rdm-software/saqc/-/compare/v2.6.0...develop)
### Added ### Added
- `flagPlateaus`: added function to search and flag outlierish value plateaus of certain temporal extension
- `flagUniLOF`: added dispatch to Local Outlier Probability (*LoOP*) variant
- `flaguniLOF`: made `thresh` Optional
- `flagPlateaus`: added function to search and flag anomalous value plateaus of certain temporal extension
### Changed ### Changed
### Removed ### Removed
### Fixed ### Fixed
- `flagConstants`: fixed bug where last `min_periods` will never get flagged
### Deprecated ### Deprecated
## [2.6.0](https://git.ufz.de/rdm-software/saqc/-/tags/v2.6.0) - 2024-04-15 ## [2.6.0](https://git.ufz.de/rdm-software/saqc/-/tags/v2.6.0) - 2024-04-15
...@@ -27,6 +32,7 @@ SPDX-License-Identifier: GPL-3.0-or-later ...@@ -27,6 +32,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
- `setFlags`: function to replace `flagManual` - `setFlags`: function to replace `flagManual`
- `flagUniLOF`: added parameter `slope_correct` to correct for overflagging at relatively steep data value slopes - `flagUniLOF`: added parameter `slope_correct` to correct for overflagging at relatively steep data value slopes
- `History`: added option to change aggregation behavior - `History`: added option to change aggregation behavior
- "horizontal" axis / multivariate mode for `rolling`
- Translation scheme `AnnotatedFloatScheme` - Translation scheme `AnnotatedFloatScheme`
### Changed ### Changed
- `SaQC.flags` always returns a `DictOfSeries` - `SaQC.flags` always returns a `DictOfSeries`
......
...@@ -16,5 +16,6 @@ Basic Anomalies ...@@ -16,5 +16,6 @@ Basic Anomalies
~SaQC.flagRaise ~SaQC.flagRaise
~SaQC.flagConstants ~SaQC.flagConstants
~SaQC.flagByVariance ~SaQC.flagByVariance
~SaQC.flagPlateau
...@@ -15,3 +15,5 @@ Flagtools ...@@ -15,3 +15,5 @@ Flagtools
~SaQC.flagManual ~SaQC.flagManual
~SaQC.flagDummy ~SaQC.flagDummy
~SaQC.transferFlags ~SaQC.transferFlags
~SaQC.andGroup
~SaQC.orGroup
...@@ -13,6 +13,6 @@ Generic Functions ...@@ -13,6 +13,6 @@ Generic Functions
~SaQC.processGeneric ~SaQC.processGeneric
~SaQC.flagGeneric ~SaQC.flagGeneric
~SaQC.rolling ~SaQC.andGroup
~SaQC.transform ~SaQC.orGroup
~SaQC.resample
...@@ -19,4 +19,5 @@ Univariate Outlier Detection ...@@ -19,4 +19,5 @@ Univariate Outlier Detection
~SaQC.flagRange ~SaQC.flagRange
~SaQC.flagLOF ~SaQC.flagLOF
~SaQC.flagZScore ~SaQC.flagZScore
~SaQC.flagPlateau
...@@ -15,3 +15,4 @@ Tools ...@@ -15,3 +15,4 @@ Tools
~SaQC.renameField ~SaQC.renameField
~SaQC.selectTime ~SaQC.selectTime
~SaQC.plot ~SaQC.plot
This diff is collapsed.
SPDX-FileCopyrightText: 2021 Helmholtz-Zentrum für Umweltforschung GmbH - UFZ
SPDX-License-Identifier: GPL-3.0-or-later
\ No newline at end of file
docs/resources/images/fitFMpic.png

831 KiB

SPDX-FileCopyrightText: 2021 Helmholtz-Zentrum für Umweltforschung GmbH - UFZ
SPDX-License-Identifier: GPL-3.0-or-later
\ No newline at end of file
docs/resources/images/horizontalAxisRollingExample.png

60.5 KiB

SPDX-FileCopyrightText: 2021 Helmholtz-Zentrum für Umweltforschung GmbH - UFZ
SPDX-License-Identifier: GPL-3.0-or-later
\ No newline at end of file
...@@ -7,13 +7,34 @@ ...@@ -7,13 +7,34 @@
"""The System for automated Quality Control package.""" """The System for automated Quality Control package."""
__all__ = [
"BAD",
"DOUBTFUL",
"GOOD",
"UNFLAGGED",
"FILTER_ALL",
"FILTER_NONE",
"Flags",
"DictOfSeries",
"SaQC",
"DmpScheme",
"FloatScheme",
"PositionalScheme",
"SimpleScheme",
"AnnotatedFloatScheme",
"fromConfig",
]
from saqc.constants import BAD, DOUBTFUL, FILTER_ALL, FILTER_NONE, GOOD, UNFLAGGED from saqc.constants import BAD, DOUBTFUL, FILTER_ALL, FILTER_NONE, GOOD, UNFLAGGED
from saqc.exceptions import ParsingError
from saqc.core import Flags, DictOfSeries, SaQC from saqc.core import Flags, DictOfSeries, SaQC
from saqc.core.translation import DmpScheme, FloatScheme, PositionalScheme, SimpleScheme from saqc.core.translation import (
DmpScheme,
FloatScheme,
PositionalScheme,
SimpleScheme,
AnnotatedFloatScheme,
)
from saqc.parsing.reader import fromConfig from saqc.parsing.reader import fromConfig
from saqc.version import __version__
from . import _version from . import _version
__version__ = _version.get_versions()["version"] __version__ = _version.get_versions()["version"]
...@@ -136,10 +136,10 @@ def main( ...@@ -136,10 +136,10 @@ def main(
config = str(config) config = str(config)
cr = _ConfigReader(data=data, scheme=scheme) cr = _ConfigReader(data=data, scheme=scheme)
if config.endswith("json"): if config.endswith("json"):
f = None cr = cr.readJson(
if json_field is not None: config,
f = lambda j: j[str(json_field)] unpack=lambda j: j[str(json_field)] if json_field is not None else None,
cr = cr.readJson(config, unpack=f) )
else: else:
cr = cr.readCsv(config) cr = cr.readCsv(config)
......
...@@ -4,8 +4,19 @@ ...@@ -4,8 +4,19 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# isort: skip_file # isort: skip_file
__all__ = [
"DictOfSeries",
"History",
"Flags",
"SaQC",
"flagging",
"processing",
"register",
]
from saqc.core.frame import DictOfSeries from saqc.core.frame import DictOfSeries
from saqc.core.history import History from saqc.core.history import History
from saqc.core.flags import Flags, initFlagsLike from saqc.core.flags import Flags
from saqc.core.register import flagging, processing, register from saqc.core.register import flagging, processing, register
from saqc.core.core import SaQC from saqc.core.core import SaQC
...@@ -12,7 +12,7 @@ import warnings ...@@ -12,7 +12,7 @@ import warnings
from copy import copy as shallowcopy from copy import copy as shallowcopy
from copy import deepcopy from copy import deepcopy
from functools import partial from functools import partial
from typing import Any, Hashable, Iterable, MutableMapping from typing import Any, Hashable, Iterable
import numpy as np import numpy as np
import pandas as pd import pandas as pd
...@@ -22,6 +22,7 @@ from saqc.core.frame import DictOfSeries ...@@ -22,6 +22,7 @@ from saqc.core.frame import DictOfSeries
from saqc.core.history import History from saqc.core.history import History
from saqc.core.register import FUNC_MAP from saqc.core.register import FUNC_MAP
from saqc.core.translation import ( from saqc.core.translation import (
AnnotatedFloatScheme,
DmpScheme, DmpScheme,
FloatScheme, FloatScheme,
PositionalScheme, PositionalScheme,
...@@ -41,6 +42,7 @@ TRANSLATION_SCHEMES = { ...@@ -41,6 +42,7 @@ TRANSLATION_SCHEMES = {
"float": FloatScheme, "float": FloatScheme,
"dmp": DmpScheme, "dmp": DmpScheme,
"positional": PositionalScheme, "positional": PositionalScheme,
"annotated-float": AnnotatedFloatScheme,
} }
...@@ -330,7 +332,7 @@ class SaQC(FunctionsMixin): ...@@ -330,7 +332,7 @@ class SaQC(FunctionsMixin):
def _castData(self, data) -> DictOfSeries: def _castData(self, data) -> DictOfSeries:
if isinstance(data, pd.Series): if isinstance(data, pd.Series):
if not isinstance(data.name, str): if not isinstance(data.name, str):
raise ValueError(f"Cannot init from unnamed pd.Series") raise ValueError("Cannot init from unnamed pd.Series")
data = data.to_frame() data = data.to_frame()
if isinstance(data, pd.DataFrame): if isinstance(data, pd.DataFrame):
for idx in [data.index, data.columns]: for idx in [data.index, data.columns]:
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
from __future__ import annotations from __future__ import annotations
import typing import typing
import warnings
from typing import DefaultDict, Dict, Iterable, Mapping, Tuple, Type, Union, overload from typing import DefaultDict, Dict, Iterable, Mapping, Tuple, Type, Union, overload
import numpy as np import numpy as np
...@@ -243,7 +242,7 @@ class Flags: ...@@ -243,7 +242,7 @@ class Flags:
if history.empty: if history.empty:
return history return history
errm = f"History " errm = "History "
if colname: if colname:
errm += f"of column {colname} " errm += f"of column {colname} "
......
...@@ -5,6 +5,16 @@ ...@@ -5,6 +5,16 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
__all__ = [
"MappingScheme",
"TranslationScheme",
"DmpScheme",
"AnnotatedFloatScheme",
"FloatScheme",
"PositionalScheme",
"SimpleScheme",
]
from saqc.core.translation.basescheme import MappingScheme, TranslationScheme from saqc.core.translation.basescheme import MappingScheme, TranslationScheme
from saqc.core.translation.dmpscheme import DmpScheme from saqc.core.translation.dmpscheme import DmpScheme
from saqc.core.translation.floatscheme import AnnotatedFloatScheme, FloatScheme from saqc.core.translation.floatscheme import AnnotatedFloatScheme, FloatScheme
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
from __future__ import annotations from __future__ import annotations
import json import json
from functools import reduce
import numpy as np import numpy as np
import pandas as pd import pandas as pd
...@@ -18,7 +17,6 @@ from saqc import BAD, DOUBTFUL, GOOD, UNFLAGGED ...@@ -18,7 +17,6 @@ from saqc import BAD, DOUBTFUL, GOOD, UNFLAGGED
from saqc.core import Flags, History from saqc.core import Flags, History
from saqc.core.frame import DictOfSeries from saqc.core.frame import DictOfSeries
from saqc.core.translation.basescheme import BackwardMap, ForwardMap, MappingScheme from saqc.core.translation.basescheme import BackwardMap, ForwardMap, MappingScheme
from saqc.lib.tools import getUnionIndex
_QUALITY_CAUSES = [ _QUALITY_CAUSES = [
"", "",
......