prepare_cdt_daily: Prepare CDT for Daily data

View source: R/prepare_cdt_daily.R

prepare_cdt_dailyR Documentation

Prepare CDT for Daily data

Description

prepare_cdt_daily takes daily data. This data is then rearranged to a format suitable for use in CDT. This data frame can be rearranged and exported to a file or connection with export_cdt_daily.

Usage

prepare_cdt_daily(
  data,
  station,
  element,
  date_time,
  metadata = NULL,
  latitude,
  longitude,
  altitude
)

Arguments

data

data.frame data.frame of daily climatic data in tidy format i.e. one row per day (per station) and one column per element.

station

character(1) Name of the station identifying column in data.

element

character(1) Name of the element column in data.

date_time

character(1) Name of the date column in data. Required if type = "daily". If type = "dekad" this is only needed if year, month, and dekad are not specified.

metadata

data.frame data.frame of station metadata. Use this is the station details are in a separate data.frame with one row per station. If specified, latitude, longitude and altitude are assumed to be in metadata and station must be in both data and metadata to facilitate joining.

latitude

character(1) Name of the latitude column in metadata.

longitude

character(1) Name of the longitude column in metadata.

altitude

character(1) Name of the altitude column in metadata.

Value

A data.frame formatted for use in CDT

Examples

# Prepare daily_niger data for CDT export
prepare_cdt_daily(data = daily_niger, date_time = "date", station = "station_name",
                  element = "tmax", metadata = stations_niger, 
                  latitude = "lat", longitude = "long", altitude = "alt")

IDEMSInternational/cdms.products documentation built on July 7, 2023, 10:13 a.m.