hruGroupWaterSummary: Summarize daily CRHM water outputs by HRU group

View source: R/hruGroupWaterSummary.R

hruGroupWaterSummaryR Documentation

Summarize daily CRHM water outputs by HRU group

Description

Calculates daily totals of water storages and fluxes for groups of HRUs, for models without sub-basins.

Usage

hruGroupWaterSummary(
  dailyWater,
  vars = "all",
  prjFile,
  HRUgroups,
  basinMean,
  quiet = TRUE,
  logfile = ""
)

Arguments

dailyWater

Required. The output from the simpleDailyWater command.

vars

Optional. Variable column numbers to be used (not including the datetime). The default value all selects all columns.

prjFile

Required. The CRHM model .prj file.

HRUgroups

Required. This can be either a vector or list. If a vector, it contains strings used to group the selected HRU names in the .prj file. If a list, it contains vectors of the HRU numbers to be grouped. See the examples for both usages.

basinMean

Required. This refers to how the daily water values were calculated by simpleDailyWater. If TRUE then the aggregated water depths/volumes are computed over the whole basin. If FALSE then the the aggregated water depths/volumes are computed over area of the HRU groups.

quiet

Optional. Suppresses display of messages, except for errors. The default is TRUE. If you are calling this function in an R script, you will usually leave quiet=TRUE (i.e. the default). If you are working interactively, you will p#' robably want to set quiet = FALSE.

logfile

Optional. Name of the file to be used for logging the action. Normally not used.

Value

If successful returns a data frame containing each variable summarized by each HRU group. The names of the variables are in the form: hruGroup.variable.group_total or hruGroup.variable.basin_total. If unsuccessful, returns an error.

Examples

## Not run: 
# First, calculate daily water values. In these examples, the water is
# in mm per HRU

#' b <- readOutputFile('Bologna1984_30y_output.txt', timezone='MST')
# get daily values without aggregation; values calculated w.r.t the HRU area
dailyHRU <- simpleDailyWater(b, prjFile = "Bologna1984_02.prj", basinMean = FALSE)

# summarize by groups of HRUs with similar names
daily_group <- hruGroupSummary(daily,
  prjFile = "Bologna1984_02.prj",
  HRUgroups = c("firn", "ice", "bl"), basinMean = FALSE
)

# summarize by named groups of HRUs with specified numbers
groups <- list(group1 = c(1, 2, 3), group2 = c(4, 5, 6))
daily_group <- hruGroupSummary(daily,
  prjFile = "Bologna1984_02.prj",
  HRUgroups = groups, basinMean = FALSE
)

## End(Not run)

CentreForHydrology/CRHMr documentation built on April 6, 2024, 5:27 p.m.