read.WSdata: Prepares weather station data

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Prepares weather station data

Usage

1
2
3
4
5
read.WSdata(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 = "%Y-%m-%d", time.format = "%H:%M:%S",
  datetime.format = "%Y-%m-%d %H:%M:%S", tz = "", cf = c(1, 1, 1),
  MTL)

Arguments

WSdata

csv file with weather station data or data.frame

...

additional parameter to pass to read.csv()

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

vector with the column numbers in WSdata for the date, time, radiation, wind, RH, temperature and rain. If date and time are in the same column, the column number has to be the same. Names in this vector are ignored and are presented on Usage and examples only as a reference.

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

timezone of the weather station dates. If not present assumes the same timezone as the computer running the code. See strptime for details.

cf

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

MTL

Metadata file. If not provided will look for one on working directory. If provided or present will calculate weather conditions on satellite overpass.

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)

Value

waterWeatherStation object, with data.frames with all data, hourly data and conditions at satellite flyby.

Author(s)

Guillermo Federico Olmedo

References

Landsat 7 Metadata example file available from the U.S. Geological Survey. Weather Station example file courtesy of CITRA, Universidad de Talca, Chile

See Also

read.WSdata2 for the equivalent using read.csv2()

Other Weather station related functions: plot.waterWeatherStation, print.waterWeatherStation, read.WSdata2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
csvfile <- system.file("extdata", "apples.csv", package="water")
MTLfile <- system.file("extdata", "L7.MTL.txt", package="water")
WS <- read.WSdata(WSdata = csvfile, date.format = "%d/%m/%Y", 
                  lat=-35.42222, long= -71.38639, elev=201, height= 2.2,
                  columns=c("date" = 1, "time" = 2, "radiation" = 3,
                  "wind" = 4, "RH" = 6, "temp" = 7, "rain" = 8), 
                  MTL = MTLfile)
print(WS)
plot(WS, alldata=FALSE)
plot(WS, alldata=TRUE)

Example output

Loading required package: raster
Loading required package: sp
Loading required package: rgdal
rgdal: version: 1.5-18, (SVN revision 1082)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.0.4, released 2020/01/28
Path to GDAL shared files: /usr/share/gdal
GDAL binary built with GEOS: TRUE 
Loaded PROJ runtime: Rel. 6.3.1, February 10th, 2020, [PJ_VERSION: 631]
Path to PROJ shared files: /usr/share/proj
Linking to sp version:1.4-4
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.
sh: 1: timedatectl: Permission denied
Error in file(con, "r") : cannot open the connection
In addition: Warning messages:
1: In system("timedatectl", intern = TRUE) :
  running command 'timedatectl' had status 126
2: In file(con, "r") : cannot open file '/etc/timezone': Permission denied
Warning message:
In read.WSdata(WSdata = csvfile, date.format = "%d/%m/%Y", lat = -35.42222,  :
  As tz = "", assuming the weather station time zone is Etc/UTC
Weather Station @ lat: -35.42 long: -71.39 elev: 201 
Summary:
   radiation           wind              RH              ea        
 Min.   :  0.00   Min.   : 0.000   Min.   :17.39   Min.   :0.7455  
 1st Qu.:  0.00   1st Qu.: 0.205   1st Qu.:40.65   1st Qu.:1.2288  
 Median : 49.82   Median : 1.585   Median :64.83   Median :1.6472  
 Mean   :310.13   Mean   : 3.071   Mean   :60.78   Mean   :1.5156  
 3rd Qu.:719.29   3rd Qu.: 3.655   3rd Qu.:82.34   3rd Qu.:1.7741  
 Max.   :998.29   Max.   :14.460   Max.   :94.04   Max.   :1.9672  
      temp            rain  
 Min.   :14.65   Min.   :0  
 1st Qu.:17.74   1st Qu.:0  
 Median :21.15   Median :0  
 Mean   :22.46   Mean   :0  
 3rd Qu.:27.36   3rd Qu.:0  
 Max.   :32.53   Max.   :0  

 Conditions at satellite flyby:
              datetime radiation wind    RH   ea  temp rain       date
59 2013-02-15 14:30:40    998.03 6.08 45.88 1.88 29.42    0 2013-02-15
Warning messages:
1: In plot.window(...) : "alldata" is not a graphical parameter
2: In plot.xy(xy, type, ...) : "alldata" is not a graphical parameter
3: In title(...) : "alldata" is not a graphical parameter
Warning messages:
1: In plot.window(...) : "alldata" is not a graphical parameter
2: In plot.xy(xy, type, ...) : "alldata" is not a graphical parameter
3: In title(...) : "alldata" is not a graphical parameter

water documentation built on May 2, 2019, 2:17 a.m.