dbAddCorrection_station_patagonia: Add corrections of 'station_patagonia' measurements

Description Usage Arguments Details Value See Also Examples

View source: R/db_write.R

Description

In general, use dbAddCorrection_station_patagonia to consistently add the corrected measurement values to station_patagonia_correction and to modify the quality flags in station_patagonia. dbWriteTable_station_patagonia_correction and dbUpdate_station_patagonia_qf_id do the respective single actions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
dbAddCorrection_station_patagonia(
  conn,
  stapa_id,
  qf_id,
  stapacor_datetime,
  md_id,
  stapacor_value
)

dbUpdate_station_patagonia_qf_id(conn, stapa_id, qf_id, overwrite = TRUE)

dbWriteTable_station_patagonia_correction(
  conn,
  stapa_id,
  stapacor_datetime,
  md_id,
  stapacor_value
)

Arguments

conn

Database connection.

stapa_id

Integer vector of station_patagonia ID.

qf_id

Integer vector with 1 <= qf_id <= 9 indicating value ok and qf_id >= 10 indicating value not ok.

stapacor_datetime

POSIXct vector of corrected date and time of measurement.

md_id

Integer vector of measurand ID.

stapacor_value

Numeric vector of corrected value of measurement.

overwrite

Overwrite non-null qf_id values. If FALSE, only null qf_id values are modified.

Details

By design, qf_id with values >= 10 in station_patagonia indicates that entries in station_patagonia are corrected in station_patagonia_correction. Thus, dbAddCorrection_station_patagonia imposes the constraint qf_id >= 10. dbUpdate_station_patagonia_qf_id, on the other hand, allows general values of qf_id (further checks are done by the database).

Value

For performance reason, contrary to the meta data table functions, these functions do not return anything.

See Also

Other custom dbWriteTable functions: dbAddCorrection_station_adlershof(), dbAdd_calibration_state(), dbAdd_device_model(), dbAdd_device(), dbAdd_integration(), dbAdd_measurand(), dbAdd_physical_quantity(), dbAdd_station_adlershof(), dbAdd_station_patagonia(), dbWriteTable_device_manufacturer(), dbWriteTable_device_type(), dbWriteTable_integration_type(), dbWriteTable_person(), dbWriteTable_quality_flag(), dbWriteTable_site()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
con <- dbConnect_klimageo()
add all required entries before with the respective dbWriteTable_*
dbAddCorrection_station_patagonia(
  con,
  stapa_id = c(1,2),
  qf_id = c(11,11),
  stapacor_datetime =
  as.POSIXct(c("2017-01-01 12:15:12", "2017-01-01 12:15:12"), tz = "UTC"),
  md_id = c(1,1),
  stapacor_value = c(290.12, 289.23))
dbDisconnect(con)

## End(Not run)

sebschub/klimageodb documentation built on Sept. 25, 2021, 4:16 p.m.