mpdougherty / razviz Goto Github PK
View Code? Open in Web Editor NEWAn R package to produce standard graphs for HEC-RAS models.
License: Creative Commons Zero v1.0 Universal
An R package to produce standard graphs for HEC-RAS models.
License: Creative Commons Zero v1.0 Universal
Rather than pull all the data - could add parameters for a start and end river mile - likely would need to filter the list coming in from unsteady flow file
Develop code to automatically decide what the min and max stage for gage box should be rather than having to iterate.
The last step of the Vignette with the code to make the plots is not in the exported vignette file, but is in the rmd file.
Jon Hendrickson asked if there is a was to display other parameters.
Create function to show which files are being pulled for observed data - right now this functionality is within the import_observed_data.R, but the function does not return a specific list of the pathnames.
#loop through each of the Formatted Unsteady Flow Files pathnames and pull the files out of dss
for(p in 1:length(plan_events)){
Formatted_UnsteadyFlowFile <- Formatted_UnsteadyFlowFileList[[p]]
event_year <- plan_events[p]
#Recreate the paths for those DSS files
Observed_Pathnames_Formatted <-c()
for(j in 1:nrow(Formatted_UnsteadyFlowFile)){ #for each row in the data frame
Formmated_Pathname <- paste0("/",Formatted_UnsteadyFlowFile[j,4],"/",
Formatted_UnsteadyFlowFile[j,5],"/",
Formatted_UnsteadyFlowFile[j,6],"/",
"/",
Formatted_UnsteadyFlowFile[j,8],"/",
Formatted_UnsteadyFlowFile[j,9],"/")
Observed_Pathnames_Formatted <- c(Observed_Pathnames_Formatted , Formmated_Pathname)
}
assign(paste("Observed_Pathnames_Formatted",Plan_Event, sep="_") ,Observed_Pathnames_Formatted)
Many users do not like the look of the smoothed levee elevation line on the longitudinal profile plot. Therefore, this should be set to an optional parameter that users can choose to display.
There must be missing data remaining in the long form of the data. Probably need to remove those before plotting.
Brian asked if we could add confidence intervals to water surface intervals (WSE).
This will keep the legends in the same order throughout the report.
function (hydrograph_df)
{
long_hydrograph <- tidyr::pivot_longer(hydrograph_df, cols = c(WS_Elev,
Obs_WS, Model_Q, Obs_Q), names_to = "Type", values_to = "value")
long_hydrograph$Type <- factor(long_hydrograph$Type,levels = c("WS_Elev","Obs_WS", "Model_Q", "Obs_Q"), labels = c("WS_Elev","Obs_WS", "Model_Q", "Obs_Q"))
return(long_hydrograph)
}
Add the ability to change the output report file name
If bridge elevations are not available/not wanted, the longitudinal profile will not plot
Error: Error: Discrete value supplied to continuous scale"
Can the longitudinal profile plot function be change to include an if statement that similar to the smoothing function for the levee profiles? This way the bridge elevations are an option input.
There are more background parameters that could be added to longitudinal profiles, particularly if the hydraulic parameter is not water surface elevation. It would be nice to be able to add ....
Would it be possible to automatically extract inputs from RAS so you don't have to build all of the input .csv files?
Changed the linetypes to dotted for observed data
Added a legend under both plots
Changed the page headings to include Gage location and removed the run type and number
function (plot_number, hydrograph_df, hg_plot_pages)
{
plot_df <- dplyr::filter(hg_plot_pages, plot == plot_number)
plot <- plot_df$plot
run_type <- as.character(plot_df$Run_type)
run_num <- as.numeric(as.character(plot_df$Run_num))
river_sta <- as.numeric(as.character(plot_df$River_Sta))
hg_df_plot <- dplyr::filter(hydrograph_df, River_Sta == river_sta, Run_type == run_type, Run_num == run_num)
ws <- dplyr::filter(hg_df_plot, Type == "Obs_WS" | Type == "WS_Elev")
q <- dplyr::filter(hg_df_plot, Type == "Obs_Q" | Type == "Model_Q")
WS_cols <- c(WS_Elev = "darkslategray4", Obs_WS = "coral3")
WS_line <- c(WS_Elev = "solid", Obs_WS = "dashed")
Discharge_cols <- c(Model_Q = "darkslategray4", Obs_Q = "coral3")
Discharge_line <- c(Model_Q = "solid", Obs_Q = "dashed")
WS_labels <- c(WS_Elev = "Modeled", Obs_WS = "Observed")
Discharge_labels <- c(Model_Q = "Modeled", Obs_Q = "Observed")
ws_plot <- ggplot(data = ws, aes(x = date, y = value, color = Type), na.rm = TRUE) +
geom_line(aes(linetype=Type) ,size = 1) +
facet_grid(. ~ Event, scales = "free") +
theme_bw() +
scale_color_manual(values = WS_cols, labels = WS_labels) +
scale_linetype_manual(values = WS_line, labels = WS_labels ) +
theme(legend.position = "bottom",
legend.title = element_blank(), axis.title.x = element_blank(), axis.text.x = element_text(angle = 50, hjust = 1)) +
scale_x_datetime(date_labels = "%e %b", date_breaks = "7 days", date_minor_breaks = "1 day") + labs(y = "Elevation (NAVD88 feet)")
q_plot <- ggplot(data = q, aes(x = date, y = value/1000,
color = Type), na.rm = TRUE) +
geom_line(aes(linetype=Type) ,size = 1) +
facet_grid(. ~ Event, scales = "free") +
theme_bw() +
scale_color_manual(values = Discharge_cols, labels = Discharge_labels) +
scale_linetype_manual(values = Discharge_line, labels = Discharge_labels) +
theme(legend.position = "bottom",
legend.title = element_blank(),
axis.title.x = element_blank(), axis.text.x = element_text(angle = 50,hjust = 1)) +
scale_x_datetime(date_labels = "%e %b", date_breaks = "7 days", date_minor_breaks = "1 day") + labs(y = "Discharge (1000 cubic feet per second)")
#removed from title - ws$Run_type,"#", ws$Run_num,
title <-textGrob(label = paste(trimws(ws$River), "River,",
trimws(ws$Reach), "Reach, River Mile ",
ws$River_Sta, "\n",
"Gage", ws$Gage, sep = " "),
x = unit(0, "lines"), y = unit(0,"lines"), hjust = 0, vjust = 0, gp = gpar(fontsize = 12))
hg_plot <- grid.arrange(ws_plot, q_plot, nrow = 2, ncol = 1,
widths = unit(7, "in"), heights = unit(c(5, 5), "in"),
top = title, clip = FALSE)
return(hg_plot)
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.