dbAdd_station_patagonia: Add measurements to 'station_patagonia' table

Description Usage Arguments Details Value See Also Examples

View source: R/db_write.R

Description

dbWriteTable_station_patagonia requires a correct measurand id while dbAdd_station_patagonia derives that from the measurand name.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
dbAdd_station_patagonia(
  conn,
  md_name,
  stapa_datetime,
  stapa_value,
  qf_id = NULL
)

dbWriteTable_station_patagonia(
  conn,
  stapa_datetime,
  md_id,
  stapa_value,
  qf_id = NULL
)

Arguments

conn

Database connection.

md_name

Character vector of measurand name.

stapa_datetime

POSIXct vector of date and time of measurement.

stapa_value

Numeric vector of measurement values.

qf_id

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

md_id

Integer vector of measurand ID.

Details

dbWriteTable_station_patagonia requires a correct measurand id md_id to write measurements to station_patagonia. dbAdd_station_patagonia finds md_id from a given measurand name md_name. To this end, it queries the table measurand and selects the according to md_setup_datetime the most recent md_id.

Value

For performance reason, contrary to the meta data table functions, this function does not return anything.

See Also

Other custom dbWriteTable functions: dbAddCorrection_station_adlershof(), dbAddCorrection_station_patagonia(), dbAdd_calibration_state(), dbAdd_device_model(), dbAdd_device(), dbAdd_integration(), dbAdd_measurand(), dbAdd_physical_quantity(), dbAdd_station_adlershof(), 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_*
dbAdd_station_patagonia(con,
                        md_name = "TA2M_1"
                        stapa_datetime = as.POSIXct("2017-01-01 12:05:12", tz = "UTC"),
                        stapa_value = 272.15)
dbWriteTable_station_patagonia(con,
                               stapa_datetime = as.POSIXct("2017-01-01 12:15:12", tz = "UTC"),
                               md_id = 1,
                               stapa_value = 273.15)
dbDisconnect(con)

## End(Not run)

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