Skip to content

Commit

Permalink
Merge pull request #16 from jfisher-usgs/master
Browse files Browse the repository at this point in the history
Merge with upstream
  • Loading branch information
jfisher-usgs authored Apr 10, 2018
2 parents 22e764e + 58eb367 commit 65798d7
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 77 deletions.
9 changes: 6 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Package: wrv
Title: Wood River Valley Groundwater-Flow Model
Version: 1.1.3.9000
Authors@R: person(given=c("Jason", "C."), family="Fisher", role=c("aut", "cre"), email="jfisher@usgs.gov")
Version: 1.1.4
Authors@R: c(
person(given=c("Jason", "C."), family="Fisher", role=c("aut", "cre"), email="jfisher@usgs.gov", comment=c(ORCID="0000-0001-9032-8912")),
person(given=c("Allan", "H."), family="Wylie", role="ctb", email="Allan.Wylie@idwr.idaho.gov"),
person(given="Jennifer", family="Sukow", role="ctb", email="Jennifer.Sukow@idwr.idaho.gov"))
Description: A processing program for the groundwater-flow model of the Wood
River Valley aquifer system, south-central Idaho. Included in the package is
MODFLOW-USG version 1.3, a U.S. Geological Survey groundwater-flow model.
Expand All @@ -24,7 +27,7 @@ Suggests:
rgdal,
rgeos,
sfsmisc,
viridis,
viridisLite,
xtable
SystemRequirements: PEST (>= 13.0, optional)
License: CC0
Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# prepare the package for release
# Prepare package for release
#
# Note that 'AppendixC' and 'AppendixD' are built separately using R commands:
# setwd("*")
# knitr::knit2pdf("sir20165080_Appendix*.Rnw")
# tools::compactPDF(paths="sir20165080_Appendix*.pdf", gs_quality="ebook")
# knitr::purl("sir20165080_Appendix*.Rnw")
#

PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGSRC := $(shell basename `pwd`)
APPXC := sir20165080_AppendixC

all: docs install check clean
all: docs rd2tex install check clean

docs:
R -q -e 'devtools::document()';\
Expand All @@ -30,7 +37,7 @@ rd2tex:
$(RM) $(PKGSRC).pdf;\
$(RM) -r .Rd2pdf*;\

vignettes: rd2tex
vignettes:
R -q -e 'devtools::build_vignettes()';\
R -q -e 'tools::compactPDF(paths='\''inst/doc'\'', gs_quality='\''ebook'\'')';\

Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# wrv 1.1.3.9000
# wrv 1.1.4

- Substitute the recommended **viridis** package for its 'lite' version **viridisLite**.

- In `GetSeasonalMult`, enable extrapolation of time series data.

Expand Down
16 changes: 2 additions & 14 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
.onAttach <- function(lib, pkg) {
if (interactive()) {
ver <- read.dcf(file.path(lib, pkg, "DESCRIPTION"), "Version")
packageStartupMessage(pkg, ": version: ", ver)
if (ver < 1 || grepl("\\.9[0-9]{3}$", ver)) {
s <- paste("This information is preliminary or provisional and is subject to revision.",
"It is being provided to meet the need for timely best science.",
"The information has not received final approval by the U.S. Geological Survey (USGS) and",
"is provided on the condition that neither the USGS nor the U.S. Government shall be",
"held liable for any damages resulting from the authorized or unauthorized use of the information.",
"Although this software program has been used by the USGS, no warranty, expressed or implied,",
"is made by the USGS or the U.S. Government as to the accuracy and functioning of the program and",
"related program material nor shall the fact of distribution constitute any such warranty,",
"and no responsibility is assumed by the USGS in connection therewith.")
packageStartupMessage(paste(strwrap(s, indent=1), collapse="\n "))
}
msg <- "USGS Research Package: https://owi.usgs.gov/R/packages.html#research"
packageStartupMessage(paste(strwrap(msg), collapse="\n"))
}

raster::rasterOptions(standardnames=FALSE)
invisible()
}
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# wrv

