Commit 52e90a38 authored by Jean-Marie Lepioufle's avatar Jean-Marie Lepioufle
Browse files

homogeneization of the function names

parent a9b133a5
#' luftlyr_friendlydf
#' luftlyr_df_data
#' luftlyr_friendlydf
#' luftlyr_df_data
#' @param x request object
#' @param res resulted data.frame
#' @param res resulted data.frame
#' @keywords luftlyr
#' @export
#' @examples
#' \dontrun{
#' luftlyr_friendlydf()
#' luftlyr_df_data()
#' }
luftlyr_friendlydf <- function(x,res){
luftlyr_df_data <- function(x,res){
if (x$dateStructObj$COL_DATE) {
tmp <- friendly_df_(x=x,ugly_df=res)
tmp <- df_data_(x=x,ugly_df=res)
} else if (!x$dateStructObj$COL_DATE){
tmp <- friendlyr::checkDate(df = friendly_df_(x=x,ugly_df=res), timeObj=x$timeObj, missingValues = NA)
......@@ -21,7 +21,7 @@ luftlyr_friendlydf <- function(x,res){
return(tmp)
}
friendly_df_ <- function(x,ugly_df){
df_data <- function(x,ugly_df){
output <- data.frame(date = x$timeObj$seqPeriod())
......
#' luftlyr_friendly
#' luftlyr_friendly
#' @param fn character fun
#' @param type character type
#' @keywords luftlyr
#' @export
#' @examples
#' \dontrun{
#' luftlyr_friendly()
#' }
luftlyr_friendly <- function(fn,type) {
return(get(paste0("luftly_",fn,"_",type)))
db <- luftkvalr::luftkvalr()
db$start(...)
tmp_st <- db$GetAQStations(stationIDs=x$stationObj$station_id,locationName=x$stationObj$locationName)
tmp_ts <- db$GetAQTimeseries(stationIDs=tmp_st$ST_ID,componentName=x$elementObj$element_id)
res <- db$GetAQData(stationIDs=tmp_st$ST_ID,
timeSeriesIDs=tmp_ts$TS_ID,
fromDateTime=as.character(x$timeObj$fromDateTime()),
toDateTime=as.character(x$timeObj$toDateTime()))
db$stop()
#Negative values
res[which(res$TE_VALUE<0),"TE_VALUE"]<-NA
return(res)
}
#' luftlyr_getdata
#' luftlyr_get_data
#' luftlyr_getdata
#' luftlyr_get_data
#' @param x request object
#' @param ... authentication options
#' @keywords luftlyr
#' @export
#' @examples
#' \dontrun{
#' luftlyr_getdata()
#' luftlyr_get_data()
#' }
luftlyr_getdata <- function(x,...) {
luftlyr_get_data <- function(x,...) {
db <- luftkvalr::luftkvalr()
db$start(...)
tmp_st <- db$GetAQStations(stationIDs=x$stationObj$station_id)
tmp_st <- db$GetAQStations(stationIDs=x$stationObj$station_id,locationName=x$stationObj$locationName)
tmp_ts <- db$GetAQTimeseries(stationIDs=tmp_st$ST_ID,componentName=x$elementObj$element_id)
res <- db$GetAQData(stationIDs=tmp_st$ST_ID,
timeSeriesIDs=tmp_ts$TS_ID,
......@@ -20,12 +20,12 @@ luftlyr_getdata <- function(x,...) {
toDateTime=as.character(x$timeObj$toDateTime()))
db$stop()
#Missing values
#Negative values
res[which(res$TE_VALUE<0),"TE_VALUE"]<-NA
return(res)
}
#' luftlyr_getmeta
#' luftlyr_get_meta
#' luftlyr_getmeta
#' @param x request object
......@@ -34,12 +34,12 @@ luftlyr_getdata <- function(x,...) {
#' @export
#' @examples
#' \dontrun{
#' luftlyr_getmeta()
#' luftlyr_get_meta()
#' }
luftlyr_getmeta <- function(x,...) {
luftlyr_get_meta <- function(x,...) {
db <- luftkvalr::luftkvalr()
db$start(...)
tmp_st <- db$GetAQStations(stationIDs=x$stationObj$station_id)
tmp_st <- db$GetAQStations(stationIDs=x$stationObj$station_id,locationName=x$stationObj$locationName)
tmp_ts <- db$GetAQTimeseries(stationIDs=tmp_st$ST_ID,componentName=x$elementObj$element_id)
db$stop()
colnames(tmp_ts) <- c("ID","NAME","ALT","LAT","LON","TS_ID","CO_NAME","TS_Z1","TS_Z2")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment