HARPgroup / HARParchive

This repo houses HARP code development items, resources, and intermediate work products.
1 stars 0 forks source link

Examples for WSP_Regional_Summaries.rmd #1130

Open glenncampagna opened 1 year ago

glenncampagna commented 1 year ago

Scripts:

Examples

basepath='/var/www/R'
source('/var/www/R/config.R')

Current Dataframe Generator for WSP Planners (updated 5/28/2024) - Regional Df

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd"), 
                  params = list(
                      origin = "Chowan_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      metric_mod = c("wd_mgd", "unmet1_mgd", "unmet7_mgd", "unmet30_mgd"), 
                      model_version = "vahydro-1.0",
                      metric_feat = "wsp2020_2040_mgy", 
                      rivseg_metric = c("l90_Qout", "l30_Qout", "7q10", "Smin_L30_mg"), 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      limit_featrs_to_origin = FALSE,
                      overwrite_files = TRUE, 
                      base_layer_data = FALSE
                  )
)

Current WSP Regional Summaries Render for WSP Planners (updated 5/28/24) - Regional

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/WSP_Regional_Summaries.Rmd"), 
                  output_file = paste0(export_path, "Chowan_1_wsp"),
                  output_format = "word_document",
                  params = list(
                      origin = "Chowan_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      featrs_file = paste0(export_path, "/Chowan_1_featrs_sf.csv"), 
                      featrs_file_map_bubble_column = "wsp2020_2040_mgy", 
                      featrs_file_table_column = c("runid_11_wd_mgd","runid_13_wd_mgd","five_yr_avg","wsp2020_2040_mgy"), 
                      rsegs_file = paste0(export_path, "/Chowan_1_rsegs_sf.csv"), 
                      run_set = "wsp_2020_2040", 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      map_style = "custom", 
                      bbox_type = "auto",
                      show_map = TRUE))

Current Dataframe Generator for WSP Planners (updated 5/28/2024) - Local Df

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd"), 
                  params = list(
                      origin = "51073", 
                      origin_type = "locality", 
                      featr_type = "facility", 
                      metric_mod = "wd_mgd", 
                      model_version = "vahydro-1.0",
                      metric_feat = "wsp2020_2040_mgy", 
                      rivseg_metric = c("l90_Qout", "l30_Qout", "7q10", "Smin_L30_mg"), 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      limit_featrs_to_origin = FALSE,
                      overwrite_files = TRUE, 
                      base_layer_data = FALSE
                  )
)

Basin examples: JL7_7070_0001 & JL6_7430_7320

image image

Region examples:

image

rburghol commented 11 months ago

I had success producing this image (code used is here: https://github.com/HARPgroup/vahydro/issues/941#issuecomment-1843225038)

image

megpritch commented 9 months ago

Example Using 'run_sets' and Updated File Paths from Organizing

BigSandy_UpperTennessee_1 Region

Dataframe_Generator.Rmd:

rmarkdown::render("C:/aa_HARP/aa_GitHub/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd", 
                  params = list(
                      origin = "BigSandy_UpperTennessee_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      metric_mod = "wd_mgd", 
                      model_version = "vahydro-1.0",
                      metric_feat = "wsp2020_2040_mgy", 
                      rivseg_metric = c("l30_Qout", "7q10", "Smin_L30_mg"), 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      limit_featrs_to_origin = FALSE,
                      overwrite_files = TRUE, 
                      base_layer_data = FALSE))

WSP_RegionalSummaries.Rmd:

rmarkdown::render("C:/aa_HARP/aa_GitHub/HARParchive/HARP-2023-Summer/Mapping/WSP_Regional_Summaries.Rmd", 
                  output_file = "C:/aa_HARP/Exports/bigsandy_ut_postorganize",
                  output_format = "word_document",
                  params = list(
                      origin = "BigSandy_UpperTennessee_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      featrs_file = "C:/aa_HARP/Exports/BigSandy_UpperTennessee_1_featrs_sf.csv", 
                      featrs_file_map_bubble_column = "wsp2020_2040_mgy", 
                      featrs_file_table_column = c("runid_11_wd_mgd","runid_13_wd_mgd","five_yr_avg","wsp2020_2040_mgy"), 
                      rsegs_file = "C:/aa_HARP/Exports/BigSandy_UpperTennessee_1_rsegs_sf.csv", 
                      run_set = "wsp_2020_2040", 
                      runid_list = c("runid_11", "runid_13"), 
                      crs_default = 4326, 
                      map_style = "custom", 
                      bbox_type = "auto",
                      show_map = TRUE))

image image image

EllaF21 commented 9 months ago

Successful runs with new runset addition:

Using the following general renders (Ella):

rmarkdown::render("C:/HARP//HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd", 
                  params = list(
                      origin = "JL6_7430_7320", 
                      origin_type = "basin", 
                      featr_type = "facility", 
                      metric_mod = "wd_mgd", 
                      model_version = "vahydro-1.0",
                      metric_feat = "wsp2020_2040_mgy", 
                      rivseg_metric = c("l30_Qout", "7q10", "Smin_L30_mg"), 
                      runid_list = c("runid_11", "runid_13", "runid_17", "runid_19"), 
                      crs_default = 4326, 
                      limit_featrs_to_origin = FALSE,
                      overwrite_files = TRUE, 
                      base_layer_data = FALSE))
rmarkdown::render("C:/HARP/HARParchive/HARP-2023-Summer/Mapping/WSP_Regional_Summaries.Rmd", 
                  output_file = "C:/HARP/Exports/Shenandoah_1test",
                  output_format = "word_document",
                  params = list(
                      origin = "Shenandoah_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      featrs_file = "C:/HARP/Exports/Shenandoah_1_featrs_sf.csv", 
                      featrs_file_map_bubble_column = "wsp2020_2040_mgy", 
                      featrs_file_table_column = c("runid_11_wd_mgd","runid_13_wd_mgd","five_yr_avg","wsp2020_2040_mgy"), 
                      rsegs_file = "C:/HARP/Exports/Shenandoah_1_rsegs_sf.csv", 
                      run_set = "wsp_2020_2040", 
                      runid_list = c("runid_11", "runid_13", "runid_17" ,"runid_19"), 
                      crs_default = 4326, 
                      map_style = "custom", 
                      bbox_type = "auto",
                      show_map = TRUE))
rburghol commented 9 months ago

Testing a county/locality.

Generate dataset:

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd"), 
                  params = list(
                      origin = "51073", 
                      origin_type = "locality", 
                      featr_type = "facility", 
                      metric_mod = "wd_mgd", 
                      model_version = "vahydro-1.0",
                      metric_feat = "wsp2020_2040_mgy", 
                      rivseg_metric = c("l30_Qout", "7q10", "Smin_L30_mg"), 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      limit_featrs_to_origin = FALSE,
                      overwrite_files = TRUE, 
                      base_layer_data = FALSE
        )
)

Generate markdown:

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/WSP_Regional_Summaries.Rmd"), 
                  output_file = paste0(export_path, "51073_wsp"),
                  output_format = "word_document",
                  params = list(
                      origin = "51073", 
                      origin_type = "locality", 
                      featr_type = "facility", 
                      featrs_file = paste0(export_path, "/51073_featrs_sf.csv"), 
                      featrs_file_map_bubble_column = "wsp2020_2040_mgy", 
                      featrs_file_table_column = c("runid_11_wd_mgd","runid_13_wd_mgd","five_yr_avg","wsp2020_2040_mgy"), 
                      rsegs_file = paste0(export_path, "/51073_rsegs_sf.csv"), 
                      run_set = "wsp_2020_2040", 
                      runid_list = c("runid_11", "runid_13", "runid_17" ,"runid_19"), 
                      crs_default = 4326, 
                      map_style = "custom", 
                      bbox_type = "auto",
                      show_map = TRUE))
gmahadwar commented 9 months ago

Using foundation_location and SharePoint: ( @ Planners )

Run this once per time you open R:

basepath='/var/www/R'
source('/var/www/R/config.R')

Df Generator Planners edit origin and origin_type

rmarkdown::render(paste0(onedrive_location,"\\OWS\\WSPA\\10_Yr Resubmission_2023\\Dataframe_Generator.Rmd"), 
                  params = list(
                      origin = "51073", 
                      origin_type = "locality", 
                      featr_type = "facility", 
                      metric_mod = "wd_mgd", 
                      model_version = "vahydro-1.0",
                      metric_feat = "wsp2020_2040_mgy", 
                      rivseg_metric = c("l90_Qout", "l30_Qout", "7q10", "Smin_L30_mg"), 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      limit_featrs_to_origin = FALSE,
                      overwrite_files = TRUE, 
                      base_layer_data = FALSE
                  )
)

WSP Regional Summary Planners - edit output_file, origin, origin_type, featrs_file, and rsegs_file to match Df generator render

rmarkdown::render(paste0(onedrive_location,"\\OWS\\WSPA\\10_Yr Resubmission_2023\\WSP_Regional_Summaries.Rmd"), 
                  output_file = paste0(export_path, "51073_wsp"),
                  output_format = "word_document",
                  params = list(
                      origin = "51073", 
                      origin_type = "locality", 
                      featr_type = "facility", 
                      featrs_file = paste0(export_path, "/51073_featrs_sf.csv"), 
                      featrs_file_map_bubble_column = "wsp2020_2040_mgy", 
                      featrs_file_table_column = c("runid_11_wd_mgd","runid_13_wd_mgd","five_yr_avg","wsp2020_2040_mgy"), 
                      rsegs_file = paste0(export_path, "/51073_rsegs_sf.csv"), 
                      run_set = "wsp_2020_2040", 
                      runid_list = c("runid_11", "runid_13", "runid_17" ,"runid_19"), 
                      crs_default = 4326, 
                      map_style = "custom", 
                      bbox_type = "auto",
                      show_map = TRUE))

Modelers - can use github_location (see comment below) instead of onedrive_location for active testing

rburghol commented 8 months ago

Generating Shenandoah for CIA exempt examination: (@EllaF21 see below for how to ask DataFRame Generator to get unmet30_mgd for facility models)

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd"), 
                  params = list(
                      origin = "Shenandoah_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      metric_mod = c("wd_mgd", "unmet1_mgd", "unmet7_mgd", "unmet30_mgd"), 
                      model_version = "vahydro-1.0",
                      metric_feat = "wsp2020_2040_mgy", 
                      rivseg_metric = c("l30_Qout", "7q10", "Smin_L30_mg"), 
                      runid_list = c("runid_11", "runid_13", "runid_17", "runid_18"), 
                      crs_default = 4326, 
                      limit_featrs_to_origin = FALSE,
                      overwrite_files = TRUE, 
                      base_layer_data = FALSE
        )
)
rburghol commented 6 months ago

Dataframe Generator

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd"), 
                  params = list(
                      origin = "Chowan_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      metric_mod = c("wd_mgd", "unmet1_mgd", "unmet7_mgd", "unmet30_mgd"), 
                      model_version = "vahydro-1.0",
                      metric_feat = "wsp2020_2040_mgy", 
                      rivseg_metric = c("l90_Qout", "l30_Qout", "7q10", "Smin_L30_mg"), 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      limit_featrs_to_origin = FALSE,
                      overwrite_files = TRUE, 
                      base_layer_data = FALSE
                  )
)

Regional Markdown


rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/WSP_Regional_Summaries.Rmd"), 
                   output_file = paste0(export_path, "Chowan_1_wsp"),
                   output_format = "word_document",
                   params = list(
                       origin = "Chowan_1", 
                       origin_type = "region", 
                       featr_type = "facility", 
                       featrs_file = paste0(export_path, "/Chowan_1_featrs_sf.csv"), 
                       featrs_file_map_bubble_column = "wsp2020_2040_mgy", 
                       featrs_file_table_column = c("runid_11_wd_mgd","runid_13_wd_mgd","five_yr_avg","wsp2020_2040_mgy"), 
                       rsegs_file = paste0(export_path, "/Chowan_1_rsegs_sf.csv"), 
                       run_set = "wsp_2020_2040", 
                       runid_list = c("runid_11", "runid_13", "runid_17"), 
                       crs_default = 4326, 
                       map_style = "custom", 
                       bbox_type = "auto",
                       show_map = TRUE))
