Commit efd72951 authored by Dorchies David's avatar Dorchies David
Browse files

refactor: some simplifications

parent f95a3be1
1 merge request!2Calculate filling rule curve based on mSPA
Showing with 11 additions and 14 deletions
+11 -14
......@@ -7,24 +7,23 @@ data <- readr::read_delim(
delim = "\t", col_names = c("inflow", "release", "precip", "evapo", "downstreamFlow")
)
time <-
data.frame(seq(as.Date("1961/1/1"), as.Date("2007/12/31"), "month"))
month <-
data.frame(format(
time <- seq(as.Date("1961/1/1"), as.Date("2007/12/31"), "month")
stora <- data.frame(
Month = format(
as.Date(
time$seq.as.Date..1961.1.1....as.Date..2007.12.31.....month..,
time,
format = "%Y-%m-%d"
),
"%m"
))
year <-
data.frame(format(
),
Year= format(
as.Date(
time$seq.as.Date..1961.1.1....as.Date..2007.12.31.....month..,
time,
format = "%Y-%m-%d"
),
"%Y"
))
)
)
n <- NROW(na.omit(data))
Inflow <- data$inflow
dem <- data$release
......@@ -80,10 +79,8 @@ for (i in 2:n + 1) {
Zt[i - 1] <- S - Kt1[i - 1]
}
stora <-
data.frame(year, month, Zt) # [ Storage = reservoir capacity - Deficit ]
names(stora)[1] <- "Year"
names(stora)[2] <- "Month"
stora$Zt <- Zt # [ Storage = reservoir capacity - Deficit ]
ST <- reshape(
data = stora,
idvar = "Year",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment