-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculate performance metrics.Rmd
More file actions
93 lines (73 loc) · 4.01 KB
/
Copy pathCalculate performance metrics.Rmd
File metadata and controls
93 lines (73 loc) · 4.01 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
```{r}
library(hydroGOF)
hydropower <- read_csv("C:/Users/gusta/Desktop/PhD/CERCWET/GCMs/results5blocks/Hydropower_Energy_MWh.csv")
hydropower
hydropower1 <- hydropower %>%
# mutate(date = as.Date(date, "%m/%d/%Y")) %>%
# filter(date > "2009-12-01")%>%
mutate(resource = factor(resource),
basin = factor(basin)) %>%
group_by(basin, resource) %>%
summarise(NSE = hydroGOF::NSE(Simulated, Observed, na.rm=TRUE),
KGE = hydroGOF::KGE(Simulated, Observed, na.rm=TRUE),
RMSE = hydroGOF::rmse(Simulated, Observed, na.rm=TRUE),
PBIAS = hydroGOF::pbias(Simulated, Observed, na.rm=TRUE)*-1)#pbias = 100*(sum((.$Simulated - .$Observed, na.rm=TRUE)/sum(.$Observed, na.rm=TRUE), na.rm =TRUE)))#
hydropower1
hydropowerflow <- read_csv("C:/Users/gusta/Desktop/PhD/CERCWET/GCMs/results5blocks/Hydropower_Flow_mcm.csv")
hydropowerflow
hydropowerflow1 <- hydropowerflow %>%
#mutate(date = as.Date(date, "%m/%d/%Y")) %>%
#filter(date > "2009-12-01") %>%
mutate(resource = factor(resource),
basin = factor(basin)) %>%
group_by(basin, resource) %>%
summarise(NSE = hydroGOF::NSE(Simulated, Observed, na.rm=TRUE),
KGE = hydroGOF::KGE(Simulated, Observed, na.rm=TRUE),
RMSE = hydroGOF::rmse(Simulated, Observed, na.rm=TRUE),
PBIAS = hydroGOF::pbias(Simulated, Observed, na.rm=TRUE)*-1)#pbias = 100*(sum((.$Simulated - .$Observed, na.rm=TRUE)/sum(.$Observed, na.rm=TRUE), na.rm =TRUE)))#
hydropowerflow1
IFR <- read_csv("C:/Users/gusta/Desktop/PhD/CERCWET/GCMs/results5blocks/InstreamFlowRequirement_Flow_mcm.csv")
IFR
IFR1 <- IFR %>%
mutate(resource = factor(resource),
basin = factor(basin)) %>%
#mutate(date = as.Date(date, "%m/%d/%Y")) %>%
#filter(date > "2009-12-01") %>%
group_by(basin, resource) %>%
summarise(NSE = hydroGOF::NSE(Simulated, Observed, na.rm=TRUE),
KGE = hydroGOF::KGE(Simulated, Observed, na.rm=TRUE),
RMSE = hydroGOF::rmse(Simulated, Observed, na.rm=TRUE),
PBIAS = hydroGOF::pbias(Simulated, Observed, na.rm=TRUE)*-1)#pbias = 100*(sum((.$Simulated - .$Observed, na.rm=TRUE)/sum(.$Observed, na.rm=TRUE), na.rm =TRUE)))#
IFR1
outputflow <- read_csv("C:/Users/gusta/Desktop/PhD/CERCWET/GCMs/results5blocks/Output_Flow_mcm.csv")
outputflow
outputflow1 <- outputflow %>%
#mutate(date = as.Date(date, "%m/%d/%Y")) %>%
#filter(date > "2009-12-01")%>%
mutate(resource = factor(resource),
basin = factor(basin)) %>%
group_by(basin, resource) %>%
summarise(NSE = hydroGOF::NSE(Simulated, Observed, na.rm=TRUE),
KGE = hydroGOF::KGE(Simulated, Observed, na.rm=TRUE),
RMSE = hydroGOF::rmse(Simulated, Observed, na.rm=TRUE),
PBIAS = hydroGOF::pbias(Simulated, Observed, na.rm=TRUE)*-1)#pbias = 100*(sum((.$Simulated - .$Observed, na.rm=TRUE)/sum(.$Observed, na.rm=TRUE), na.rm =TRUE)))#
outputflow1
storage <- read_csv("C:/Users/gusta/Desktop/PhD/CERCWET/GCMs/results5blocks/Reservoir_Storage_mcm.csv")
storage
storage1 <- storage %>%
#mutate(date = as.Date(date, "%m/%d/%Y")) %>%
#filter(date > "2009-12-01")%>%
mutate(resource = factor(resource),
basin = factor(basin)) %>%
group_by(basin, resource) %>%
summarise(NSE = hydroGOF::NSE(Simulated, Observed, na.rm=TRUE),
KGE = hydroGOF::KGE(Simulated, Observed, na.rm=TRUE),
RMSE = hydroGOF::rmse(Simulated, Observed, na.rm=TRUE),
PBIAS = hydroGOF::pbias(Simulated, Observed, na.rm=TRUE)*-1)#pbias = 100*(sum((.$Simulated - .$Observed, na.rm=TRUE)/sum(.$Observed, na.rm=TRUE), na.rm =TRUE)))#
storage1
library(openxlsx)
listofdatasets <- list("Hydropower" = hydropower1, "Hydropower Flow" = hydropowerflow1, "Instreamflow" = IFR1, "Outflow" = outputflow1, "Storage" = storage1)
write.xlsx(listofdatasets, file="C:/Users/gusta/Desktop/PhD/CERCWET/GCMs/metrics_posteverything_withoutplanning.xlsx", row.names=FALSE)
```
```{r}
```