rburghol commented 5 months ago
rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd"), 
                  params = list(
                      origin = "Shenandoah_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      metric_mod = c("wd_mgd", "unmet1_mgd", "unmet7_mgd", "unmet30_mgd"), 
                      model_version = "vahydro-1.0",
                      metric_feat = "wsp2020_2040_mgy", 
                      rivseg_metric = c("l90_Qout", "l30_Qout", "7q10", "Smin_L30_mg"), 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      limit_featrs_to_origin = FALSE,
                      overwrite_files = TRUE, 
                      base_layer_data = FALSE
                  )
)

Render:

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/WSP_Regional_Summaries.Rmd"), 
                  output_file = paste0(export_path, "Shenandoah_1_wsp"),
                  output_format = "word_document",
                  params = list(
                      origin = "Shenandoah_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      featrs_file = paste0(export_path, "/Shenandoah_1_featrs_sf.csv"), 
                      featrs_file_map_bubble_column = "wsp2020_2040_mgy", 
                      featrs_file_table_column = c("runid_11_wd_mgd","runid_13_wd_mgd","five_yr_avg","wsp2020_2040_mgy"), 
                      rsegs_file = paste0(export_path, "/Shenandoah_1_rsegs_sf.csv"), 
                      run_set = "wsp_2020_2040", 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      map_style = "custom", 
                      bbox_type = "auto",
                      show_map = TRUE))
rburghol commented 5 months ago

Big Sandy

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd"), 
                  params = list(
                      origin = "BigSandy_UpperTennessee_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      metric_mod = c("wd_mgd", "unmet1_mgd", "unmet7_mgd", "unmet30_mgd"), 
                      model_version = "vahydro-1.0",
                      metric_feat = "wsp2020_2040_mgy", 
                      rivseg_metric = c("l90_Qout", "l30_Qout", "7q10", "Smin_L30_mg"), 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      limit_featrs_to_origin = FALSE,
                      overwrite_files = TRUE, 
                      base_layer_data = FALSE
                  )
)

Render

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/WSP_Regional_Summaries.Rmd"), 
                  output_file = paste0(export_path, "BigSandy_UpperTennessee_1"),
                  output_format = "word_document",
                  params = list(
                      origin = "BigSandy_UpperTennessee_1", 
                      origin_type = "region", 
                      featr_type = "facility", 
                      featrs_file = paste0(export_path, "/BigSandy_UpperTennessee_1_featrs_sf.csv"), 
                      featrs_file_map_bubble_column = "wsp2020_2040_mgy", 
                      featrs_file_table_column = c("runid_11_wd_mgd","runid_13_wd_mgd","five_yr_avg","wsp2020_2040_mgy"), 
                      rsegs_file = paste0(export_path, "/BigSandy_UpperTennessee_1_rsegs_sf.csv"), 
                      run_set = "wsp_2020_2040", 
                      runid_list = c("runid_11", "runid_13", "runid_17"), 
                      crs_default = 4326, 
                      map_style = "custom", 
                      bbox_type = "auto",
                      show_map = TRUE))
rburghol commented 3 weeks ago

Testing in NOVA origin_name <- "NorthernPiedmont_1"

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd"), 
  params = list(
    origin = "NorthernPiedmont_1", 
    origin_type = "region", 
    featr_type = "facility", 
    metric_mod = c("wd_mgd", "unmet1_mgd", "unmet7_mgd", "unmet30_mgd"), 
    model_version = "vahydro-1.0",
    metric_feat = "wsp2020_2040_mgy", 
    rivseg_metric = c("l90_Qout", "l30_Qout", "7q10", "Qout", "Smin_L30_mg"), 
    runid_list = c("runid_11", "runid_13", "runid_17"), 
    baseline_runid_list = c("runid_1000", "runid_11"),
    crs_default = 4326, 
    limit_featrs_to_origin = FALSE,
    overwrite_files = TRUE, 
    base_layer_data = FALSE
  )
)

Make the map


rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/WSP_Regional_Summaries.Rmd"),
  output_file = paste0(export_path, origin_name, "_wsp"),
  # output_format = "word_document",
  params = list(
    origin = "NorthernPiedmont_1",
    origin_type = "locality",
    featr_type = "facility",
    featrs_file = paste0(export_path, "/", origin_name, "_featrs_sf.csv"),
    featrs_file_map_bubble_column = "wsp2020_2040_mgy",
    featrs_file_table_column = c("Use_Type","runid_11_wd_mgd","runid_13_wd_mgd","wsp2020_2040_mgy"),
    rsegs_file = paste0(export_path, "/", origin_name,"_rsegs_sf.csv"),
    run_set = "wsp_2020_2040",
    runid_list = c("runid_11", "runid_13", "runid_17", "runid_0"),
    crs_default = 4326,
    map_style = "custom",
    bbox_type = "custom",
    show_map = TRUE,
    suppress_errors = TRUE
  )
)
rburghol commented 3 weeks ago

