read_MeteoDBS: Read Meteorological Data with Units

View source: R/Data_handling.R

read_MeteoDBSR Documentation

Read Meteorological Data with Units

Description

Read single or multiple CSV meteorological data files at Czechglobe MeteoDBS format at given path and merge them together.

Usage

read_MeteoDBS(
  path,
  start = NULL,
  end = NULL,
  format = "%d.%m.%Y %H:%M",
  shift.by = NULL,
  allow_gaps = TRUE,
  verbose = TRUE
)

Arguments

path

A string. The path to directory with CSV file(s) in Czechglobe MeteoDBS format. Other than CSV files are ignored.

start, end

A value specifying the first (last) value of the generated date-time sequence in temporary column "timestamp". If NULL, min (max) of date-time values from "date/time" column across all files is used. If numeric, the value specifies the year for which the first (last) date-time value will be generated, considering given time interval (automatically detected from "date/time" column) and convention of assigning of measured records to the end of the time interval. Otherwise, character representation of specific date-time value is expected in given format and timezone "GMT".

format

A character string. Format of start (end) if provided as a character string.

shift.by

A numeric value specifying the time shift (in seconds) to be applied to the date-time information.

allow_gaps

A logical value. If TRUE, date-time information does not have to be regular but time differences must be multiples of automatically detected time interval.

verbose

A logical value. Should additional statistics about presence of NA values in resulting data frame be printed to console?

Details

This utility function is adapted to Czechglobe MeteoDBS file structure but allows to change selected useful arguments that have preset default values. It also assures that date-time sequence is regular and equidistant.

In case that multiple files are present in the path, the expectation is that files represent meteorological variables for given site and different periods. Function merges them vertically (along generated complete timestamp). All original columns across all files excluding the last empty one are kept. The order of variables keeps that of the first file loaded (note that file ordering in path is alphabetical not chronological) and additional variables are appended if present in the following files. The output "date/time" column is converted into class POSIXct.

If you want to specify start and end arguments as strings and you change also default shift.by value, start and end arguments need to be adopted accordingly to account for that change. E.g. if shift.by = -900, then start = "2019-12-31 21:15:00", end = "2019-12-31 23:15:00" instead of start = "2019-12-31 21:30:00", end = "2019-12-31 23:30:00".

Function introduces additional column "timestamp" for purposes of merging with merge_eddy(). This column is then removed as it is not included in the original data.

Value

A data frame is produced with additional attributes varnames and units assigned to each respective column.


lsigut/openeddy documentation built on Aug. 5, 2023, 12:25 a.m.