[![Travis-CI Build Status](https://travis-ci.org/USGS-R/wrv.svg?branch=master)](https://travis-ci.org/USGS-R/wrv)
[![CC0](https://img.shields.io/badge/license-CC0--1.0-brightgreen.svg)](https://creativecommons.org/publicdomain/zero/1.0/)
[![USGS Category](https://img.shields.io/badge/USGS-Research-blue.svg)](https://owi.usgs.gov/R/packages.html#research)

## Overview
Expand All @@ -28,7 +27,7 @@ install.packages("wrv", repos = repos, dependencies = TRUE)
Or use **devtools** to install the development version from GitHub.

```r
devtools::install_github("USGS-R/wrv")
devtools::install_github("USGS-R/wrv", dependencies = TRUE)
```

## Run
Expand All @@ -47,19 +46,20 @@ help(package = "wrv")

See [training material](https://jfisher-usgs.github.io/wrv-training/) for example applications using the **wrv** package.

## Bugs
## Contact

Please consider reporting bugs and asking questions on the [Issues page](https://github.com/USGS-R/wrv/issues).

## Disclaimer

This software is in the public domain because it contains materials that originally came from the USGS,
an agency of the United States Department of Interior.
For more information, see the
[official USGS copyright policy](https://www2.usgs.gov/visual-id/credit_usgs.html "official USGS copyright policy").
This information is preliminary or provisional and is subject to revision.
It is being provided to meet the need for timely best science.
The information has not received final approval by the U.S. Geological Survey (USGS)
and is provided on the condition that neither the USGS nor the U.S. Government
shall be held liable for any damages resulting from the authorized or unauthorized use of the information.

Although this software program has been used by the USGS, no warranty, expressed or implied,
is made by the USGS or the U.S. Government as to the accuracy and functioning of the program and related program material nor shall the fact of distribution constitute any such warranty,
Although this software program has been used by the U.S. Geological Survey (USGS),
no warranty, expressed or implied, is made by the USGS or the U.S. Government
as to the accuracy and functioning of the program and related program material
nor shall the fact of distribution constitute any such warranty,
and no responsibility is assumed by the USGS in connection therewith.

This software is provided "AS IS."
5 changes: 1 addition & 4 deletions inst/doc/sir20165080.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@

\begin{document}

\title{U.S. Geological Survey \protect\\ Scientific Investigations Report 2016-5080\vspace{2ex}}
\title{U.S. Geological Survey \protect\\ Scientific Investigations Report 2016-5080}
\author{}
\date{}
\pretitle{\begin{flushleft}\LARGE\bfseries\sffamily}
\posttitle{\end{flushleft}}
\maketitle

% =========================================================================
Expand Down
5 changes: 1 addition & 4 deletions inst/doc/sir20165080_AppendixA.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ t0 <- Sys.time()
try(knitr::opts_chunk$set(tidy=FALSE, comment="#", fig.align="center"), silent=TRUE)
@

\title{Appendix A.\enspace An Introduction to the R-Package `wrv'\vspace{2ex}}
\title{Appendix A.\enspace An Introduction to the R-Package `wrv'}
\author{}
\date{}
\pretitle{\begin{flushleft}\LARGE\bfseries\sffamily}
\posttitle{\end{flushleft}}
\maketitle

\tableofcontents
Expand Down
2 changes: 1 addition & 1 deletion inst/doc/sir20165080_AppendixC.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ for (i in files) unzip(i, exdir = dirname(i))
## ----download_ned, message=FALSE-----------------------------------------
ftp <- "ftp://rockyftp.cr.usgs.gov/vdelivery/Datasets/Staged/NED/13/ArcGrid/n44w115.zip"
file <- file.path(tempdir(), basename(ftp))
download.file(ftp, file)
download.file(ftp, file, method = "curl", quiet = TRUE)
unzip(file, exdir = dir.in)

## ----create_data_dir-----------------------------------------------------
Expand Down
7 changes: 2 additions & 5 deletions inst/doc/sir20165080_AppendixC.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@ CheckStatus <- function(s) {
}
@

\title{Appendix C. Creating Datasets for the R-Package `wrv'\vspace{2ex}}
\title{Appendix C. Creating Datasets for the R-Package `wrv'}
\author{}
\date{}
\pretitle{\begin{flushleft}\LARGE\bfseries\sffamily}
\posttitle{\end{flushleft}}
\maketitle

\tableofcontents
Expand Down Expand Up @@ -125,7 +122,7 @@ Download the ZIP file to a temporary directory and uncompress.
<<download_ned, message=FALSE>>=
ftp <- "ftp://rockyftp.cr.usgs.gov/vdelivery/Datasets/Staged/NED/13/ArcGrid/n44w115.zip"
file <- file.path(tempdir(), basename(ftp))
download.file(ftp, file)
download.file(ftp, file, method = "curl", quiet = TRUE)
unzip(file, exdir = dir.in)
@

Expand Down
5 changes: 3 additions & 2 deletions inst/doc/sir20165080_AppendixD.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ FmtLength <- function(x, u=c("m", "ft"), conv=m.to.ft) {
return(s)
}
FmtFlow <- function(x, u=c("m\\textsuperscript{3}/d", "acre-ft/yr"), conv=m3.per.d.to.af.per.yr) {
FUN <- function(i) ToScientific(i, 1)
FUN <- function(i) ToScientific(i, digits=1)
if (length(x) == 1) {
s <- vapply(c(x[1], x[1] * conv), FUN, "")
s <- sprintf("%s~%s (%s~%s)", s[1], u[1], s[2], u[2])
Expand Down Expand Up @@ -1750,7 +1750,8 @@ v <- c(paste("Graph showing", paste0(tolower(substr(v, 1, 1)), substr(v, 2, ncha
ylab <- paste("Groundwater discharge, in", c("cubic meters per day", "acre-feet per year"))
col <- "#C80C0B"
PlotGraph(d.drain.2, ylab=ylab, col=col, fill=paste0(col, "66"),
conversion.factor=m3.per.d.to.af.per.yr, scientific=TRUE, center.date.labels=TRUE)
conversion.factor=m3.per.d.to.af.per.yr, scientific=FALSE,
center.date.labels=TRUE, seq.date.by="year")

## ----echo=FALSE, message=FALSE-------------------------------------------
# save R objects that will be used to update the water budget
Expand Down
10 changes: 4 additions & 6 deletions inst/doc/sir20165080_AppendixD.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ FmtLength <- function(x, u=c("m", "ft"), conv=m.to.ft) {
return(s)
}
FmtFlow <- function(x, u=c("m\\textsuperscript{3}/d", "acre-ft/yr"), conv=m3.per.d.to.af.per.yr) {
FUN <- function(i) ToScientific(i, 1)
FUN <- function(i) ToScientific(i, digits=1)
if (length(x) == 1) {
s <- vapply(c(x[1], x[1] * conv), FUN, "")
s <- sprintf("%s~%s (%s~%s)", s[1], u[1], s[2], u[2])
Expand All @@ -98,11 +98,8 @@ FmtFlow <- function(x, u=c("m\\textsuperscript{3}/d", "acre-ft/yr"), conv=m3.per
}
@

\title{Appendix D.\enspace Uncalibrated Groundwater-Flow Model for the Wood River Valley Aquifer System, South-Central Idaho\vspace{2ex}}
\title{Appendix D.\enspace Uncalibrated Groundwater-Flow Model for the Wood River Valley Aquifer System, South-Central Idaho}
\author{}
\date{}
\pretitle{\begin{flushleft}\LARGE\bfseries\sffamily}
\posttitle{\end{flushleft}}
\maketitle

\tableofcontents
Expand Down Expand Up @@ -2799,7 +2796,8 @@ v <- c(paste("Graph showing", paste0(tolower(substr(v, 1, 1)), substr(v, 2, ncha
ylab <- paste("Groundwater discharge, in", c("cubic meters per day", "acre-feet per year"))
col <- "#C80C0B"
PlotGraph(d.drain.2, ylab=ylab, col=col, fill=paste0(col, "66"),
conversion.factor=m3.per.d.to.af.per.yr, scientific=TRUE, center.date.labels=TRUE)
conversion.factor=m3.per.d.to.af.per.yr, scientific=FALSE,
center.date.labels=TRUE, seq.date.by="year")
@

% =========================================================================
Expand Down
5 changes: 1 addition & 4 deletions inst/doc/sir20165080_AppendixE.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,8 @@ credit <- paste("Base derived from U.S. Geological Survey National Elevation Dat
"Idaho Transverse Mercator projection; North American Datum of 1983.", sep="\n")
@

\title{Appendix E.\enspace Tributary Basin Underflow into the Wood River Valley Aquifer System, South-Central Idaho\vspace{2ex}}
\title{Appendix E.\enspace Tributary Basin Underflow into the Wood River Valley Aquifer System, South-Central Idaho}
\author{}
\date{}
\pretitle{\begin{flushleft}\LARGE\bfseries\sffamily}
\posttitle{\end{flushleft}}
\maketitle

\tableofcontents
Expand Down
7 changes: 3 additions & 4 deletions inst/doc/sir20165080_AppendixF.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@ credit <- paste("Base derived from U.S. Geological Survey National Elevation Dat
"Idaho Transverse Mercator projection; North American Datum of 1983.", sep="\n")
@

\title{Appendix F.\enspace Natural Groundwater Recharge and Discharge in the Wood River Valley Aquifer System, South-Central Idaho\vspace{2ex}}
\title{Appendix F.\enspace Natural Groundwater Recharge and Discharge in the Wood River Valley Aquifer System, South-Central Idaho}
\author{}
\date{}
\pretitle{\begin{flushleft}\LARGE\bfseries\sffamily}
\posttitle{\end{flushleft}}
\maketitle

\tableofcontents

\newpage

\renewcommand*\listfigurename{Figures}
\listoffigures

Expand Down
5 changes: 1 addition & 4 deletions inst/doc/sir20165080_AppendixG.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ credit <- paste("Base derived from U.S. Geological Survey National Elevation Dat
"Idaho Transverse Mercator projection; North American Datum of 1983.", sep="\n")
@

\title{Appendix G.\enspace Incidental Groundwater Recharge and Pumping Demand in the Wood River Valley Aquifer System, South-Central Idaho\vspace{2ex}}
\title{Appendix G.\enspace Incidental Groundwater Recharge and Pumping Demand in the Wood River Valley Aquifer System, South-Central Idaho}
\author{}
\date{}
\pretitle{\begin{flushleft}\LARGE\bfseries\sffamily}
\posttitle{\end{flushleft}}
\maketitle

\tableofcontents
Expand Down
5 changes: 1 addition & 4 deletions inst/doc/sir20165080_AppendixH.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,8 @@ credit <- paste("Base derived from U.S. Geological Survey National Elevation Dat
"Idaho Transverse Mercator projection; North American Datum of 1983.", sep="\n")
@

\title{Appendix H.\enspace Calibration of the Wood River Valley Groundwater-Flow Model\vspace{2ex}}
\title{Appendix H.\enspace Calibration of the Wood River Valley Groundwater-Flow Model}
\author{}
\date{}
\pretitle{\begin{flushleft}\LARGE\bfseries\sffamily}
\posttitle{\end{flushleft}}
\maketitle

\tableofcontents
Expand Down
4 changes: 2 additions & 2 deletions inst/misc/Rd2.tex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ \chapter*{}
\raggedright{}
\inputencoding{utf8}
\item[Title]\AsIs{Wood River Valley Groundwater-Flow Model}
\item[Version]\AsIs{1.1.3}
\item[Version]\AsIs{1.1.4}
\item[Description]\AsIs{A processing program for the groundwater-flow model of the Wood
River Valley aquifer system, south-central Idaho. Included in the package is
MODFLOW-USG version 1.3, a U.S. Geological Survey groundwater-flow model.}
Expand All @@ -34,7 +34,7 @@ \chapter*{}
rgdal,
rgeos,
sfsmisc,
viridis,
viridisLite,
xtable}
\item[SystemRequirements]\AsIs{PEST (>= 13.0, optional)}
\item[License]\AsIs{CC0}
Expand Down
6 changes: 3 additions & 3 deletions inst/misc/miscellaneous.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ try(knitr::opts_chunk$set(tidy=FALSE, comment="#", fig.align="center"), silent=T
grDevices::pdf.options(useDingbats=FALSE)
options(preferRaster=TRUE, scipen=0, digits=2)
library(wrv)
loadNamespace("viridis")
loadNamespace("viridisLite")
loadNamespace("xtable")
# Device dimension in inches (width, height)
Expand Down Expand Up @@ -369,7 +369,7 @@ breaks <- pretty(log10(x), n=15, na.rm=TRUE)
at <- breaks[c(TRUE, FALSE)]
labels <- ToScientific(10^at, digits=1, type="plotmath")
Pal <- function(...) viridis::viridis(...)
Pal <- function(...) viridisLite::viridis(...)
FUN <- function(r) {
r[] <- log10(r[])
PlotMap(r, breaks=breaks, xlim=usr.map[1:2], ylim=usr.map[3:4],
Expand Down Expand Up @@ -935,7 +935,7 @@ PlotMap(crs(hill.shading), xlim=usr.map[1:2], ylim=usr.map[3:4],
plot(alluvium.extent, border="#FFFFFFCC", add=TRUE)
xy <- coordinates(getSpatialLinesMidPoints(trib.lines))
z <- trib.lines@data$mean.flow
Pal <- function(...) rev(viridis::viridis(..., alpha=0.8))
Pal <- function(...) rev(viridisLite::viridis(..., alpha=0.8))
AddPoints(xy, z=z, inches=c(0.03, 0.3), fg="#FFFFFF65", format="d",
title="Average groundwater flow rate", subtitle="in cubic meters per day",
bg=Pal, legend.loc="topright", quantile.breaks=TRUE)
Expand Down
2 changes: 1 addition & 1 deletion vignettes/sir20165080_AppendixC.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Download the ZIP file to a temporary directory and uncompress.
<<download_ned, message=FALSE>>=
ftp <- "ftp://rockyftp.cr.usgs.gov/vdelivery/Datasets/Staged/NED/13/ArcGrid/n44w115.zip"
file <- file.path(tempdir(), basename(ftp))
download.file(ftp, file)
download.file(ftp, file, method = "curl", quiet = TRUE)
unzip(file, exdir = dir.in)
@

Expand Down
3 changes: 2 additions & 1 deletion vignettes/sir20165080_AppendixD.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -2796,7 +2796,8 @@ v <- c(paste("Graph showing", paste0(tolower(substr(v, 1, 1)), substr(v, 2, ncha
ylab <- paste("Groundwater discharge, in", c("cubic meters per day", "acre-feet per year"))
col <- "#C80C0B"
PlotGraph(d.drain.2, ylab=ylab, col=col, fill=paste0(col, "66"),
conversion.factor=m3.per.d.to.af.per.yr, scientific=TRUE, center.date.labels=TRUE)
conversion.factor=m3.per.d.to.af.per.yr, scientific=FALSE,
center.date.labels=TRUE, seq.date.by="year")
@

% =========================================================================
Expand Down
2 changes: 2 additions & 0 deletions vignettes/sir20165080_AppendixF.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ credit <- paste("Base derived from U.S. Geological Survey National Elevation Dat

\tableofcontents

\newpage

\renewcommand*\listfigurename{Figures}
\listoffigures

Expand Down

0 comments on commit 65798d7

Please sign in to comment.