From 476b891978fc6fb6d1258d82b389280202b4ee48 Mon Sep 17 00:00:00 2001 From: Mads Christian Lund Date: Fri, 8 Sep 2023 15:48:49 +0200 Subject: [PATCH] Renamed to from difference_qc to static_qc --- src/pypromice/process/L1toL2.py | 4 ++-- src/pypromice/qc/{difference.py => static_qc.py} | 7 +++++-- src/pypromice/qc/{difference_test.py => static_qc_test.py} | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) rename src/pypromice/qc/{difference.py => static_qc.py} (89%) rename src/pypromice/qc/{difference_test.py => static_qc_test.py} (97%) diff --git a/src/pypromice/process/L1toL2.py b/src/pypromice/process/L1toL2.py index 7f8faf05..d3272759 100644 --- a/src/pypromice/process/L1toL2.py +++ b/src/pypromice/process/L1toL2.py @@ -9,7 +9,7 @@ import os import xarray as xr -from pypromice.qc.difference import differenceQC +from pypromice.qc.static_qc import staticQC from pypromice.qc.percentile import percentileQC @@ -56,7 +56,7 @@ def toL2(L1, T_0=273.15, ews=1013.246, ei0=6.1071, eps_overcast=1., - ds = differenceQC(ds) # Flag and Remove difference outliers + ds = staticQC(ds) # Flag and Remove difference outliers ds = percentileQC(ds) # Flag and remove percentile outliers T_100 = _getTempK(T_0) diff --git a/src/pypromice/qc/difference.py b/src/pypromice/qc/static_qc.py similarity index 89% rename from src/pypromice/qc/difference.py rename to src/pypromice/qc/static_qc.py index 76870b82..5d956190 100644 --- a/src/pypromice/qc/difference.py +++ b/src/pypromice/qc/static_qc.py @@ -3,8 +3,12 @@ import xarray as xr -def differenceQC(ds: xr.Dataset) -> xr.Dataset: +def staticQC(ds: xr.Dataset) -> xr.Dataset: ''' + Detect and filter data points that sems to be static within a certain period. + + TODO: It could be nice to have a reference to the logger or description of the behaviour here. + The AWS logger program is know to return the last successfully read value if it fails reading from the sensor. Parameters ---------- @@ -22,7 +26,6 @@ def differenceQC(ds: xr.Dataset) -> xr.Dataset: # This is best done by running aws.py directly and setting 'test_station' # Plots will be shown before and after flag removal for each var - stid = ds.station_id df = ds.to_dataframe() # Switch to pandas # Define threshold dict to hold limit values, and the difference values. diff --git a/src/pypromice/qc/difference_test.py b/src/pypromice/qc/static_qc_test.py similarity index 97% rename from src/pypromice/qc/difference_test.py rename to src/pypromice/qc/static_qc_test.py index f2b44a99..82643502 100644 --- a/src/pypromice/qc/difference_test.py +++ b/src/pypromice/qc/static_qc_test.py @@ -6,7 +6,7 @@ import numpy as np import pandas as pd -from pypromice.qc.difference import find_static_regions +from pypromice.qc.static_qc import find_static_regions def get_random_datetime() -> datetime.datetime: @@ -32,7 +32,7 @@ def get_random_timeseries( return pd.Series(index=time_range, data=data, name="data") -class DifferenceQATestCase(unittest.TestCase): +class StaticQATestCase(unittest.TestCase): def test_1_hour_static(self): series = get_random_timeseries( start=get_random_datetime(),