Skip to content

Commit

Permalink
Fixed vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
cvitolo committed Mar 2, 2017
1 parent c6b08da commit e5cd8a4
Show file tree
Hide file tree
Showing 19 changed files with 104 additions and 100 deletions.
1 change: 1 addition & 0 deletions R/MOPEX.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ tsMOPEX <- function(stationID, plotOption = FALSE, timeExtent = NULL){
# 6: daily minimum air temperature (Celsius)

myTS <- zoo::zoo(x[,2:6], order.by = as.Date(x$date))
myTS$Q[myTS$Q == -99] <- NA

if (!is.null(timeExtent)){

Expand Down
Binary file added vignettes/TRMM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed vignettes/figure/unnamed-chunk-14-1.png
Binary file not shown.
Binary file removed vignettes/figure/unnamed-chunk-18-1.png
Binary file not shown.
Binary file removed vignettes/figure/unnamed-chunk-18-2.png
Binary file not shown.
Binary file removed vignettes/figure/unnamed-chunk-19-1.png
Binary file not shown.
Binary file removed vignettes/figure/unnamed-chunk-22-1.png
Binary file not shown.
Binary file removed vignettes/figure/unnamed-chunk-24-1.png
Binary file not shown.
100 changes: 50 additions & 50 deletions vignettes/hddtools_vignette.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## ----echo=FALSE----------------------------------------------------------
## ----init, echo=FALSE----------------------------------------------------
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
Expand All @@ -8,22 +8,22 @@ knitr::opts_chunk$set(
eval = FALSE
)

## ------------------------------------------------------------------------
## ----dependencies--------------------------------------------------------
# packs <- c("zoo", "sp", "RCurl", "XML", "rnrfa", "Hmisc", "raster",
# "stringr", "devtools", "leaflet")
# new_packages <- packs[!(packs %in% installed.packages()[,"Package"])]
# if(length(new_packages)) install.packages(new_packages)

## ------------------------------------------------------------------------
## ----installation1-------------------------------------------------------
# install.packages("hddtools")

## ------------------------------------------------------------------------
## ----installation2-------------------------------------------------------
# devtools::install_github("ropensci/hddtools")

## ---- eval = TRUE--------------------------------------------------------
## ----loading, eval = TRUE------------------------------------------------
library("hddtools")

## ---- eval = TRUE--------------------------------------------------------
## ----KGClimateClass, eval = TRUE-----------------------------------------
# Define a bounding box
areaBox <- raster::extent(-10, 5, 48, 62)

Expand All @@ -33,32 +33,32 @@ KGClimateClass(areaBox = areaBox, updatedBy = "Peel")
# Extract climate zones from Kottek's map:
KGClimateClass(areaBox = areaBox, updatedBy = "Kottek")

## ---- eval = FALSE-------------------------------------------------------
## ----catalogueGRDC1, eval = FALSE----------------------------------------
# # GRDC full catalogue
# GRDC_catalogue_all <- catalogueGRDC()

## ------------------------------------------------------------------------
## ----catalogueGRDC2------------------------------------------------------
# # Filter GRDC catalogue based on a country code
# GRDC_catalogue_countrycode <- catalogueGRDC(columnName = "country_code",
# columnValue = "IT")

## ------------------------------------------------------------------------
## ----catalogueGRDC3------------------------------------------------------
# # Filter GRDC catalogue based on rivername
# GRDC_catalogue_river <- catalogueGRDC(columnName = "river", columnValue = "PO")

## ------------------------------------------------------------------------
## ----catalogueGRDC4------------------------------------------------------
# # Filter GRDC catalogue based on numerical value, for instance select all the stations for which daily data is available since 2000
# GRDC_catalogue_dstart <- catalogueGRDC(columnName = "d_start",
# columnValue = ">=2000")

## ------------------------------------------------------------------------
## ----catalogueGRDC5------------------------------------------------------
# # Define a bounding box
# areaBox <- raster::extent(-10, 5, 48, 62)
#
# # Filter GRDC catalogue based on a bounding box
# GRDC_catalogue_bbox <- catalogueGRDC(areaBox = areaBox)

## ------------------------------------------------------------------------
## ----catalogueGRDC6------------------------------------------------------
# # Define a bounding box
# areaBox <- raster::extent(-10, 5, 48, 62)
#
Expand All @@ -67,19 +67,19 @@ KGClimateClass(areaBox = areaBox, updatedBy = "Kottek")
# columnName = "statistics",
# columnValue = 1)

## ------------------------------------------------------------------------
## ----catalogueGRDC7------------------------------------------------------
# # Visualise outlets on an interactive map
# library(leaflet)
# leaflet(data = GRDC_catalogue_bbox_stats) %>%
# addTiles() %>% # Add default OpenStreetMap map tiles
# addMarkers(~long, ~lat, popup = ~station)

## ---- eval = TRUE--------------------------------------------------------
# Monthly data extraction
WolfeToneBridge <- tsGRDC(stationID = catalogueGRDC()$grdc_no[7126],
plotOption = TRUE)
## ----tsGRDC--------------------------------------------------------------
# # Monthly data extraction
# WolfeToneBridge <- tsGRDC(stationID = catalogueGRDC()$grdc_no[7126],
# plotOption = TRUE)

## ---- eval = FALSE-------------------------------------------------------
## ----TRMM----------------------------------------------------------------
# # Define a bounding box
# areaBox <- raster::extent(-10, 5, 48, 62)
#
Expand All @@ -92,57 +92,57 @@ WolfeToneBridge <- tsGRDC(stationID = catalogueGRDC()$grdc_no[7126],
# library(raster)
# plot(TRMMfile)

## ---- eval = TRUE--------------------------------------------------------
## ----catalogueData60UK1, eval = TRUE-------------------------------------
# Data60UK full catalogue
Data60UK_catalogue_all <- catalogueData60UK()

# Filter Data60UK catalogue based on bounding box
areaBox <- raster::extent(-4, -3, 51, 53)
Data60UK_catalogue_bbox <- catalogueData60UK(areaBox = areaBox)

## ------------------------------------------------------------------------
## ----catalogueData60UK2--------------------------------------------------
# # Visualise outlets on an interactive map
# library(leaflet)
# leaflet(data = Data60UK_catalogue_bbox) %>%
# addTiles() %>% # Add default OpenStreetMap map tiles
# addMarkers(~Longitude, ~Latitude, popup = ~Location)

## ---- eval = TRUE--------------------------------------------------------
# Extract time series
stationID <- catalogueData60UK()$stationID[1]

# Extract only the time series
MorwickTS <- tsData60UK(stationID, plotOption = FALSE)
plot(MorwickTS)

# Extract time series for a specified temporal window
twindow <- seq(as.Date("1988-01-01"), as.Date("1989-12-31"), by = "days")
MorwickTSplot <- tsData60UK(stationID = stationID,
plotOption = TRUE,
twindow = twindow)

## ---- eval = TRUE--------------------------------------------------------
# MOPEX full catalogue
MOPEX_catalogue_all <- catalogueMOPEX()

# Extract time series
BroadRiver <- tsMOPEX(stationID = MOPEX_catalogue_all$stationID[1],
plotOption = TRUE)
## ----catalogueData60UK3--------------------------------------------------
# # Extract time series
# stationID <- catalogueData60UK()$stationID[1]
#
# # Extract only the time series
# MorwickTS <- tsData60UK(stationID, plotOption = FALSE)
# plot(MorwickTS)
#
# # Extract time series for a specified temporal window
# twindow <- seq(as.Date("1988-01-01"), as.Date("1989-12-31"), by = "days")
# MorwickTSplot <- tsData60UK(stationID = stationID,
# plotOption = TRUE,
# twindow = twindow)

## ----MOPEX---------------------------------------------------------------
# # MOPEX full catalogue
# MOPEX_catalogue_all <- catalogueMOPEX()
#
# # Extract time series
# BroadRiver <- tsMOPEX(stationID = MOPEX_catalogue_all$stationID[1],
# plotOption = TRUE)

## ---- eval = FALSE-------------------------------------------------------
## ----SEPA1, eval = FALSE-------------------------------------------------
# # SEPA unofficial catalogue
# SEPA_catalogue_all <- catalogueSEPA()

## ------------------------------------------------------------------------
## ----SEPA2, eval = FALSE-------------------------------------------------
# # Single time series extraction
# Kilphedir <- tsSEPA(stationID = catalogueSEPA()$stationId[1],
# plotOption = TRUE)

## ---- eval = TRUE--------------------------------------------------------
# Multiple time series extraction
y <- tsSEPA(stationID = c("234253", "234174", "234305"))
plot(y[[1]], ylim = c(0, max(y[[1]], y[[2]], y[[3]])),
xlab = "", ylab = "Water level [m]")
lines(y[[2]], col = "red")
lines(y[[3]], col = "blue")
## ----SEPA3---------------------------------------------------------------
# # Multiple time series extraction
# y <- tsSEPA(stationID = c("234253", "234174", "234305"))
# plot(y[[1]], ylim = c(0, max(y[[1]], y[[2]], y[[3]])),
# xlab = "", ylab = "Water level [m]")
# lines(y[[2]], col = "red")
# lines(y[[3]], col = "blue")

Loading

0 comments on commit e5cd8a4

Please sign in to comment.