HARPgroup / HARParchive

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

2023 Kickoff Tasks for Returning Analysts #819

Open glenncampagna opened 1 year ago

glenncampagna commented 1 year ago

Copied from #817

Megan and Glenn:

glenncampagna commented 1 year ago

Identifying segments with completed model runs

glenncampagna commented 1 year ago

Map continuously tracking model runs:

https://deq1.bse.vt.edu/cgi-bin/mapserv?map=/var/www/html/mapserv/vahydro_result.map&propname=Qout&model_version=cbp-6.0&runid=hsp2_2022&layers=model_run_status&bundle=watershed&ftype=cbp60&layers=minor_basins&div1=10&div2=100&div3=500&div4=1000

glenncampagna commented 1 year ago

Customizable variables

megpritch commented 1 year ago

Best Practices for RMD's & R Programming

When programming, the goal is to be robust, reproducible, and efficient.

Making Robust Code

Example:

if (exists("json_obj_url")) {
  rseg_obj_url.r <- paste(json_obj_url, rseg.model.r$pid, sep="/")
  rseg_model_info.r <- ds$auth_read(rseg_obj_url.r, "text/json", "")
  rseg_model_info.r <- fromJSON(rseg_model_info.r)
  } else {
  message("Error: json_obj_url is undefined.  Can not retrieve model and scenario information. (Hint: Use config.R
          to set json_obj_url) ")
  rseg_model_info.r <- list()
  }

Making Reproducible Code

glenncampagna commented 1 year ago

Matching completed segments to basins/guages of interest - for use in Rmd

Megan ran this segment using this render command:

rmarkdown::render('C:/aa_HARP/aa_GitHub/HARParchive/HARP-2022-Summer/AutomatedScripts/ws_model_summary.Rmd',
                  output_file = 'C:/aa_HARP/RappahannockMarkdown',
                  params = list(doc_title = "Test HSP2 Model Summary",
                                rseg.file.path = c("/media/model/p6/out/river/hsp2_2022/hydr/RU4_5640_6030_hydrd_wy.csv", "/media/model/p6/out/river/subsheds/hydr/RU4_5640_6030_hydrd_wy.csv"),
                                rseg.hydrocode = c("RU4_5640_6030","vahydrosw_wshed_RU4_5640_6030"),
                                rseg.ftype = c("cbp60","vahydro"),
                                rseg.model.version = c("cbp-6.0","cbp-6.1"),
                                runid.list = c("hsp2_2022","subsheds"),
                                rseg.metric.list = c("Qout","l90_Qout","l30_Qout","l07_Qout","l01_Qout","consumptive_use_frac","wd_cumulative_mgd","ps_cumulative_mgd","wd_mgd","ps_mgd")
                  )
)

The output can be downloaded to view here.