filter_temperatures: Quality filter for temperature records

Description Usage Arguments Value Author(s) Examples

View source: R/filter_temperatures.R

Description

This function attempts to remove erroneous temperature readings. This is tricky because of the wide range of errors that can occur, so this isn't necessarily sufficient for problems of particular records.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
filter_temperatures(
  temp_file,
  remove_value = NA,
  running_mean_filter = NA,
  running_mean_length = 3,
  min_extreme = NA,
  max_extreme = NA,
  max_missing_in_window = 1,
  missing_window_size = 9
)

Arguments

temp_file

file containing temperature data. Should have columns c("Year","Month","Day","Temp" - and "Hour" for hourly data).

remove_value

numeric value indicating 'no data'.

running_mean_filter

deviation from a running mean over all temperature data that identifies a value as an erroneous outlier.

running_mean_length

number of records to be included in a running mean.

min_extreme

lowest plausible temperature on the record. All lower ones are removed.

max_extreme

highest plausible temperature on the record. All higher ones are removed.

max_missing_in_window

maximum share of values (0..1) in a running window of size missing_window_size around each value that can be missing. If this is exceeded, the value is removed.

missing_window_size

size of the window used for checking for missing values.

Value

filtered temperature dataset, from which records identified as erroneous were removed.

Author(s)

Eike Luedeling

Examples

1
2
3
4
5
6
weather<-fix_weather(KA_weather[which(KA_weather$Year>2009),])

hourtemps<-stack_hourly_temps(weather, latitude=50.4)

filtered<-filter_temperatures(hourtemps$hourtemps,remove_value=-99,
  running_mean_filter=3)

chillR documentation built on Jan. 11, 2022, 5:07 p.m.