Test Case for Qc2 Single Linear

This test case is in reponse to version 3.2 of the ftime flag specification.

The following steps are performed on dev-vm101. The test data source file and algorithm configuration have been pre-loaded. When necessary the test data may be restored from this FILE and the configuration from the Reference Section below.

For shell commands the prefix “$” represents the Unix prompt. All the SQL commands are typed with no admonishments.

The test case data includes one example of a missing value and one example of rejected data. There is also a run of two missing values (in the middle) that is ignored.

87120;2025-09-16 11:00:00;6.6;211;2010-09-16 11:03:21;330;0;0;6.6;0111000000000010;7000000000000000;
87120;2025-09-16 12:00:00;-19.1;211;2010-09-16 12:03:25;330;0;0;-32766;05120020000000A0;7038300000000002;QC1-1-211:1,QC1-3a-211:1,QC1-9-211:1
87120;2025-09-16 13:00:00;6.7;211;2010-09-16 13:03:17;330;0;0;6.7;0110000000000010;7000000000000000;
...
87120;2025-09-16 15:00:00;7;211;2010-09-16 15:03:21;330;0;0;7;0111000000000010;7000000000000000;
87120;2025-09-16 16:00:00;-32767;211;2010-09-16 16:51:24;330;0;0;-32767;0000003000000000;9899900000000000;
87120;2025-09-16 17:00:00;-32767;211;2010-09-16 17:33:00;330;0;0;-32767;0000003000000000;9899900000000000;
87120;2025-09-16 18:00:00;8.3;211;2010-09-16 18:04:25;330;0;0;8.3;0110000000000010;7000000000000000;
...
87120;2025-09-17 09:00:00;8.7;211;2010-09-17 09:03:50;330;0;0;8.7;0111000000000010;7000000000000000;
87120;2025-09-17 10:00:00;-32767;211;2010-09-17 10:32:33;330;0;0;-32767;0100003000000000;7899900000000000;
87120;2025-09-17 11:00:00;9.5;211;2010-09-17 11:03:44;330;0;0;9.5;0110000000000010;7000000000000000;

PROCEDURE

Step 1

Open two terminals (A) and (B) on dev-vm1010 as user “kvalobs”.

(A) is for monitoring database changes and (B) for managing the algorithm

Step 2

(A) Enter the kvalobs database

$ psql kvalobs

Check for presence of no test data

SELECT * FROM data WHERE stationid=87120 AND obstime BETWEEN '2025-09-16 06:00:00' AND '2025-09-17 16:00:00' AND paramid=211 ORDER BY obstime;

Load the test data and view it with the same select statement:

COPY data FROM '/home/kvalobs/QC2/TESTDATA/kvqc2_1.0.4/qc2-211-singlepointtest.db.dat' USING DELIMITERS ';' ;
SELECT * FROM data WHERE stationid=87120 AND obstime BETWEEN '2025-09-16 06:00:00' AND '2025-09-17 16:00:00' AND paramid=211 ORDER BY obstime;

Please see the Reference Section below for a printout of the test data that is inserted. (To be done !!!!)

Step 3

In terminal (B):

$ cd /etc/kvalobs/Qc2Config/
$cp SLv32.hold SLv32.cfg

Edit the SLv32.cfg file so that the values of RunAtHour and RunAtMinute are set to the next minute. This will cause the algorithm specified in SLv32.cfg to be run in the next minute (provided there are no conflicts with another scheduled algorithm).

If one opens a third terminal (C) when the algorithm runs may be monitored with, for example:

$tail -f /var/log/kvalobs/Qc2.log

Approximately, one minute later check the values in the kvalobs database, i.e. on (A) Enter the command

SELECT * FROM data WHERE stationid=87120 AND obstime BETWEEN '2025-09-16 06:00:00' AND '2025-09-17 16:00:00' AND paramid=211 ORDER BY obstime;

Observe the updates to the single missing values.

Step 4

(B) Edit the SLv32.cfg file so that the values of RunAtHour and RunAtMinute are set to the next minute. So that the algorithm runs again.

Confirm that there is no change to the data. (Rerun the previous SELECT).

