Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Automated QA/QC Processes


JDavis Dec 4, 2014 03:13 PM

This link goes to a great article about the importance of automated QA/QC checks on data and some practical examples:
http://www.treesearch.fs.fed.us/pubs/43678

There will always be a place for complicated data checks and post processing on the server side of things. However, many quality checks can be done on the datalogger itself, due to the flexible nature of Campbell Scientific products.

The program below is an example of how many of the common quality checks can be incorporated into a datalogger program. Combining multiple data flags into a single integer is a compact way to store the information and can easily be decoded in post processing.

'CR1000 Series Datalogger
Public AirTemp
Units AirTemp = Celcius
Public DataQuality As Long
'DataQuality code bits
' 0(1) = Good data
' 1(2) = Missing Value/NAN
Const ThresholdBatt = 9.8
' 2(4) = Low battery, 12V below battery threshold
Dim tempVal(5)
Dim valCounter As Long
Const ThresholdPersist = 0.01
' 3(8) = Persistent Value, value is flat for several measurements in a row
Const ThresholdUpExpect = 40
' 4(16) = Above Range, value is above maximum expected value
Const ThresholdDownExpect = 15
' 5(32) = Below Range, value is below minimum expected value
Const ThresholdSlope = 10
Dim prevValue
' 6(64) = Slope Exceedance, value change from previous measurement exceeded a threshold
Const ThresholdConsistency = 5
' 7(128) = Spatial Inconsistency, value inconsistent with a related measurement done by another sensor on the station
Const LimitUpper = 90
Const LimitLower = -50
' 8(256) = Detection Limit, value outside the rated range of the sensor

Public PTemp, BattVolt
Units PTemp = Celcius

'Define Data Tables.
DataTable (Test,1,9999) 'Set table size to # of records, or -1 to autoallocate.
DataInterval (0,15,Sec,10)
Sample (1,AirTemp,FP2)
Sample (1,DataQuality,UINT2)
Minimum (1,BattVolt,FP2,0,False)
Sample (1,PTemp,FP2)
EndTable


'Main Program
BeginProg
Scan (1,Sec,0,0)
PanelTemp (PTemp,_60Hz)
Battery (BattVolt)

TCDiff (AirTemp,1,AutorangeC,1,TypeT,PTemp,True ,0,_60Hz,1.0,0)

'Automated QA/QC checks on the data
DataQuality = 0
If AirTemp = NAN Then DataQuality = DataQuality OR 2 'Missing Value
If BattVolt < ThresholdBatt Then DataQuality = DataQuality OR 4 'Low 12V supply
AvgSpa (tempVal(5),4,tempVal(1)) 'average previous four values
If ABS(tempVal(5) - AirTemp) < ThresholdPersist Then DataQuality = DataQuality OR 8
valCounter = (valCounter + 1) MOD 4 'Rolls over at 4
tempVal(valCounter + 1) = AirTemp 'store current value in the array for check on following scans
If AirTemp > ThresholdUpExpect Then DataQuality = DataQuality OR 16
If AirTemp < ThresholdDownExpect Then DataQuality = DataQuality OR 32
If ABS(AirTemp - prevValue) > ThresholdSlope Then DataQuality = DataQuality OR 64
prevValue = AirTemp
If ABS(AirTemp - PTemp) > ThresholdConsistency Then DataQuality = DataQuality OR 128
If AirTemp > LimitUpper OR AirTemp < LimitLower Then DataQuality = DataQuality OR 256

If DataQuality = 0 Then DataQuality = 1 'No bad quality flags set


CallTable Test
NextScan
EndProg

Log in or register to post/reply in the forum.