Giter Club home page Giter Club logo

razviz's People

Contributors

laallison avatar mpdougherty avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

razviz's Issues

Additional Parameters on Longitudinal Profile Plot

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 ....

  • specific historical floods with a label of the data and return period of the event (this likely could be incorporated into the highwater mark)
  • river features that cover multiple river miles (a lake for example)
  • spillway connections

Longitudinal Profile Vignette

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.

Hydrograph Plot Formatting

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)
}

Add factor levels to Lengthen Hydro graph Function

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)
}

Bridge Elevations

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.

Gage Boxes

Develop code to automatically decide what the min and max stage for gage box should be rather than having to iterate.

Observed Paths

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.