Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watershed Model Maps #749

Open
5 tasks
jdkleiner opened this issue Feb 6, 2023 · 0 comments
Open
5 tasks

Watershed Model Maps #749

jdkleiner opened this issue Feb 6, 2023 · 0 comments
Assignees

Comments

@jdkleiner
Copy link
Member

jdkleiner commented Feb 6, 2023

Needed a way to visually inspect hsp2 model runs. This is a quick way to generate a map of model run vs model run to visualize which model segments have been run successfully for a given model_version and runid.

Example:

  • Comparing a new hsp2 run vs. runid_11 is a good way to quickly see which hsp2 segments ran successfully (runid_11 is a good baseline because all segs were run for runid_11 in development of the 2020 State Plan)
source("https://raw.githubusercontent.com/HARPgroup/hydro-tools/master/GIS_functions/model_geoprocessor.R")
export_path <- 'C:/Users/nrf46657/Desktop/GitHub/vahydro/R/modeling/hsp2_validation/'

# specify plot title, rseg where clause, and scenario model_version, runid pairs
plotname <- "potomac"
segswhere <- "hydrocode LIKE '%wshed_P%'"
scenario_a <- c("vahydro-1.0","runid_11")
scenario_b <- c("cbp-6.0","hsp2_2022")

#---------------------------------------------------------------------------
# process geo data
polygons_a <- model_geoprocessor(scenario_a,segswhere)
polygons_b <- model_geoprocessor(scenario_b,segswhere)

# generate & save plot figure
filename <- paste0("Model_Map_",scenario_a[1],scenario_a[2],"_",scenario_b[1],scenario_b[2],"_",plotname,".png")
png(file=paste(export_path,filename,sep=""), width=1500, height=1500)
plot(polygons_a, axes = 1, main=paste0(plotname,"\n",segswhere), cex.main=2, cex.axis=2.5, border = "black")
plot(polygons_b, col = "blue", add = T)
legend("topleft", legend=c(paste0(scenario_a[1],", ",scenario_a[2], " (",length(polygons_a),")"), paste0(scenario_b[1],", ",scenario_b[2], " (",length(polygons_b),")")), fill = c("white","blue"), cex=3.5)
dev.off()

Result:
Model_Map_vahydro-1 0runid_11_cbp-6 0hsp2_2022_potomac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Data Visualization/Prototypes
Development

No branches or pull requests

2 participants