library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# zmien sciezke do pliku
tmp <- read.table("~/Pobrane/out.txt", sep=" ", dec=",")
# konwersja daty:
tmp$V1 <- as.Date(strptime(paste0(tmp$V1,"01"), format="%Y%m%d", tz='UTC'))
# podglad czy wszystko jest ok..
library(esd)
## Loading required package: ncdf4
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## Attaching package: 'esd'
## The following objects are masked from 'package:dplyr':
##
## combine, count, location, select, src
## The following object is masked from 'package:base':
##
## subset.matrix
konwersja<-function (dane, loc = NA, param = NA, unit = NA, lon = NA, lat = NA,
alt = NA, cntr = NA, longname = NA, stid = NA, quality = NA,
src = NA, url = NA, reference = NA, info = NA, method = NA,
type = NA, aspect = NA) {
dates <- dane$V1
data <- dane$V2
y <- zoo(data, order.by = dates)
attr(y, "location") <- "PL"
attr(y, "variable") <- "t2m"
attr(y, "unit") <- "deg C"
attr(y, "longitude") <- NA
attr(y, "latitude") <- NA
attr(y, "altitude") <- -9999
attr(y, "country") <- "PL"
attr(y, "longname") <- 'POLTEMP'
attr(y, "station_id") <- 'poltemp'
attr(y, "quality") <- quality
attr(y, "calendar") <- "gregorian"
attr(y, "source") <- src
attr(y, "URL") <- "meteomodel.pl"
attr(y, "type") <- type
attr(y, "aspect") <- aspect
attr(y, "reference") <- reference
attr(y, "info") <- info
attr(y, "method") <- method
attr(y, "history") <- history.stamp(NULL)
class(y) <- c("station", "month", "zoo")
return(y)
}
poltemp <- konwersja(dane=tmp)
plot(poltemp)
poltemp_year <- aggregate(poltemp, year, FUN='mean', na.rm = FALSE)
plot(annual(poltemp,FUN="mean"))
?esd.tips