read_EddyPro: Read EddyPro Files with Units

View source: R/Data_handling.R

read_EddyProR Documentation

Read EddyPro Files with Units

Description

Read single or multiple CSV EddyPro full output files at given path and merge them together.

Usage

read_EddyPro(
  path,
  start = NULL,
  end = NULL,
  skip = 1,
  fileEncoding = "UTF-8",
  format = "%Y-%m-%d %H:%M",
  shift.by = NULL,
  allow_gaps = TRUE
)

Arguments

path

A string. The path to directory with EddyPro full output. Other than CSV files are ignored.

start, end

A value specifying the first (last) value of the column "timestamp" in outputted data frame. If NULL, min (max) of date-time values from "timestamp" column across all input 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 "timestamp" 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".

skip

An integer. The number of lines to skip in the input file before reading data.

fileEncoding

A character string. If non-empty, declares the encoding used on a file (not a connection) so the character data can be re-encoded. See read.table for further details.

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.

Details

This utility function is adapted to EddyPro full output file structure but allows to change selected useful arguments that have preset default values. Column "timestamp" with date-time information is constructed based on "date" and "time" columns and converted into class POSIXct. It also assures that date-time sequence is regular and equidistant.

In case that multiple files are present in the path, function merges them vertically (along generated complete timestamp) and discards rows with duplicated date-time values. All original columns across all files 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. To assure compatibility with older EddyPro versions, old column name "max_speed" is renamed to "max_wind_speed" if present.

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".

Note that skip and fileEncoding arguments must be valid across all files, otherwise the function will not execute correctly.

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.