This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install/load dependent libraries | |
if(!require(zoo)) install.packages("zoo") | |
library(zoo) | |
if(!require(tgp)) install.packages("tgp") | |
library(tgp) | |
if(!require(qualV)) install.packages("qualV") | |
library(qualV) | |
if(!require(hydromad)) install.packages("hydromad",repos="http://hydromad.catchment.org") | |
library(hydromad) | |
if(!require(devtools)) install.packages("devtools") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!require(RHydro)) install.packages("RHydro",repos="http://R-Forge.R-project.org") | |
if(!require(fuse)) install.packages("fuse", repos="http://R-Forge.R-project.org") | |
library(RHydro) | |
library(fuse) | |
data(DATA) | |
data(modlist) | |
# Set parameter space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Generate map of gauging stations. | |
#' | |
#' @author Claudia Vitolo <cvitolodev@gmail.com> | |
#' | |
#' @description This function takes as input a table of UK NRFA stations (output of getStationSummary() function) and generates a map using leaflet javascript library. | |
#' | |
#' @param selectedStationSummary This is the data.frame containing at least a column called "gridReference" (in which OS Grid references are stored) with 1 row for each station. Alternatively the table could contain 2 columns called "Latitude" and "Longitude" containing the coordinates of stations in WGS84, with 1 row for each station. | |
#' | |
#' @return displays a map | |
#' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load library | |
library(xts) | |
# Generate dummy time series | |
from <- as.Date("1950-01-01") | |
to <- as.Date("1990-12-31") | |
myDates <- seq.Date(from=from,to=to,by="day") | |
myTS <- as.xts(runif(length(myDates)),order.by=myDates) | |
# SPLIT THE TIME SERIES INTO CALENDAR YEARS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' This function returns information on model structure components and parameters used, given FUSE model. | |
#' | |
#' @param mid FUSE model structure ID number (integer from 1 to 1248). | |
#' @number default is TRUE (returns the model options numbers, if FALSE it returns model options names) | |
#' | |
#' @examples | |
#' # FUSEinfo(mid=60) | |
#' | |
FUSEinfo <- function(mid, number=TRUE) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' This function generates parameter sets for FUSE (Clark et al., 2008). | |
#' | |
#' @param NumberOfRuns number of samples to generate, can be any integer | |
#' @param SamplingType sampling procedure to use, can be "URS" or "LHS" | |
#' @param rferr_add range of the additive rainfall error (mm), default is c(0,0) | |
#' @param rferr_mlt range of the multiplicative rainfall error (-), default is c(1,1) | |
#' @param maxwatr_1 range of the depth of the upper soil layer (mm), default is c(25,500) | |
#' @param maxwatr_2 range of the depth of the lower soil layer (mm), default is c(50,5000) | |
#' @param fracten range of the fraction total storage in tension storage (-), default is c(0.05,0.95) | |
#' @param frchzne range of the fraction tension storage in recharge zone (-), default is c(0.05,0.95) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "RNRFA: an R package to interact with the UK National River Flow Archive" | |
author: "Claudia Vitolo" | |
date: "18 November 2015" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(cache=TRUE) | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load the package and prepare the list of models | |
library(hydromad) | |
library(RHydro) | |
data(modlist) | |
# read data in | |
temp <- read.csv("dummyData.csv") | |
# Convert to date | |
temp[,1] <- as.Date(temp[,1],format="%Y-%m-%d") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!require(RHydro)) install.packages("RHydro",repos="http://R-Forge.R-project.org") | |
library(RHydro) | |
temp <- read.csv("dummyData.csv") | |
DATA <- zooreg(temp[,2:4], order.by=temp[,1]) | |
myDELTIM <- 1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!require(RHydro)) install.packages("RHydro",repos="http://R-Forge.R-project.org") | |
library(RHydro) | |
temp <- read.csv("dummyData.csv") | |
DATA <- zooreg(temp[,2:4], order.by=temp[,1]) | |
myDELTIM <- 1 | |
myMID <- 60 | |
# Sample parameter space using the Latin Hypercube Sampling method |
OlderNewer