DOI-USGS / gage-conditions-gif

Creative Commons Zero v1.0 Universal
17 stars 11 forks source link

Future updates to documentation #158

Open lindsayplatt opened 2 years ago

lindsayplatt commented 2 years ago

Capturing the things I skipped in #157 here for now:

  1. How to generate the full water year animation using previous quarter's callout_cfg.yml
  2. How to create shape pngs for any callout overlays (which we don't really do anymore since it looks better without)
  3. Add that ffmpeg is needed for video formats & gifsicle is needed for gif formats. Can most likely install with package managers

Here's some code that I used previously to generate the file to use as a basemap for creating the shapes in the past, though.

# To create a template for making the overlays, run the following
# You can make it with or without the basemap. The important part is that it is the right dimensions.

source("1_fetch/src/map_utils.R")
source("2_process/src/project_shift_states.R")
source("6_visualize/src/prep_basemap_fun.R")
source("6_visualize/src/prep_view_fun.R")
source("6_visualize/src/create_animation_frame.R")

viz_config <- yaml::yaml.load_file("viz_config.yml")
viz_config[['basemap']][["border"]] <- viz_config[['basemap']][["col"]] # No outlines on states
states_projected <- project_states('1_fetch/out/pre_state_boundaries_census.zip.ind', viz_config[['projection']])
states_shifted <- shift_states(states_projected, viz_config[['shift']])

create_animation_frame(
      png_file="6_visualize/in/overlay_template.png",
      config=viz_config[c('width','height')],
      prep_view_fun(as_view_polygon(viz_config[c('bbox', 'projection', 'width', 'height')]), viz_config['background_col']),
      prep_basemap_fun(states_shifted, viz_config[['basemap']]))