Commit 8e34aec7 authored by Dorchies David's avatar Dorchies David
Browse files

feat: export data in the package

parent 3ddf1e34
No related merge requests found
Showing with 90 additions and 58 deletions
+90 -58
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_objectives.R
\name{get_objectives}
\alias{get_objectives}
\title{Load objective data for \code{\link{vgest_run}}}
\usage{
get_objectives(
objective_thresholds = app_sys("seine", "objective_thresholds.txt"),
objective_stations = app_sys("seine", "objective_stations.json"),
lakes = app_sys("seine", "lakes.txt")
)
}
\arguments{
\item{objective_thresholds}{File location of threshold table}
\item{objective_stations}{File location of objective station table}
\item{lakes}{File location of lake table}
}
\value{
A dataframe containing one line by objective and the following columns:
\itemize{
\item station (character): identifier of the objective station
\item flood (boolean): TRUE for high flow mitigation objective, and FALSE for low flow support
\item level (character): code composed with "l" for low-flow and "h" for high flow followed by the number of the level
\item threshold (numeric): value of the threshold in m3/s
\item lakes (dataframe): Dataframe containing lake details (name, min storage, max storage)
}
}
\description{
Load objective data for \code{\link{vgest_run}}
}
\examples{
# Get objectives stored in IRMaRA package
df <- get_objectives()
# Objectives at Paris
df[df[,"station"] == "PARIS_05",]
# Lake details concerning the 40th objective in the table
df[57, "lakes"]
}
...@@ -29,15 +29,15 @@ Use for binding results of several lakes for one objective at one station. ...@@ -29,15 +29,15 @@ Use for binding results of several lakes for one objective at one station.
} }
\examples{ \examples{
\dontrun{ \dontrun{
dfTs <- get_vobj_ts(vgest_read_all(get_objectives()[1,], "./database")) dfTs <- get_vobj_ts(vgest_read_all(objectives[1,], "./database"))
} }
\dontrun{ \dontrun{
# Get the first lake of the first objective # Get the first lake of the first objective
dfTs <- get_vobj_ts(vgest_read_all(get_objectives()[1,], "./database")[[1]]) dfTs <- get_vobj_ts(vgest_read_all(objectives[1,], "./database")[[1]])
# Can also be done by # Can also be done by
dfTs <- get_vobj_ts(vgest_read_one(1, get_objectives()[1,], "./database")) dfTs <- get_vobj_ts(vgest_read_one(1, objectives[1,], "./database"))
} }
\dontrun{ \dontrun{
dfTs <- get_vobj_ts(vgest_read_all(get_objectives()[1,], "./database")) dfTs <- get_vobj_ts(vgest_read_all(objectives[1,], "./database"))
} }
} }
man/lakes.Rd 0 → 100644
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lakes.R
\docType{data}
\name{lakes}
\alias{lakes}
\title{Characteristics of the 4 lakes managed by Seine Grands Lacs}
\format{
a \link{data.frame} with 3 columns:
\itemize{
\item "name" the name of the river on which the lake is implemented (\link{character})
\item "min" the minimum lake storage in Mm3 (\link{numeric})
\item "max" the maximum lake storage in Mm3 (\link{numeric})
}
}
\source{
\url{https://www.seinegrandslacs.fr/quatre-lacs-reservoirs-au-coeur-dun-bassin}
}
\usage{
lakes
}
\description{
Characteristics of the 4 lakes managed by Seine Grands Lacs
}
\keyword{datasets}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/objectives.R
\docType{data}
\name{objectives}
\alias{objectives}
\title{Objectives of reservoir management on the Seine River}
\format{
a \link{data.frame} with 5 columns:
\itemize{
\item "station" the id of the station (\link{character})
\item "flood" a \link{logical} which is \code{TRUE} for a flood objective and \code{FALSE} for a drought objective
\item "level" a \link{character} representing the severity of the threshold: "l1" to "l4" for low flow thresholds and "h1" to "h3" for high flow thresholds
\item "lakes" a \link{list} which contains a \link{data.frame} with informations concerning the lakes (See \link{lakes})
}
}
\source{
Dorchies, D., Thirel, G., Jay-Allemand, M., Chauveau, M., Dehay, F., Bourgin, P.-Y., Perrin, C., Jost, C., Rizzoli, J.-L., Demerliac, S., Thépot, R., 2014. Climate change impacts on multi-objective reservoir management: case study on the Seine River basin, France. International Journal of River Basin Management 12, 265–283. \url{https://doi.org/10.1080/15715124.2013.865636}
}
\usage{
objectives
}
\description{
Objectives of reservoir management on the Seine River
}
\keyword{datasets}
...@@ -11,7 +11,7 @@ plot_isofrequency_lake(vObj, frequencies, lake, top.margin) ...@@ -11,7 +11,7 @@ plot_isofrequency_lake(vObj, frequencies, lake, top.margin)
\item{frequencies}{vector of frequencies to plot} \item{frequencies}{vector of frequencies to plot}
\item{lake}{lake data extract from column \code{lakes} of objective data given by \code{\link[=get_objectives]{get_objectives()}}} \item{lake}{lake data extract from column \code{lakes} of objective data given by \link{objectives}}
\item{top.margin}{top margin applied on the plot for the title} \item{top.margin}{top margin applied on the plot for the title}
} }
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rulesets.R
\docType{data}
\name{rulesets}
\alias{rulesets}
\title{Rule sets used in the reservoir managements}
\format{
a \link{list} with 2 items:
\itemize{
\item "constraints" \link{character} description of the constraints apply on the management of the reservoir
\item "rules" \link{character} description of rule set selections depending on which constraints are applied
}
}
\source{
Dehay, F., 2012. Etude de l’impact du changement climatique sur la gestion des lacs-réservoirs de la Seine (other). Diplôme d’ingénieur de l’ENGEES ,Strasbourg. \url{https://hal.inrae.fr/hal-02597326}
}
\usage{
rulesets
}
\description{
Rule sets used in the reservoir managements
}
\keyword{datasets}
...@@ -18,7 +18,7 @@ vgest_cost(data, objective) ...@@ -18,7 +18,7 @@ vgest_cost(data, objective)
\arguments{ \arguments{
\item{data}{the \link{list} given by \code{\link[=vgest_read_chrono]{vgest_read_chrono()}}} \item{data}{the \link{list} given by \code{\link[=vgest_read_chrono]{vgest_read_chrono()}}}
\item{objective}{\link{data.frame} given by \code{\link[=get_objectives]{get_objectives()}}} \item{objective}{\link{data.frame} given by \link{objectives}}
} }
\value{ \value{
the total cost for one objective at one station in m3/day the total cost for one objective at one station in m3/day
...@@ -33,19 +33,19 @@ Uses ouput of PaChrono.txt or VObj[1-4].dat for the calculation. ...@@ -33,19 +33,19 @@ Uses ouput of PaChrono.txt or VObj[1-4].dat for the calculation.
\examples{ \examples{
\dontrun{ \dontrun{
# This should be done after the execution of vgest for the concerned objective # This should be done after the execution of vgest for the concerned objective
objective <- get_objectives()[1,] objective <- objectives[1,]
lResultVobj <- vgest_read_all(objective) lResultVobj <- vgest_read_all(objective)
vgest_cost(lResultVobj, objective) vgest_cost(lResultVobj, objective)
} }
\dontrun{ \dontrun{
# This should be done after the execution of vgest for the concerned objective # This should be done after the execution of vgest for the concerned objective
objective <- get_objectives()[1,] objective <- objectives[1,]
lChrono <- vgest_read_chrono(objective) lChrono <- vgest_read_chrono(objective)
vgest_cost(lChrono[[1]], objective) vgest_cost(lChrono[[1]], objective)
} }
\dontrun{ \dontrun{
# This should be done after the execution of vgest for the concerned objective # This should be done after the execution of vgest for the concerned objective
objective <- get_objectives()[1,] objective <- objectives[1,]
lChronos <- vgest_read_chrono(objective, distributionType = 2) lChronos <- vgest_read_chrono(objective, distributionType = 2)
vgest_cost(lChronos, objective) vgest_cost(lChronos, objective)
} }
......
...@@ -9,7 +9,7 @@ vgest_cost_lakes(Vobj, objective) ...@@ -9,7 +9,7 @@ vgest_cost_lakes(Vobj, objective)
\arguments{ \arguments{
\item{Vobj}{A \link{matrix} or a \link{data.frame} with one column by lake, in the same order as \code{objective$lakes}} \item{Vobj}{A \link{matrix} or a \link{data.frame} with one column by lake, in the same order as \code{objective$lakes}}
\item{objective}{one row of the dataframe given by \code{\link[=get_objectives]{get_objectives()}}} \item{objective}{one row of the dataframe given by \link{objectives}}
} }
\value{ \value{
total cost of all the lakes in m3/day total cost of all the lakes in m3/day
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
vgest_read_all(x, result.dir = "database") vgest_read_all(x, result.dir = "database")
} }
\arguments{ \arguments{
\item{x}{one line of the dataframe produced by \code{\link[=get_objectives]{get_objectives()}}} \item{x}{one line of the dataframe produced by \link{objectives}}
\item{result.dir}{path where results of VGEST runs are stored (See \code{\link[=vgest_run_store]{vgest_run_store()}})} \item{result.dir}{path where results of VGEST runs are stored (See \code{\link[=vgest_run_store]{vgest_run_store()}})}
} }
...@@ -19,6 +19,6 @@ Read all result files \code{VOBJi.DAT} for all the lakes of one objective at one ...@@ -19,6 +19,6 @@ Read all result files \code{VOBJi.DAT} for all the lakes of one objective at one
} }
\examples{ \examples{
\dontrun{ \dontrun{
vgest_read_all(get_objectives()[1,], "./database") vgest_read_all(objectives[1,], "./database")
} }
} }
...@@ -67,7 +67,7 @@ The file is saved in RDS format for quicker reading the next time. ...@@ -67,7 +67,7 @@ The file is saved in RDS format for quicker reading the next time.
} }
\examples{ \examples{
\dontrun{ \dontrun{
objective <- get_objectives()[1,] objective <- objectives[1,]
distributionType <- 2 distributionType <- 2
vgest_run_store(objective, vgest_run_store(objective,
1, 1, "Q_NAT_1900-2009.txt", 1, 1, "Q_NAT_1900-2009.txt",
......
...@@ -9,7 +9,7 @@ vgest_read_one(iLake, x, result.dir) ...@@ -9,7 +9,7 @@ vgest_read_one(iLake, x, result.dir)
\arguments{ \arguments{
\item{iLake}{Lake number for the current station} \item{iLake}{Lake number for the current station}
\item{x}{one line of the dataframe produced by \code{\link[=get_objectives]{get_objectives()}}} \item{x}{one line of the dataframe produced by \link{objectives}}
\item{result.dir}{path where results of VGEST runs are stored (See \code{\link[=vgest_run_store]{vgest_run_store()}})} \item{result.dir}{path where results of VGEST runs are stored (See \code{\link[=vgest_run_store]{vgest_run_store()}})}
} }
...@@ -21,6 +21,6 @@ This function is preferred to \code{\link[=vgest_read]{vgest_read()}} because it ...@@ -21,6 +21,6 @@ This function is preferred to \code{\link[=vgest_read]{vgest_read()}} because it
} }
\examples{ \examples{
\dontrun{ \dontrun{
vgest_read_one(1, get_objectives()[1,], "./database") vgest_read_one(1, objectives[1,], "./database")
} }
} }
...@@ -37,7 +37,7 @@ vgest_run_store(x, ...) ...@@ -37,7 +37,7 @@ vgest_run_store(x, ...)
) )
} }
\arguments{ \arguments{
\item{x}{row(s) of a \link{data.frame} provided by \code{\link[=get_objectives]{get_objectives()}}} \item{x}{row(s) of a \link{data.frame} provided by \link{objectives}}
\item{...}{other parameter passed to the method \link{vgest_run_store.character}} \item{...}{other parameter passed to the method \link{vgest_run_store.character}}
...@@ -77,13 +77,13 @@ Prepare, run and store results of one or several VGEST instances ...@@ -77,13 +77,13 @@ Prepare, run and store results of one or several VGEST instances
\dontrun{ \dontrun{
# Example with `vgest_run_store.Objectives` # Example with `vgest_run_store.Objectives`
# Running vgest for: # Running vgest for:
# - the first objective returned by `get_objectives()` # - the first objective returned by `objectives`
# - the first configuration of reservoir rules # - the first configuration of reservoir rules
# - the first configuration of network # - the first configuration of network
# - the naturalized hydrological flows of the file located in DONNEES/Q_NAT_1900-2009.txt # - the naturalized hydrological flows of the file located in DONNEES/Q_NAT_1900-2009.txt
# - doing the optimization on the period between 01/01/1900 and 31/12/2009 # - doing the optimization on the period between 01/01/1900 and 31/12/2009
# - a task distribution function of present volumes and maximum usable volume replenishment times from the start of time steps # - a task distribution function of present volumes and maximum usable volume replenishment times from the start of time steps
vgest_run_store(get_objectives()[1,], vgest_run_store(objectives[1,],
1, 1, "Q_NAT_1900-2009.txt", 1, 1, "Q_NAT_1900-2009.txt",
"01/01/1900", "31/12/2009", 2) "01/01/1900", "31/12/2009", 2)
......
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