Step 5

Change the test data so that the algorithm will make a correction again by changing the value of a neighbour.

(A):

UPDATE data SET corrected=5, original=5 WHERE stationid=87120 AND obstime='2025-09-17 09:00:00' AND paramid=211;
UPDATE data SET corrected=7.2, original=7.2 WHERE stationid=87120 AND obstime='2025-09-16 11:00:00' AND paramid=211;

(B) Edit the SLv32.cfg file so that the values of RunAtHour and RunAtMinute are set to the next minute. So that the algorithm runs again.

Confirm that there is a change to the corrected data. (Rerun the previous SELECT).

Step 6

(B) Edit the SLv32.cfg file so that the values of RunAtHour and RunAtMinute are set to the next minute. So that the algorithm runs again.

Confirm that there is no change to the data.

Step 7

Change the test data so that one of the nighbours becomes invalid to run, so that the missing or rejected value is reset.

(A):

UPDATE data SET useinfo='7010000000000000' WHERE stationid=87120 and obstime='2025-09-17 09:00:00' and paramid=211;
UPDATE data SET useinfo='7010000000000000' WHERE stationid=87120 and obstime='2025-09-16 11:00:00' and paramid=211;

Confirm that the data is reset to missing or rejected as appropriate. (Rerun the previous SELECT).

Step 8

Run the algorithm once more and confirm that no further change occurs.

Continue ad hoc tests if required.

When finished remove the configuration file (B):

$rm /etc/kvalobs/Qc2Config/SLv32.cfg

And remove the test data (A):

DELETE from DATA where stationid=87120 and obstime BETWEEN '2025-09-16 06:00:00' AND '2025-09-17 16:00:00' and paramid=211;

RESULTS

The following lists the changes to the database either through UPDATES or by the action of the algorithm that occurs between each step.

Reference

Configuration file

AlgoCode=10
# Time to run the algorithm
RunAtHour=22
RunAtMinute=28
#[Time Range]
Start_YYYY=2025
Start_MM=9
Start_DD=16
Start_hh=6
Start_mm=0
Start_ss=0
#
End_YYYY=2025
End_MM=9
End_DD=17
End_hh=16
End_mm=0
End_ss=0
#[Specific Data Type and Paramters ids etc.]
ParamId=211
MaxParamId=215
MinParamId=213
# Only write back the result if not previously controlled
W_fhqc=0
#Flag to set if value is corrected
S_ftime=1
change_fmis=3->1
change_fmis=0->4
change_fmis=2->4
#If there is already a 1 in place then we do not want run the algorithm again!
U_2=0

Sql for the test:

SELECT * FROM data WHERE stationid=87120 AND obstime BETWEEN '2025-09-16 06:00:00' AND '2025-09-17 16:00:00' AND paramid=211 ORDER BY obstime;
COPY data FROM '/metno/kvalobs/TESTDATA/kvqc2_1.0.4/Qc2-211-SinglePointTest.db.dat' USING DELIMITERS ';' ;
SELECT * FROM data WHERE stationid=87120 AND obstime BETWEEN '2025-09-16 06:00:00' AND '2025-09-17 16:00:00' AND paramid=211;
UPDATE data SET corrected=5, original=5 WHERE stationid=87120 AND obstime='2025-09-17 09:00:00' AND paramid=211;
UPDATE data SET corrected=7.2, original=7.2 WHERE stationid=87120 AND obstime='2025-09-16 11:00:00' AND paramid=211;
SELECT * FROM data WHERE stationid=87120 AND obstime BETWEEN '2025-09-16 06:00:00' AND '2025-09-17 16:00:00' AND paramid=211;
UPDATE data SET useinfo='7010000000000000' WHERE stationid=87120 and obstime='2025-09-17 09:00:00' and paramid=211;
UPDATE data SET useinfo='7010000000000000' WHERE stationid=87120 and obstime='2025-09-16 11:00:00' and paramid=211;
DELETE from DATA where stationid=87120 and obstime BETWEEN '2025-09-16 06:00:00' AND '2025-09-17 16:00:00' and paramid=211;