Skip to content

Commit

Permalink
Merge pull request #83 from NOAA-EDAB/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
kaydin authored May 31, 2024
2 parents 81c739e + 2ca84f0 commit 458f4d2
Show file tree
Hide file tree
Showing 143 changed files with 6,590 additions and 1,991 deletions.
13 changes: 13 additions & 0 deletions ..Rcheck/00check.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
* using log directory ‘/home/rklasky/R/packages/Rpath/..Rcheck’
* using R version 4.3.1 (2023-06-16)
* using platform: x86_64-pc-linux-gnu (64-bit)
* R was compiled by
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
* running under: Linux Mint 20
* using session charset: UTF-8
* checking for file ‘./DESCRIPTION’ ... ERROR
Required fields missing or empty:
‘Author’ ‘Maintainer’
* DONE
Status: 1 ERROR
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
^_pkgdown\.yml$
^docs$
^pkgdown$
^data-raw$
^doc$
^Meta$
1 change: 1 addition & 0 deletions .Renviron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_R_CHECK_DONTTEST_EXAMPLES_=FALSE
29 changes: 10 additions & 19 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: [main, master, UnitTests]
pull_request:
branches: [main, master]

Expand All @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
Expand All @@ -29,30 +29,21 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: rcmdcheck

- uses: r-lib/actions/check-r-package@v1

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
2 changes: 1 addition & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/secretScan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ jobs:
fetch-depth: '2'
- name: gitleaks-action
uses: gitleaks/[email protected]

94 changes: 94 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

on:
push:
paths:
- '.github/workflows/tests.yml'
- 'R/*'
- 'tests/testthat/*'
- 'README.md'
- 'DESCRIPTION'
pull_request:
paths:
- '.github/workflows/tests.yml'
- 'R/*'
- 'tests/testthat/*'

name: Unit-Tests

jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: r-lib/actions/setup-r@v2
# - uses: r-lib/actions/setup-pandoc@v2
# - name: Install dependencies
# run: Rscript -e "install.packages(c('testthat', 'tidyverse', 'here'))"
# - name: Run tests
# run: Rscript -e "source('tests/testthat.R')"

Unit-Tests:
runs-on: ${{matrix.config.os}}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
#os: [macos-latest, ubuntu-latest, windows-latest]
#os: [ubuntu-latest]
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# R_REMOTES_NO_ERRORS_FROM_WARNINGS: false
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4
# with:
# fetch-depth: 0

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
# r-version: '4.3.1'

- uses: r-lib/actions/setup-r-dependencies@v2

- name: Install command line packages
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt-get install libcurl4-openssl-dev libgit2-dev
- name: Install dependencies
#run: Rscript -e "install.packages(c('remotes','testthat', 'tidyverse', 'here'))"
run: |
install.packages(c('usethis','remotes','testthat','tidyverse','here','rmarkdown','qpdf','distillery','ggpubr','rlist'))
remotes::install_github("NOAA-EDAB/Rpath")
shell: Rscript {0}

- name: Run tests
#run: Rscript -e "source('tests/testthat.R')"
run: |
source(here::here("data-raw/REcosystem.R"))
source(here::here("tests/testthat.R"))
shell: Rscript {0}

