Skip to content

Commit

Permalink
Merge pull request #249 from aappling-usgs/develop
Browse files Browse the repository at this point in the history
ODE refactor
  • Loading branch information
aappling-usgs committed Sep 21, 2016
2 parents 3785f1a + 7a04842 commit 565b1f2
Show file tree
Hide file tree
Showing 314 changed files with 12,307 additions and 12,822 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
^\.Rproj\.user$
^\.travis\.yml$
^appveyor\.yml$
man-roxygen
temp
18 changes: 6 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,27 @@

language: r
sudo: required
warnings_ar_errors: true
warnings_are_errors: true

r_build_args: --no-build-vignettes --no-manual --no-multiarch
r_check_args: --no-build-vignettes --no-manual

repos:
CRAN: https://cloud.r-project.org
GRAN: http://owi.usgs.gov/R

before_install:
- wget https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.2.0.tar.gz
- tar xfvs JAGS-4.2.0.tar.gz
- cd JAGS-4.2.0
- sudo ./configure
- sudo make
- sudo make install
- cd ..
- sudo rm -f JAGS-4.2.0.tar.gz
- sudo rm -rf JAGS-4.2.0

before_script:
- Rscript -e "install.packages('knitr', repos='http://cran.cnr.Berkeley.edu/')"
- Rscript -e "install.packages('rmarkdown', repos='http://cran.cnr.Berkeley.edu/')"

r_packages:
- modeest
- deSolve

r_github_packages:
- jimhester/covr
- GLEON/LakeMetabolizer
- appling/unitted

after_success:
- Rscript -e 'covr::coveralls()'
Expand Down
20 changes: 12 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: streamMetabolizer
Type: Package
Title: Estimate Stream Metabolism from Dissolved Oxygen Data
Version: 0.9.8.3
Date: 2016-08-11
Version: 0.9.14
Date: 2016-09-20
Author: Alison Appling, Jordan Read, Luke Winslow, Bob Hall
Maintainer: Alison Appling <aappling@usgs.gov>
Description: Modeling package for stream metabolism.
Expand Down Expand Up @@ -35,7 +35,6 @@ Suggests:
microbenchmark,
plyr,
RCurl,
runjags,
rstan,
testthat,
XML,
Expand All @@ -44,10 +43,6 @@ Collate:
'01-onLoad.R'
'calc_DO_at_sat.R'
'calc_DO_deficit.R'
'calc_DO_mod.R'
'calc_DO_mod_by_diff.R'
'calc_DO_mod_w_fixed_error.R'
'calc_DO_mod_w_sim_error.R'
'calc_air_pressure.R'
'calc_depth.R'
'calc_is_daytime.R'
Expand Down Expand Up @@ -75,12 +70,17 @@ Collate:
'metab_bayes.R'
'metab_inputs.R'
'metab_mle.R'
'metab_model.get_params.R'
'metab_model.predict_DO.R'
'metab_model.predict_metab.R'
'metab_model.show.R'
'metab_model_interface.R'
'metab_night.R'
'metab_sim.R'
'mm_check_mcmc_file.R'
'mm_data.R'
'mm_filter_dates.R'
'mm_filter_hours.R'
'mm_filter_valid_days.R'
'mm_validate_name.R'
'mm_valid_names.R'
Expand All @@ -89,12 +89,16 @@ Collate:
'mm_generate_mcmc_file.R'
'mm_get_timestep.R'
'mm_is_valid_day.R'
'mm_locate_filename.R'
'mm_model_by_ply.R'
'mm_model_by_ply_prototype.R'
'mm_predict_1ply.R'
'mm_predict_DO_1ply.R'
'mm_predict_metab_1ply.R'
'mm_sd_to_ci.R'
'mm_validate_data.R'
'plot_DO_preds.R'
'plot_metab_preds.R'
'revise.R'
'specs.R'
'streamMetabolizer.R'
'zz_build_docs.R'
Expand Down
12 changes: 5 additions & 7 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ S3method(get_info,metab_model)
S3method(get_log,metab_bayes)
S3method(get_mcmc,metab_bayes)
S3method(get_mcmc_data,metab_bayes)
S3method(get_params,metab_Kmodel)
S3method(get_params,metab_bayes)
S3method(get_params,metab_model)
S3method(get_specs,metab_model)
S3method(get_version,metab_model)
S3method(predict_DO,metab_Kmodel)
Expand All @@ -17,16 +20,10 @@ S3method(predict_DO,metab_sim)
S3method(predict_metab,metab_Kmodel)
S3method(predict_metab,metab_bayes)
S3method(predict_metab,metab_model)
S3method(predict_metab,metab_sim)
S3method(print,logs_metab)
S3method(print,preds_metab)
S3method(print,specs)
export(calc_DO_at_sat)
export(calc_DO_deficit)
export(calc_DO_mod)
export(calc_DO_mod_by_diff)
export(calc_DO_mod_w_fixed_error)
export(calc_DO_mod_w_sim_error)
export(calc_air_pressure)
export(calc_depth)
export(calc_is_daytime)
Expand Down Expand Up @@ -55,6 +52,7 @@ export(get_info)
export(get_log)
export(get_mcmc)
export(get_mcmc_data)
export(get_params)
export(get_specs)
export(get_version)
export(lookup_google_timezone)
Expand Down Expand Up @@ -82,6 +80,7 @@ export(plot_DO_preds)
export(plot_metab_preds)
export(predict_DO)
export(predict_metab)
export(revise)
export(specs)
exportClasses(metab_Kmodel)
exportClasses(metab_bayes)
Expand All @@ -93,7 +92,6 @@ import(dplyr)
import(methods)
import(parallel)
import(tibble)
import(unitted)
importFrom(LakeMetabolizer,is.day)
importFrom(LakeMetabolizer,k600.2.kGAS.base)
importFrom(LakeMetabolizer,o2.at.sat.base)
Expand Down
43 changes: 40 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# streamMetabolizer 0.9.14

