R/airsis_createMonitorObject.R
airsis_createMonitorObject.Rd
Obtains monitor data from an AIRSIS webservice and converts
it into a quality controlled, metadata enhanced ws_monitor object
ready for use with all monitor_~
functions.
Steps involved include:
download CSV text
parse CSV text
apply quality control
apply clustering to determine unique deployments
enhance metadata to include: elevation, timezone, state, country, site name
reshape AIRSIS data into deployment-by-property meta
and and time-by-deployment data
dataframes
QC parameters that can be passed in the ...
include the following
valid data ranges as taken from airsis_EBAMQualityControl()
:
valid_Longitude=c(-180,180)
valid_Latitude=c(-90,90)
remove_Lon_zero = TRUE
remove_Lat_zero = TRUE
valid_Flow = c(16.7*0.95,16.7*1.05)
valid_AT = c(-Inf,45)
valid_RHi = c(-Inf,50)
valid_Conc = c(-Inf,5.000)
Note that appropriate values for QC thresholds will depend on the type of monitor.
airsis_createMonitorObject( startdate = strftime(lubridate::now(tzone = "UTC"), "%Y010100", tz = "UTC"), enddate = strftime(lubridate::now(tzone = "UTC"), "%Y%m%d23", tz = "UTC"), provider = NULL, unitID = NULL, clusterDiameter = 1000, zeroMinimum = TRUE, baseUrl = "http://xxxx.airsis.com/vision/common/CSVExport.aspx?", saveFile = NULL, existingMeta = NULL, addGoogleMeta = FALSE, addEsriMeta = FALSE, ... )
startdate | desired start date (integer or character representing YYYYMMDD[HH]) |
---|---|
enddate | desired end date (integer or character representing YYYYMMDD[HH]) |
provider | identifier used to modify baseURL |
unitID | character or numeric AIRSIS unit identifier |
clusterDiameter | diameter in meters used to determine the number of clusters (see |
zeroMinimum | logical specifying whether to convert negative values to zero |
baseUrl | base URL for data queries |
saveFile | optional filename where raw CSV will be written |
existingMeta | existing 'meta' dataframe from which to obtain metadata for known monitor deployments |
addGoogleMeta | logicial specifying wheter to use Google elevation and reverse geocoding services |
addEsriMeta | logicial specifying wheter to use ESRI elevation and reverse geocoding services |
... | additional parameters are passed to type-specific QC functions |
A ws_monitor object with AIRSIS data.
The downloaded CSV may be saved to a local file by providing an argument to the saveFile
parameter.
if (FALSE) { # Fail gracefully if any resources are not available try({ library(PWFSLSmoke) initializeMazamaSpatialUtils() usfs_1072 <- airsis_createMonitorObject(20200601, 20200620, 'USFS', unitID='1072') monitor_timeseriesPlot(usfs_1072) }, silent = FALSE) }