Skip to content

Commit

Permalink
Add opts in vignette 'Edit geographic trimming'
Browse files Browse the repository at this point in the history
  • Loading branch information
boitardn committed Jan 18, 2024
1 parent 4e83182 commit 85fa52d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions R/updateGeneralSettings.R
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ dicoGeneralSettings <- function(arg) {
"nbtimeserieshydro", "nbtimeserieswind", "nbtimeseriesthermal",
"nbtimeseriessolar", "refreshtimeseries", "intra-modal", "inter-modal",
"refreshintervalload", "refreshintervalhydro", "refreshintervalwind",
"refreshintervalthermal", "refreshintervalsolar", "readonly","geographic-trimming")
"refreshintervalthermal", "refreshintervalsolar", "readonly", "geographic-trimming")
)
names(antares_params) <- c("mode", "horizon", "nbyears", "simulation.start", "simulation.end",
"january.1st", "first.month.in.year", "first.weekday", "leapyear",
Expand All @@ -264,7 +264,7 @@ dicoGeneralSettings <- function(arg) {
"nbtimeserieshydro", "nbtimeserieswind", "nbtimeseriesthermal",
"nbtimeseriessolar", "refreshtimeseries", "intra.modal", "inter.modal",
"refreshintervalload", "refreshintervalhydro", "refreshintervalwind",
"refreshintervalthermal", "refreshintervalsolar", "readonly","geographic.trimming")
"refreshintervalthermal", "refreshintervalsolar", "readonly", "geographic.trimming")
antares_params[[arg]]
}

Expand Down
38 changes: 20 additions & 18 deletions vignettes/antaresEditObject.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,17 @@ my_study <- file.path("", "", "")
opts <- setSimulationPath(my_study, simulation ="input")

# choose geographic trimming when creating new Antares areas
initial_filtering_synthesis <- c("hourly")
initial_filtering_year_by_year <- c("daily")
# default filtering : c("hourly","daily","weekly","monthly","annual")
initial_filtering_synthesis <- c("weekly","monthly")
initial_filtering_year_by_year <- c("monthly","annual")

opts <- createArea("area1",

opts <- createArea(name = "area1",
filtering = filteringOptions(
filter_synthesis = initial_filtering_synthesis,
filter_year_by_year = initial_filtering_year_by_year),
opts = opts)
opts <- createArea("area2",opts = opts)
opts <- createArea(name = "area2",opts = opts)
opts <- createLink(from = "area1",
to = "area2",
propertiesLink = propertiesLinkOptions(
Expand All @@ -332,26 +334,26 @@ print(initial_GT$areas[["area1"]])
print(initial_GT$links[["area1 - area2"]])

# edit geographic trimming of an existing area or link
new_filtering_synthesis <- c("weekly")
new_filtering_year_by_year <- c("monthly")

editArea("area1",
filtering = filteringOptions(
filter_synthesis = new_filtering_synthesis,
filter_year_by_year = new_filtering_year_by_year),
opts = opts)
editLink(from = "area1",
to = "area2",
filter_year_by_year = new_filtering_year_by_year,
filter_synthesis = new_filtering_synthesis,
opts = opts)
new_filtering_synthesis <- c("monthly")
new_filtering_year_by_year <- c("annual")

opts <- editArea(name = "area1",
filtering = filteringOptions(
filter_synthesis = new_filtering_synthesis,
filter_year_by_year = new_filtering_year_by_year),
opts = opts)
opts <- editLink(from = "area1",
to = "area2",
filter_year_by_year = new_filtering_year_by_year,
filter_synthesis = new_filtering_synthesis,
opts = opts)

# check the new filters
new_GT <- antaresRead::getGeographicTrimming(areas="area1",links=TRUE,opts=opts)
print(new_GT$areas[["area1"]])
print(new_GT$links[["area1 - area2"]])

# important : make sure that `geographic-trimming` parameter is activated in general settings
opts <- updateGeneralSettings(geographic.trimming = TRUE)
opts <- updateGeneralSettings(geographic.trimming = TRUE,opts = opts)
```

0 comments on commit 85fa52d

Please sign in to comment.