* all tests are passing and all examples are running [again]. tests are
acceptably comprehensive [for now].

* known issue: K binning in bayesian models is producing unlikely estimates. all
bayesian models need further testing.

# streamMetabolizer 0.9.14

* ongoing bug fixes and re-integration of all model types into new ODE
production/integration scheme

# streamMetabolizer 0.9.12

* removed JAGS from the package. Stan is better for us.

# streamMetabolizer 0.9.11

* this is the last version with JAGS in it.

# streamMetabolizer 0.9.10

* myriad bug fixes to accommodate changes from version 0.9.9.

# streamMetabolizer 0.9.9

* `metab_mle` and `metab_sim` now have several options for relationships among
GPP, light, ER, and temperature.

* `metab_mle` and `metab_sim` now have several options for the method by which
the differential equation for dDO/dt is numerically integrated to produce a time
series of DO predictions.

* `metab_mle` has taken a performance hit to become more flexible in the
GPP-light relationship, the ODE method, and so on. Optimization is likely in the
future.

* `predict_metab` and `predict_DO` optionally attach units to their output.

# streamMetabolizer 0.9.8

* better error and warning handling in metab_bayes, including a new function
Expand All @@ -8,9 +48,6 @@ files are now retrieved for both JAGS and Stan models.

* more efficient specifications of JAGS and Stan models

* more options, more maintainably coded, slightly slower, for ODE solutions in
metab_mle

* incorporated feedback on vignette

# streamMetabolizer 0.9.6
Expand Down
27 changes: 17 additions & 10 deletions R/01-onLoad.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
#' @importFrom utils available.packages contrib.url
#' @keywords internal
.onAttach <- function(libname, pkgname) {
packageStartupMessage("This package is in development. We are using it for our own early applications and welcome bold, flexible, resilient new users who can help us make the package better. Details of the user interface and model implementations will change. Please give us feedback at https://github.com/USGS-R/streamMetabolizer/issues/new.\n")
packageStartupMessage("This package is in development. We are using it for our own early applications and welcome flexible, resilient new users who can help us make the package better. Details of the user interface and model implementations will change. Please give us feedback at https://github.com/USGS-R/streamMetabolizer/issues/new.\n")
packageStartupMessage("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.")

# Check whether this package is up to date
# Load deSolve because otherwise after a few model runs we're likely to get
# the following error
requireNamespace('deSolve', quietly=TRUE)
## Error in .Call("call_rkFixed", as.double(y), as.double(times), Func, Initfunc, :
## "call_rkFixed" not resolved from current namespace (deSolve)
## Error in .C("unlock_solver") :
## "unlock_solver" not resolved from current namespace (deSolve)

# Check whether this package is up to date on GRAN
GRAN_update_code <- paste0(
' update.packages(oldPkgs=c("streamMetabolizer","unitted"),\n',
' dependencies=TRUE, repos=c("http://owi.usgs.gov/R", "https://cran.rstudio.com"))')
github_owner <- 'USGS-R'
github_branch <- 'develop'
github_pkg_ref <- paste0(github_owner,'/',pkgname,'@',github_branch)
github_update_code <- paste0(
' devtools::install_github("',github_pkg_ref,'")')

' dependencies=TRUE, repos=c("https://owi.usgs.gov/R", "https://cran.rstudio.com"))')
tryCatch({
GRAN_pkg <- available.packages(contrib.url("http://owi.usgs.gov/R"))
GRAN_pkg <- available.packages(contrib.url("https://owi.usgs.gov/R"))
GRAN_version <- package_version(GRAN_pkg[[pkgname, 'Version']])
local_version <- packageVersion(pkgname)
if(local_version < GRAN_version) {
Expand All @@ -29,6 +30,12 @@
packageStartupMessage("Can't check GRAN for new package versions just now. We'll try again next time.")
})

# Check whether this package is up to date on GitHub
github_owner <- 'USGS-R'
github_branch <- 'develop'
github_pkg_ref <- paste0(github_owner,'/',pkgname,'@',github_branch)
github_update_code <- paste0(
' devtools::install_github("',github_pkg_ref,'")')
if(requireNamespace('devtools', quietly=TRUE)) {
tryCatch({
github_ref <- devtools:::github_resolve_ref(
Expand Down
30 changes: 0 additions & 30 deletions R/calc_DO_mod.R

This file was deleted.

78 changes: 0 additions & 78 deletions R/calc_DO_mod_by_diff.R

This file was deleted.

0 comments on commit 565b1f2

Please sign in to comment.