Skip to contents

Create GIF animation of capacity factors by cluster and time-slice

Usage

ideea_gif_cf(
  x,
  ideea_cl_sf,
  ideea_sf = NULL,
  cf_name = names(x)[grepl("cf_"), names(x)][1],
  slice = unique(x$slice)[1:24],
  timestamp.stamp = TRUE,
  fill_scale_lims = range(x[[cf_name]]),
  fps = 12,
  gif.width = 576,
  gif.height = 576,
  filename = "ideea_cl.gif"
)

Arguments

x

data.frame of capacity factors, typically from get_ideea_cf()

ideea_cl_sf

sf, cluster shapefile, typically from get_ideea_cl_sf()

ideea_sf

sf, ideea shapefile, typically from get_ideea_map()

cf_name

character, name of capacity factor column in x (e.g. "wcf_100m", "scf_tl", etc.)

slice

character vector, time-slices to udpate in the GIF

timestamp.stamp

logical, if TRUE, add timestamp to the plot

fill_scale_lims

numeric vector of length two, limits of the fill scale

fps

numeric, frames per second, default is 12

gif.width

numeric, width of the GIF, default is 576

gif.height

numeric, height of the GIF, default is 576

filename

character, name of the GIF file

Value

A GIF animation of capacity factors by cluster and time-slice saved in the working directory

Examples

# do not run
resource <- "win"; cf_name <- "wcf_100m"
resource <- "sol"; cf_name <- "scf_tl"
nreg <- 5
tol <- 0.01

ideea_sf <- get_ideea_map(nreg = nreg, offshore = T, islands = T)
ideea_cl_sf <- get_ideea_cl_sf(resource = resource, tol = tol)
#> Error in str_detect(names(x), pattern = "cf_"): could not find function "str_detect"

ideea_cl_sf$cluster |> unique()
#> Error in eval(expr, envir, enclos): object 'ideea_cl_sf' not found
plot(ideea_cl_sf["cluster"])
#> Error in eval(expr, envir, enclos): object 'ideea_cl_sf' not found

x <- get_ideea_cf(resource, tol = tol)
#> Reading capacity factors data from:
#>    D:/Dropbox/projects/ideea_extra//merra2/cf_sol_r5_TOL01_d365_h24_2019.fst 
#>    Maximum number of clusters per region: 50 

slices_1day_per_month <-
  ideea_modules$electricity$reg7_base$partial_calendar_1day_per_month@timetable$slice
#> Error in ideea_modules$electricity$reg7_base$partial_calendar_1day_per_month@timetable: no applicable method for `@` applied to an object of class "NULL"

ideea_gif_cf(x, ideea_cl_sf, ideea_sf, cf_name = cf_name,
             slice = slices_1day_per_month,
             filename = glue("tmp/{resource}.gif"))
#> Error in eval(expr, envir, enclos): object 'slices_1day_per_month' not found