AmaxData: Extract annual or daily hydrometric data from HYDAT

Description Usage Arguments See Also Examples

View source: R/AmaxData.R

Description

Return a dataset of hydrometric data from a local HYDAT database. Optionally, a target or vector of distances can be passed to extract only the pooling group from a list of stations. If a distance is passed, the target has a distance of zero. If a target is passed, the similarity measure based on the seasonality of the annual maxima are used as the distance.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
AmaxData(db, sites, target = NULL, distance = NULL, size = 25)

DailyData(
  db,
  sites,
  pad = FALSE,
  tol = 346,
  target = NULL,
  distance = NULL,
  size = 25
)

Arguments

db

Path of the HYDAT database.

sites

List of stations from which to extract the data.

target

Target site.

distance

A vector of distance between all sites. The target has distance equal to zero.

size

Size of the pooling group.

pad, tol

Logical and number of days. Should the daily data be padded. See PadPot.

See Also

DailyPeaksData, SeasonDistance.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
## Not run: 
## The variable DB_HYDAT contains the path to the HYDAT database.
DB_HYDAT <- '.../Hydat.sqlite3'

## Meta-information about stations
gaugedSites <- read.csv('.../gauged_sites.csv')

## Reading AMAX data for one station.
x <- AmaxData(DB_HYDAT, c('01AD002'))
head(x, 3)

## Reading multiple stations.
x <- AmaxData(DB_HYDAT, c('01AD002', '01AF009'))
x[seq(85,95),]

## Reading Daily data.
x <- DailyData(DB_HYDAT, c('01AD002','01AF009'))
head(x, 3)

## A pooling group of size 5 based on seasonality distance.
x <- AmaxData(DB_HYDAT, gaugedSites$station, target = '01AF009', size = 5)

## Extracted site.
sort(unique(x$site))

## Pooling group with different a distance.
meta <- log(gaugedSites[, c('area','map')])
h <- as.matrix(dist(scale(meta)))
x <- AmaxData(DB_HYDAT, gaugedSites$station, distance = h[2,], size = 5)

## Extracted site.
sort(unique(x$site))


## End(Not run)

floodnetProject16/floodnetRfa documentation built on Oct. 24, 2020, 9:19 a.m.