# - name: commit data files
# run: |
# git config user.name github-actions
# git config user.email [email protected]
# file.copy('here::here("tests/testthat/Rplots.pdf")",to=here::here("inst/extdata/Rplots.pdf"))
# git add inst/extdata/Rplots.pdf
# git commit -m "automated commit from testthat yml"
# git push
18 changes: 14 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
.Rproj.user
.Rhistory
.RData
*.png
.Renviron
*.jpg
*.tif
data
*.tar
*.so
outputs
code
*.xlsx
*.docx
*.pdf
Ecopath_dev
Rpath.Rcheck*
src/*.o
src/*.dll
NAMESPACE

tests/testthat/data/output/*
tests/testthat/data/bkup/*
tests/testthat/data/input/REcosystem_Current_*.dat
tests/testthat/data/input/REcosystem_Current_*.csv
tests/testthat/old/*
tests/testthat/bkup/*
tests/testthat/old dat files/*
docs
doc
Meta
Rpath.Rproj
81 changes: 49 additions & 32 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
Package: Rpath
Type: Package
Title: R implementation of Ecopath with Ecosim
Version: 0.0.1.3
Date: 2021-04-25
Authors@R: c(
person("Kerim", "Aydin", email = "[email protected]", role = "aut"),
person("Sean", "Lucey", email = "[email protected]",
role = c("aut", "cre")),
person("Sarah", "Gaichas", email = "[email protected]", role = "aut"))
Description: This package implements the core mass balance equations made popular
by Ecopath with Ecosim. There are two parts to the package, the static snapshot
of energy flow through the system using rpath and dynamic simulations run using
the rsim family of functions.
License: file LICENSE
Encoding: UTF-8
Imports:
data.table,
graphics,
grDevices,
MASS,
Rcpp (>= 0.11.3),
stats,
utils
LinkingTo: Rcpp
Suggests:
knitr,
rmarkdown
VignetteBuilder: knitr
RoxygenNote: 7.1.1
URL: https://github.com/NOAA-EDAB/Rpath
BugReports: https://github.com/NOAA-EDAB/Rpath/issues
Package: Rpath
Type: Package
Title: R implementation of Ecopath with Ecosim
Version: 0.9.0
Date: 2024-05-31
Authors@R: c(
person("Kerim", "Aydin", email = "[email protected]", role = "aut"),
person("Sean", "Lucey", email = "[email protected]",
role = c("aut", "cre")),
person("Sarah", "Gaichas", email = "[email protected]", role = "aut"))
Description: This package implements the core mass balance equations made popular
by Ecopath with Ecosim. There are two parts to the package, the static snapshot
of energy flow through the system using rpath and dynamic simulations run using
the rsim family of functions.
License: file LICENSE
Encoding: UTF-8
Imports:
data.table,
methods,
graphics,
grDevices,
MASS,
Rcpp (>= 0.11.3),
stats,
utils
LinkingTo: Rcpp
Suggests:
here,
knitr,
rmarkdown,
distillery,
ggplot2,
ggpubr,
rlist,
stringr,
qpdf,
usethis,
dplyr,
generics,
testthat (>= 3.0.0)
VignetteBuilder: knitr
RoxygenNote: 7.2.3
URL: https://github.com/NOAA-EDAB/Rpath
BugReports: https://github.com/NOAA-EDAB/Rpath/issues
Depends:
R (>= 2.10)
Config/testthat/edition: 3
LazyData: true

1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ import(stats)
import(utils)
importFrom(Rcpp,sourceCpp)
importFrom(grDevices,rainbow)
importFrom(methods,is)
useDynLib(Rpath)
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Rpath 0.9.0

## Major Changes
- Added Ecosense routines and vignettes
- Added example ecosystems
- Added Unit Tests
- Fixed bug in stanza month calculations that affected some species
- Changed versioning to reflect near-release status.
=======
# Rpath 0.0.1.3

## Major Changes
Expand Down
46 changes: 23 additions & 23 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

rk4_run <- function(params, instate, forcing, fishing, stanzas, StartYear, EndYear) {
.Call('_Rpath_rk4_run', PACKAGE = 'Rpath', params, instate, forcing, fishing, stanzas, StartYear, EndYear)
}

Adams_run <- function(params, instate, forcing, fishing, stanzas, StartYear, EndYear, InitDeriv) {
.Call('_Rpath_Adams_run', PACKAGE = 'Rpath', params, instate, forcing, fishing, stanzas, StartYear, EndYear, InitDeriv)
}

deriv_vector <- function(params, state, forcing, fishing, stanzas, inyear, m, tt) {
.Call('_Rpath_deriv_vector', PACKAGE = 'Rpath', params, state, forcing, fishing, stanzas, inyear, m, tt)
}

SplitSetPred <- function(stanzas, state) {
.Call('_Rpath_SplitSetPred', PACKAGE = 'Rpath', stanzas, state)
}

SplitUpdate <- function(stanzas, state, forcing, deriv, yr, mon) {
.Call('_Rpath_SplitUpdate', PACKAGE = 'Rpath', stanzas, state, forcing, deriv, yr, mon)
}

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

rk4_run <- function(params, instate, forcing, fishing, stanzas, StartYear, EndYear) {
.Call('_Rpath_rk4_run', PACKAGE = 'Rpath', params, instate, forcing, fishing, stanzas, StartYear, EndYear)
}

Adams_run <- function(params, instate, forcing, fishing, stanzas, StartYear, EndYear, InitDeriv) {
.Call('_Rpath_Adams_run', PACKAGE = 'Rpath', params, instate, forcing, fishing, stanzas, StartYear, EndYear, InitDeriv)
}

deriv_vector <- function(params, state, forcing, fishing, stanzas, inyear, m, tt) {
.Call('_Rpath_deriv_vector', PACKAGE = 'Rpath', params, state, forcing, fishing, stanzas, inyear, m, tt)
}

SplitSetPred <- function(stanzas, state) {
.Call('_Rpath_SplitSetPred', PACKAGE = 'Rpath', stanzas, state)
}

SplitUpdate <- function(stanzas, state, forcing, deriv, yr, mon) {
.Call('_Rpath_SplitUpdate', PACKAGE = 'Rpath', stanzas, state, forcing, deriv, yr, mon)
}

14 changes: 10 additions & 4 deletions R/Rpath_support.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
library(methods)

########################################################################################
# Set of functions for returning functional group names (character vector)
# using the type input column
#
# Internal supporting function for group names to check type
grouptype <- function(Rpath){
if(class(Rpath)=="Rpath"){gt<-list(type=Rpath$type, grp=Rpath$Group)}
else{
if(class(Rpath)=="Rpath.params"){
#'
#' @importFrom methods is
#'
grouptype <- function(Rpath) {
if (is(Rpath,"Rpath")) {
gt<-list(type=Rpath$type, grp=Rpath$Group)
} else {
if (is(Rpath,"Rpath.params")) {
gt<-list(type=Rpath$model$Type, grp=Rpath$model$Group)}
else{
stop("Input must be an Rpath (balanced) or Rpath.params (unbalanced) object.")
Expand Down
Loading

0 comments on commit 458f4d2

Please sign in to comment.