library('ggplot2') library('rio') data = commandArgs(trailingOnly=TRUE)[1] data = import("SoDa_MERRA2_lat51.500_lon-0.100_2018-06-01_2018-08-31_1184926537.csv") head(data) merra <- read.table(data, sep=";", header=F, skip=24, colClasses = c("POSIXct", "character", "numeric", "numeric", rep("NULL", 6))) colnames(merra) = cbind('date','time','temp','RH') merra$temp = merra[, 3] - 273.15 merra$SH = (0.622/((101325/(((merra$RH/100)*(10^(((0.7859+0.03477*merra$temp)/(1+0.00412*merra$temp))+2))))))) merra$H = (1.007*merra$temp-0.026)+(merra$SH*(2502-0.538*merra$temp)) #merra$dateTime <- paste(merra$date,merra$hour) #merra$dataTime = as.POSIXlt(merra$dateTime,format="%Y %m %d %H") pdf("/home/martin/qw3e.com/output/merra.pdf") ggplot(merra, aes(x=temp, y = SH, color=H)) + geom_point() #scale_color_gradient2(midpoint=0, low="blue", mid="white",high="red", space ="Lab" ) #geom_line(data=temps[temps$month == i, ],aes(x=hour,y = dryBulb_max)) + #geom_line(data=temps[temps$month == i, ],aes(x=hour,y = dryBulb_min)) + #scale_y_continuous(limits = c(-10, 40),breaks=seq(from = -10, to = 40, by = 5),expand = c(0, 0)) + #scale_x_continuous(breaks=c(0,6,12,18,24),expand = c(0, 0))+ #geom_hline(yintercept=comftemp)+ #geom_ribbon(data=temps,aes(ymin=18,ymax=22,x=hour,alpha=0.3,fill='blue'))+ #geom_ribbon(data=temps,aes(ymin=22,ymax=24,x=hour,alpha=0.3,fill='red'))+ #theme( # panel.background = element_rect(fill = 'white'), # panel.border = element_rect(colour = "black", fill=NA, size=1), # panel.grid.major = element_line(colour = "#B0B0B0"), # panel.grid.minor.x = element_blank(), # panel.grid.minor.y = element_blank())+ # ggtitle(format(ISOdate(2000, i, 1), "%B")) + # labs(x='Date', y= expression("Temperature (" *degree * "C)")) # axis.title.x = element_text(vjust=-3,size=10), # axis.title.y = element_text(vjust=+3,size=10), # panel.border = element_rect(fill=NA,colour = "#AAAAAA",size=2), ##ii plot.margin=unit(c(1,1,1.5,1.2),"cm") dev.off() pdf("/home/martin/qw3e.com/output/merra2.pdf", width=10, height=5) ggplot(merra, aes(x=temp)) + geom_density()+ scale_x_continuous(limits=c(-30,20)) dev.off()