HARPgroup / HARParchive

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

Adding unmet demand table to runset #1235

Open gmahadwar opened 7 months ago

gmahadwar commented 7 months ago

Adding unmet table to runsets

Runset Excerpt from mapstyle_config.R

      list(
        data_set = 'facils_nogeom',
        metric='unmet30_mgd', #replace with unmet demand req 
        column_name='runid_11_unmet30_mgd', 
        run_label = 'A TEST FOR FACIL FUNCTION', 
        tables_cols = c('facility', 'Facility_hydroid', 'runid_11_unmet30_mgd'),
        #tables_cols = c('facility', 'Facility_hydroid', 'runid_11_unmet30_mgd',  'runid_13_unmet30_mgd', 'runid_17_unmet30_mgd' ,'gw_frac'),
        sort_decreasing = FALSE, 
        show_map= FALSE
      )
  )

Error message

Quitting from lines 642-743 [Create Table 2 UPDATED] (WSP_Regional_Summaries.Rmd) Error in get_columns_id(): ! invalid columns selection available range: [1, 3] issues: 4 Backtrace:

  1. global fn_tablegen(...)
  2. flextable::width(ft, j = 4, width = 1) at Mapping/Functions/fn_tablegen.R:50:5
  3. flextable:::get_columns_id(x[["body"]], j)

Render commands

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 = c("wd_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
                  )
)
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"), 
                       crs_default = 4326, 
                       map_style = "custom", 
                       bbox_type = "auto",
                       show_map = TRUE))
EllaF21 commented 7 months ago

https://github.com/davidgohel/flextable/blob/master/R/tabpart_tools.R https://rdrr.io/cran/flextable/src/R/tabpart_tools.R#sym-get_columns_id Looks like the get_columns_id function within tabpart, within flextable is causing the issues. The errors it seems to normally produce I have seen before, normally issues with columns not existing. This one is different however.

gmahadwar commented 7 months ago

see https://github.com/HARPgroup/HARParchive/pull/1243 and https://github.com/HARPgroup/HARParchive/pull/1244 for updates and https://github.com/HARPgroup/HARParchive/pull/1245 for the adding the selected columns to unmet