Occoquan (Northern Virginia)

Use WSP Region

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd"), 
  params = list(
    origin = "NorthernVirginia", 
    origin_type = "region", 
    featr_type = "facility", 
    metric_mod = c("wd_mgd", "unmet1_mgd", "unmet7_mgd", "unmet30_mgd"), 
    model_version = "vahydro-1.0",
    metric_feat = "wsp2020_2040_mgy", 
    rivseg_metric = c("l90_Qout", "l30_Qout", "7q10", "Qout", "Smin_L30_mg"), 
    runid_list = c("runid_11", "runid_13", "runid_17"), 
    baseline_runid_list = c("runid_1000", "runid_11"),
    crs_default = 4326, 
    limit_featrs_to_origin = FALSE,
    overwrite_files = TRUE, 
    base_layer_data = FALSE
  )
)
rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/WSP_Regional_Summaries.Rmd"),
                  output_file = paste0(export_path, origin_name, "_wsp"),
                  # output_format = "word_document",
                  params = list(
                      origin = "NorthernVirginia",
                      origin_type = "locality",
                      featr_type = "facility",
                      featrs_file = paste0(export_path, "/", origin_name, "_featrs_sf.csv"),
                      featrs_file_map_bubble_column = "wsp2020_2040_mgy",
                      featrs_file_table_column = c("Use_Type","runid_11_wd_mgd","runid_13_wd_mgd","wsp2020_2040_mgy"),
                      rsegs_file = paste0(export_path, "/", origin_name,"_rsegs_sf.csv"),
                      run_set = "wsp_2020_2040",
                      runid_list = c("runid_11", "runid_13", "runid_17", "runid_0"),
                      crs_default = 4326,
                      map_style = "custom",
                      bbox_type = "custom",
                      show_map = TRUE,
                      suppress_errors = TRUE
                  )
)

Use PL3_5250_0001

rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/Dataframe_Generator.Rmd"), 
  params = list(
    origin = "PL3_5250_0001", 
    origin_type = "basin", 
    featr_type = "facility", 
    metric_mod = c("wd_mgd", "unmet1_mgd", "unmet7_mgd", "unmet30_mgd"), 
    model_version = "vahydro-1.0",
    metric_feat = "wsp2020_2040_mgy", 
    rivseg_metric = c("l90_Qout", "l30_Qout", "7q10", "Qout", "Smin_L30_mg"), 
    runid_list = c("runid_11", "runid_13", "runid_17"), 
    baseline_runid_list = c("runid_1000", "runid_11"),
    crs_default = 4326, 
    limit_featrs_to_origin = FALSE,
    overwrite_files = TRUE, 
    base_layer_data = FALSE
  )
)

Render the Maps/tables

origin_name = "PL3_5250_0001"
rmarkdown::render(paste0(github_location,"/HARParchive/HARP-2023-Summer/Mapping/WSP_Regional_Summaries.Rmd"),
                  output_file = paste0(export_path, origin_name, "_wsp"),
                  # output_format = "word_document",
                  params = list(
                      origin = "PL3_5250_0001",
                      origin_type = "basin",
                      featr_type = "facility",
                      featrs_file = paste0(export_path, "/", origin_name, "_featrs_sf.csv"),
                      featrs_file_map_bubble_column = "wsp2020_2040_mgy",
                      featrs_file_table_column = c("Use_Type","runid_11_wd_mgd","runid_13_wd_mgd","wsp2020_2040_mgy"),
                      rsegs_file = paste0(export_path, "/", origin_name,"_rsegs_sf.csv"),
                      run_set = "wsp_2020_2040",
                      runid_list = c("runid_11", "runid_13", "runid_17", "runid_0"),
                      crs_default = 4326,
                      map_style = "custom",
                      bbox_type = "auto",
                      show_map = TRUE,
                      suppress_errors = TRUE
                  )
)