Skip to contents

Create an object with class "dailyMet" from a data frame.

Usage

dailyMet(
  data,
  dateVar = "Date",
  metVar = "TX",
  idVar = list(Id = NULL),
  station = NA,
  id = NA,
  trace = 0,
  ...
)

Arguments

data

An object than can be coerced into a data frame with at least: a column representing the date and a column giving the meteorological variable.

dateVar

Name of the date variable in data. This variable should be coercible into a vector with class "Date" by using as.Date. If no value is given but only a variable with class "Date" exists, then this variable is used and renamed into "Date".

metVar

Name of the meteorological variable in `data`.

idVar

List defining of variables that can be found or created from those in the data.frame, and that will be kept under the prescribed name. NOT IMPLEMENTED.

station, id

Character vectors with length one giving the name of the gauging station and the identifier. These will be attached to the data.

trace

Integer level of verbosity. Not used for now.

...

Not used yet

Value

An object with S3 class "dailyMet" inheriting from the "data.frame" class.

Details

The "dailyMet" class essentially a daily time series with precomputed time variables such as the Julian day, ...

  • Regular sampling The rows must correspond to a sequence of successive days. So missing values will generally be present.

  • Precomputed variables These variables are functions of the date that are repeatedly used, hence which can be computed only once. They include for instance the Julian day.

The precomputed variables include the following ones.

  • Day, DateRef Day in the year a.k.a. Julian day, and reference Date. Day takes integer value between 1 and 366. DateRef is a refrence date, corresponding to the day but in a non leap year taken as reference. This date allows to plot the series against the day in the year still using months on the x axis.

  • DayW, DateRefW Similar to Day and DateRef, but for "winter years" centered on winter. A winter year begins on the 1-st of August and ends on the next 31-th of July. Winter years are useful when the interest is on event that usually happen in winter (extreme sea levels, extreme snowfall, ...).

  • JJA, DJF Logical variables indicating the periods June-July-August and December-January-Febuary which are sometimes used in the study of summer and winter extremes.

  • YearNum Numeric variable representing the time in years from the so-called Unix epoch 1970-01-01. For example YearNum is nearly 50.5 when Date is "2020-07-02", corresponding to 50.5 years elapsed from the epoch.

    Of course other variables related to the date can easily be created.

Note

We recommend ehen possible to use the station Id and name as given in stationsMF.

Caution

Althouch some methods inherited from the "data.frame" class work as expected (nrow, names, ...), the subset method requires a coercion with as.data.frame.