read.WSdata2: Prepares weather station data from csv2 files

View source: R/water_WeatherStation.R

read.WSdata2R Documentation

Prepares weather station data from csv2 files

Description

Like read.WSdata(), but reads the file with read.csv2() (semicolon separators and decimal commas). A data.frame is passed to read.WSdata() unchanged.

Usage

read.WSdata2(
  WSdata,
  ...,
  height = 2.2,
  lat,
  long,
  elev,
  columns = c(date = 1, time = 2, radiation = 3, wind = 4, RH = 6, temp = 7, rain = 8),
  date.format = "%d/%m/%Y",
  time.format = "%H:%M:%S",
  datetime.format = "%Y-%m-%d %H:%M:%S",
  tz = "",
  cf = c(1, 1, 1),
  MTL,
  timestamps = "instant",
  overpass.radiation = "measured"
)

Arguments

WSdata

csv2 file with weather station data, or a data.frame

...

additional parameters passed to read.csv2()

height

weather station sensors height in meters

lat

latitude of weather station in decimal degrees. Negative values for south latitude

long

longitude of weather station in decimal degrees. Negative values for west longitude

elev

elevation of weather station in meters

columns

numeric vector with the column numbers in WSdata of the date, time, radiation, wind, RH, temperature and rain. If date and time are in the same column, give the same number twice (or use datetime). A named vector is matched by name, in any order: date and time (or datetime), radiation, wind, RH, temp and, optionally, rain. An unnamed vector is taken in that order. Unknown or repeated names stop; pp is accepted for rain. A warning is given when the names give the vector another meaning than its order (before version 1.0 only the order was used).

date.format

date format. See strptime format argument.

time.format

time format. See strptime format argument.

datetime.format

datetime format. See strptime format argument.

tz

time zone of the weather station clock (e.g. "America/Santiago"; see OlsonNames). If "" (default) the time zone of the computer is assumed, with a warning. Always set it: the overpass time in the MTL file is UTC and is converted to this time zone. See strptime for details.

cf

conversion factor to convert radiation, wind, and temperature to W/m2; m/s and Celsius. See Details.

MTL

path to the Landsat metadata (MTL) file. When given, the weather conditions at the satellite overpass are interpolated (element at.sat); if the overpass is outside the records, a warning is given and at.sat is not computed. If missing, at.sat is not computed (with a message).

timestamps

"instant" (default) if each record is the value at its time; "end" or "start" if it is the mean over the period ending or starting at its time (e.g. hourly means). For period means, the conditions at the overpass are interpolated between the middles of the periods. The hourly and daily values are not shifted: hourlyET() and dailyET() already take hourly values as means over the hour ending at their time.

overpass.radiation

"measured" (default) uses the station radiation at the overpass; "clear-sky" uses the ASCE-EWRI (2005) clear-sky radiation instead (the measured value is kept in at.sat$radiation.measured), e.g. when clouds shade the station but not the image. calcH() (ET of the cold pixels) and ET24h() then use the same clear-sky reference ET. See Details.

Details

For cf, if your data is in W/m2, km/h and Celsius (radiation, wind, temperature), cf should be: cf = c(1,0.2777778,1). The records are sorted and checked as in read.WSdata().

Value

A waterWeatherStation object, see read.WSdata.

Author(s)

Guillermo Federico Olmedo

See Also

Other Weather station related functions: getDataWS(), plot.waterWeatherStation(), print.waterWeatherStation(), read.WSdata()


water documentation built on Nov. 25, 2026, 5:08 p.m.