devtools::install_github("markocherrie/uvR")
dates<-seq(as.Date("2019-07-10"), as.Date("2019-07-11"), by="days")
dates<-gsub("-", "", dates)
for(i in dates){
uvR::JAXA_download(i, "MYD", "uvb")
}
uvR::JAXA_process(61,43,-11,2)
rst<-raster(list.files("raster/", full.names = T)[1])
plot(rst)
multmerge = function(mypath){
filenames=list.files(path=mypath, full.names=TRUE)
datalist = lapply(filenames, function(x){read.csv(file=x,header=T)})
Reduce(function(x,y) {merge(x,y)}, datalist)
}
# from: https://www.r-bloggers.com/merging-multiple-data-files-into-one-data-frame/
mergedf = multmerge("extract/")
mergedf<-reshape(mergedf, varying=c(3:4), direction="long", idvar="NAME", sep="", timevar="date")
mergedf$date<-as.Date(substr(mergedf$date, 8,15), format="%Y%m%d")
library(ggplot2)
## simple line chart in ggplot
p<-ggplot(data=mergedf, aes(x=date, y=MYD, group=NAME, color=NAME)) +
geom_line() +
geom_point() +
labs(title="Mean daily UVB for Local Authorities in Scotland", x="Date" ,y="UVB (W/m2)")
p