knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  warning = FALSE
)

Setup

Load HYPEtools package and import HYPE model files.

# Load HYPEtools Package
library(HYPEtools)

# Get Path to HYPEtools Model Example Files
model_path <- system.file("demo_model", package = "HYPEtools")

# Import HYPE Model Files
gd <- ReadGeoData(file.path(model_path, "GeoData.txt"))
gcl <- ReadGeoClass(file.path(model_path, "GeoClass.txt"))
bas <- ReadBasinOutput(file.path(model_path, "results/0003587.txt"))

Import Checks

# List HYPE Variable Names in Basin Ouptut File
names(bas)

# List subbasin SUBIDs in Basin Output File
subid(bas)

# Summarize Basin Output File Structure
str(bas)

Plot Time Series with PlotBasinOutput()

# Plot to screen
# PlotBasinOutput(bas, gd = gd, driver = "screen")

# Select variables
# PlotBasinOutput(bas, gd = gd, driver = "screen", hype.vars = c("cout", "rout"))

# Plot time series in R with a log scale for the flow (log.q = TRUE)
# PlotBasinOutput(bas, gd = gd, driver = "screen", log.q = TRUE, start.mon = 10, name = paste0("Subid ", attr(bas, "subid")))

Plot Summary Plots with PlotBasinSummary()

The PlotBasinSummary() function is useful mostly with water quality variables.

# PlotBasinSummary(bas, gd = gd, gcl = gcl, driver = "screen")

Compute Annual Regime for all variables with AnnualRegime()

AnnualRegime(bas, ts.in = attr(bas, "timestep"), ts.out = "month", start.mon = 10)

Plot Annual Flow Regime with PlotAnnualRegime()

regime <- AnnualRegime(bas[, c("DATE", "COUT", "ROUT")], ts.in = timestep(bas), ts.out = "month", start.mon = 10)

PlotAnnualRegime(regime, band = "p25p75", add.legend = TRUE, col = c(4, 2))


rcapell/RHYPE documentation built on Feb. 28, 2024, 3:11 p.m.