HARPgroup / HARParchive

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

Watershed Cumulative Impacts (river mile) #18

Open rburghol opened 4 years ago

rburghol commented 4 years ago

Overview

Info to display

Interface Examples

Original concept

example

Second Concept

image

4/14/2021

image

Resources

Getting Fanciful

Maybe this can be the killer, multi-pane linked Rshiny app, which has the graph shown above accompanied by a map, with rollovers and clicks all linked?

rburghol commented 4 years ago

Just assigned everyone to this issue. I realize that we are wrapping up elfgen stuff right now, but I wanted to have everyone cc'ed on this issue when Dr. Scott (or whoever else has ideas) starts to a outline the functionality of this widget.

alexwlowe commented 3 years ago

image

The code is now more functionalized, and I was able to run it on a Roanoke segment!

alexwlowe commented 3 years ago

image image

The same graph but with different metrics from VaHydro (the values are different I promise)

alexwlowe commented 3 years ago

image

An example of the line/bar graph combo with the Roanoke segment!

jdkleiner commented 3 years ago

Cumulative Impact Plot (3/4/21)

Example Code Using R Base Plotting Functions

par(mar = c(5, 5, 8, 5)) #ADJUST PLOTTING MARGINS TO ACCOMMODATE RSEG NAMES
plot(cia_data$seglist, cia_data$Qout_1, type = "l", col = "green", xlab = "", ylab = "", las=1,cex.axis=0.8,ylim=c(y_prim[1],y_prim[2])) #CREATE FIRST PLOT (ON PRIMARY Y-AXIS)
  lines(cia_data$seglist, cia_data$Qout_2, type = "l", col = "blue")  #ADD ADDITIONAL PLOTTING DATAPOINTS
  abline(v=1:length(cia_data$propname), col="azure2") #ADD VERTICAL GRID LINES FOR EACH RSEG
  text(x = cia_data$seglist,y = y_prim[2]+(0.06*y_prim[2]),labels=cia_data$propname,xpd = NA, srt = 45, offset = -0.2, pos = 4,cex=0.7) #ADD RSEG NAMES ABOVE PLOT
par(new = TRUE) #ADD SECOND PLOT (ON SECONDARY Y-AXIS)                                                
plot(cia_data$seglist, cia_data$Qout_pc, type = "h", col = "red",axes = FALSE, xlab = "Segment List (1 = headwater)", ylab = "Flow (cfs)",ylim=c(-15,15)) #NOTE: SWITCH BETWEEN type = "h" (FOR ‘histogram’ LIKE VERTICAL LINES) and "l" (FOR LINES)
  axis(side = 4, las=1,cex.axis=0.8) # ADD SECOND AXIS
  mtext("Percent Difference in Flow between runids", side = 4, line = 3) #ADD SECOND AXIS LABEL     
  abline(h=0, col="grey", lty=2) #ADD HORIZONTAL DOTTED LINE AT Y=0
  legend("topleft", c("Qout_1", "Qout_2", "Qout_pc"),col = c("green", "blue", "red"), lty = c(1,1,1), bg='white') #ADD LEGEND

Example using above code (% as a line):

plot_example_1

Example using above code (% as histogram-like vertical lines):

plot_example_2

rburghol commented 3 years ago

Potential Tables that we will see:

Watershed Overview      
    VWP Current Proposed VWP WSP 2040      
James River @ Richmond VA WD cumulative 292 293 263 Full Permitted +30 MGD over 2040 demand in watershed
  90-day LF        
  30-day LF        
  7Q10        
  Mean Daily        
               
Intake Overview      
Impacts to other Users, unmet demands, conservation needed and/or supplemental sources              
Henrico Mean WD 45.1 45.1 47.6 Will be impacted if a withdrawal decreases flow at Cartersville Gage -- so, must be upstream of Cartersville
Richmond Mean WD       <0.1 change in unmet. Impacted by anyone above Richmond gage, except Henrico
JRCC Mean WD 2 2.1 0.75 Max year of 800 from 730, so increase of 0.1 MGD; Demand is increased to sell water to Goochland, and Powhatan
               
Aquatic Bio      
James River @ Richmond VA Mean % CU 2.30% 2.30%   This reflects the best impact estimate based on Flow:Ecology (elfgen, ecoflows)
  Max 30-day CU ~15% ~15%   This reflects the Cumulative version of Flow:Habitat (what we've always looked at)
SELoomis commented 3 years ago

The most up-to-date files relevant to this issue are in the folder HARPArchive -> HARP 2020-2021 -> Cumulative Impact River Mile

Under shiny app development folder:

rburghol commented 3 years ago

Just tested the shiny app with a James river project I am working on. Great stuff! image

image

alexwlowe commented 3 years ago

We did a lot of cleaning up and functionalizing today.

The code is currently distributed into two functions. We couldn't figure out a quick way to separate into more than that because of the way the graphing is done. We can spend more time discussing and brainstorming ways to separate next week though.

CIA_data Function: Grabs data from vahydro and returns data frame data frame contains flow and percent change data for 2 runids of all upstream and downstream river segments. The data frame it spits out can be narrowed down more in the future once we figure out what we want.

fn_plot_cia_dend Function: Takes CIA_data out put and returns plots. We did not figure out a way to separate this into multiple functions because of the way the graphing is done. However, we were able to clean up the loop by migrate percent change calculations to CIA_data and removing unnecessary lines.