dbpf_export_csv_generic: Download database time series in CSV ASCII format

View source: R/dbpf_export_csv_generic.R

dbpf_export_csv_genericR Documentation

Download database time series in CSV ASCII format

Description

Downloads one or more time series from the carleton permafrost database and exports them as a CSV. The formatting of the output file is fully customizable.

Usage

dbpf_export_csv_generic(
  con,
  location_name,
  output_directory,
  freq = "daily",
  unit_of_measurement = "C",
  measurement_name = "Ground_Temperature",
  date_header = "Date",
  date_format = "%Y/%m/%d %H:%M",
  depth_header_units = "m",
  depth_header_prefix = NULL,
  depth_header_suffix = NULL,
  depth_header_precision = 2,
  depth_positive_down = T,
  measurement_precision = 2
)

Arguments

con

Database connection object, as returned by dbpf_con

location_name

Character, one or more location names to convert.

output_directory

(optional) character, path to output directory. If missing, the function will return the table as an R object instead of writing it to disk.

freq

Character, one of ('daily', 'hourly'). Interval at which data is to be aggregated from the database.

unit_of_measurement

character, used to identify the desired measurement type in the database. Common values are 'C' for temperature or '%RH' for relative humidity. Defaults to 'C'

measurement_name

character, description of what is being measured. Used in file naming. Examples incldue 'Ground_Temperature' or 'Relative_Humidity'. Defaults to 'Ground_Temperature'

date_header

character, string to be used for the header of the date/time column. Defaults to 'Date'.

date_format

character, date format string for database. Defaults to '%Y/%m/%d %H:%M:%S'.

depth_header_units

Character string, one of ('m', 'cm', 'mm'). Desired units for depth values in column header. Defaults to 'm'.

depth_header_prefix

(optional) character string to be placed before numeric depth values in column headers.

depth_header_suffix

(optional) character string to be placed after numeric depth values in column headers.

depth_header_precision

(optional) integer, number of decimal places to use for depth header values. If not provided, depth values are allowed to have as many decimal places as required.

depth_positive_down

logical, whether or not depths should be given as positive values. Defaults to TRUE.

measurement_precision

integer, number of decimal places to include for measurement values. Defaults to 2.

Details

Requires the PermafrostDB package.

Author(s)

Nick Brown <nick.brown@carleton.ca>


geocryology/PermafrostDB documentation built on April 17, 2025, 11:54 a.m.