-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaudales_climato.R
More file actions
51 lines (40 loc) · 1.52 KB
/
caudales_climato.R
File metadata and controls
51 lines (40 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## calculo de climatologias con excel caudales
rm(list = ls())
setwd('D:/trabajo/IGP/CLIM_PEZ/Dra_Jaramillos/')
dir()
library(readxl)
library(vegan)
library(ade4)
library(xlsx)
library(rJava)
data1<-read_excel("Caudales.xlsx", sheet = "data")
View(data1)
tDate=as.POSIXct(data1$Date)
View(tDate)
year=as.integer(format(tDate,format="%Y"))
month=as.integer(format(tDate,format="%m"))
day=as.integer(format(tDate,format="%d"))
areMissingIndx=is.na(data1$Requena)
# But we can also convert them to 0/1 and sum them
totalMissingCount=sum(areMissingIndx)
# Compute some percentiles for this month,
# median and 95% confidence interval for instance
#Percentiles=quantile(data1$`PP mensual Cuenca`,c(0.025,0.5,0.975),na.rm=TRUE)
tmpdata=data.frame(year=year,
month=month, day=day,
missingCount=totalMissingCount,
meanPPm=data1$Requena)
xaxis=ISOdate(tmpdata$year,tmpdata$month,tmpdata$day)
plot(xaxis,tmpdata$missingCount)
# Very regular seasonal cycle
plot(xaxis,tmpdata$meanPPm,col="red",type="l")
scycle=aggregate(tmpdata,by=list(tmpdata$month),FUN=mean,na.rm=TRUE)
# Original data
dim(tmpdata)
dim(scycle)
names(scycle)
# This has been created when grouping the data (months in this case)
print(scycle$Group.1)
# Plot the regular seasonal cycle, this time it is very regular
plot(scycle$Group.1,scycle$meanPPm,typ="b",lwd=2,col="blue",main='Climatologia Mensual PPCuenca')
grid()