dbAdd_measurand: Add measurand to 'measurand' table

Description Usage Arguments Value See Also Examples

View source: R/db_write.R

Description

dbWriteTable_measurand requires a correct physical quantity id, site id, calibrated device id, integration id and, optionally, person id. dbAdd_measurand derives the physical quantity id, site id, calibrated device id and person id from the respective names; integration id still have to be entered numerical as id. Note that dbAdd_measurand derives the calibrated device id from the device id with the most recent calibration date calstate_datetime. Use dbReadTable_integration_detail to query the integration table and select the correct id.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
dbAdd_measurand(
  conn,
  md_name,
  md_setup_datetime,
  pq_name,
  site_name,
  dev_name,
  int_id,
  md_height = NULL,
  md_orientation = NULL,
  md_tilt = NULL,
  pers_name = NULL,
  md_comment = NULL
)

dbWriteTable_measurand(
  conn,
  md_name,
  md_setup_datetime,
  pq_id,
  site_id,
  calstate_id,
  int_id,
  md_height = NULL,
  md_orientation = NULL,
  md_tilt = NULL,
  pers_id = NULL,
  md_comment = NULL
)

Arguments

conn

Database connection.

md_name

Character vector of measurand name.

md_setup_datetime

POSIXct vector of date and time of set-up of measurand.

pq_name

String vector of name of physical quantity.

site_name

String vector of name of site or name of campaign.

dev_name

String vector of name of device.

int_id

Integer vector of integration ID.

md_height

Numeric vector of measurement height.

md_orientation

Numeric vector of north-south measurement orientation.

md_tilt

Numeric vector of measurement tilt.

pers_name

Character vector of person name.

md_comment

Character vector of additional information.

pq_id

Integer vector of physical_quantity ID.

site_id

Integer vector of site ID.

calstate_id

Integer vector of calibration_state ID.

pers_id

Integer vector of person ID.

Value

Data frame of newly added rows.

See Also

Other custom dbWriteTable functions: dbAddCorrection_station_adlershof(), dbAddCorrection_station_patagonia(), dbAdd_calibration_state(), dbAdd_device_model(), dbAdd_device(), dbAdd_integration(), 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
15
## Not run: 
con <- dbConnect_klimageo()
# add all required entries before with the respective dbWriteTable_*
dbWriteTable_measurand(md_name = "TA2M_1",
                       md_setup_datetime = as.POSIXct("2012-01-01 12:15:12", tz = "UTC"),
                       pq_id = 1,
                       site_id = 1,
                       calstate_id = 1,
                       int_id = 1,
                       md_height = 2.,
                       pers_id = 1,
                       md_comment = "the 2m temperature"))
dbDisconnect(con)

## End(Not run)

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