Skip to content

Commit

Permalink
Merge pull request #370 from StoXProject/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
arnejohannesholmin authored Nov 1, 2024
2 parents c3cfdb8 + 92abad2 commit e1ca7b9
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 31 deletions.
43 changes: 20 additions & 23 deletions .github/workflows/check-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@ jobs:
config:
# Latest macOS will use the big-sur-arm64 folder when deploying to the drat repo:
- {os: macOS-latest, r: 'release', pkgext: '.tgz'}
- {os: macOS-latest, r: '4.3', pkgext: '.tgz'}
- {os: macOS-latest, r: 'oldrel', pkgext: '.tgz'}

# macOS-13 will use the big-sur-x86_64 folder when deploying to the drat repo:
- {os: macOS-13, r: 'release', pkgext: '.tgz'}
- {os: macOS-13, r: '4.3', pkgext: '.tgz'}
- {os: macOS-13, r: 'oldrel', pkgext: '.tgz'}

- {os: windows-latest, r: 'release', pkgext: '.zip'}
- {os: windows-latest, r: '4.3', pkgext: '.zip'}
- {os: windows-latest, r: 'oldrel', pkgext: '.zip'}

- {os: ubuntu-latest, r: 'release', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-22.04, r: '4.3', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-22.04, r: '4.2', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
# ubuntu-latest is 24 as of 2024-10-31. Should we use it?
- {os: ubuntu-22.04, r: 'release', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-22.04, r: 'oldrel', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-22.04, r: 'oldrel-1', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
Expand All @@ -50,7 +51,7 @@ jobs:
#### 1. Setup: ####
###################

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Prepare for deployment at push
if: github.event_name == 'push'
Expand Down Expand Up @@ -149,21 +150,17 @@ jobs:
#sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
#sudo apt-get update
# We needed to add libxslt1-dev as RstoxData <= RstoxData-v1.8.0-9006 was using it (we should try to skip this after StoX 3.6.0):
sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev libxslt1-dev
sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev libxslt1-dev libgit2-dev
shell: bash


## 2c. R packages needed for this yaml script (not related to the Rstox package itself):
- name: Install CRANdependencies
run: |
install.packages(c("rcmdcheck", "git2r", "sessioninfo", "knitr", "remotes"))
# Using the latest drat that supports big sur (after inputs from us).
# When the next drat appears on CRAN this can be changed to install from CRAN:
remotes::install_github(repo = 'eddelbuettel/drat', dependencies = FALSE)
# Additional installs to secure specific versions:
install.packages(c("rcmdcheck", "git2r", "sessioninfo", "knitr", "remotes", "drat"))
# Temporarily install Rcpp from GitHub until the CRAN version is fixed:
remotes::install_github("RcppCore/Rcpp")
shell: Rscript {0}


Expand Down Expand Up @@ -243,29 +240,29 @@ jobs:
#### 5. Deploy to the drat repos: ####
######################################

## 5a. Upload to the official (DRAT) repo, but only from the master branch. Here we skip the matrix.config.r = release, as a new StoX release should be ready shortly after each R minor release and listed specifically in the matrix.config:
## 5a. Upload to the official (DRAT) repo, but only from the master branch:
- name: Upload to the official (DRAT) repo
if: ( (runner.os == 'Windows' && matrix.config.r != 'release') || (runner.os == 'macOS' && matrix.config.r != 'release') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'master'
if: ( (runner.os == 'Windows') || (runner.os == 'macOS') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'master'
env:
BUILD_NUMBER: ${{ github.sha }}
DRAT_DEPLOY_TOKEN: ${{ secrets.DRAT_DEPLOY_TOKEN }}
run: . repo_deploy.sh
shell: bash


## 5b. Upload to the (DRAT) testingRepo, but only from the testing branch. Here we skip the matrix.config.r = release, as a new StoX release should be ready shortly after each R minor release and listed specifically in the matrix.config:
## 5b. Upload to the (DRAT) testingRepo, but only from the testing branch:
- name: Upload to the testing (DRAT) repo
if: ( (runner.os == 'Windows' && matrix.config.r != 'release') || (runner.os == 'macOS' && matrix.config.r != 'release') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'testing'
if: ( (runner.os == 'Windows') || (runner.os == 'macOS') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'testing'
env:
BUILD_NUMBER: ${{ github.sha }}
DRAT_DEPLOY_TOKEN: ${{ secrets.DRAT_DEPLOY_TOKEN }}
run: . testingRepo_deploy.sh
shell: bash


## 5c. Upload to the (DRAT) unstableRepo, but only from the develop branch. Here we skip the matrix.config.r = release, as a new StoX release should be ready shortly after each R minor release and listed specifically in the matrix.config:
## 5c. Upload to the (DRAT) unstableRepo, but only from the develop branch:
- name: Upload to the unstable (DRAT) repo
if: ( (runner.os == 'Windows' && matrix.config.r != 'release') || (runner.os == 'macOS' && matrix.config.r != 'release') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'develop'
if: ( (runner.os == 'Windows') || (runner.os == 'macOS') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'develop'
env:
BUILD_NUMBER: ${{ github.sha }}
DRAT_DEPLOY_TOKEN: ${{ secrets.DRAT_DEPLOY_TOKEN }}
Expand All @@ -279,7 +276,7 @@ jobs:
###############################

- name: Create release on GitHub and upload files for testing branch
if: ( (runner.os == 'Windows' && matrix.config.r != 'release') || (runner.os == 'macOS' && matrix.config.r != 'release') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'testing'
if: ( (runner.os == 'Windows') || (runner.os == 'macOS') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'testing'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
Expand All @@ -290,7 +287,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Create release on GitHub and upload files for master branch
if: ( (runner.os == 'Windows' && matrix.config.r != 'release') || (runner.os == 'macOS' && matrix.config.r != 'release') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'master'
if: ( (runner.os == 'Windows') || (runner.os == 'macOS') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'master'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: RstoxBase
Version: 2.0.1-9004
Date: 2024-10-29
Version: 2.0.1-9005
Date: 2024-10-31
Title: Base StoX Functions
Authors@R: c(
person(given = "Arne Johannes",
Expand Down Expand Up @@ -47,7 +47,7 @@ Imports:
jsonlite (>= 1.6),
lwgeom (>= 0.2-0),
maps (>= 0.2-0),
RstoxData (>= 2.0.1-9005),
RstoxData (>= 2.0.1-9007),
sf (>= 0.9.0),
stringi (>= 1.4.0),
units (>= 0.7),
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# RstoxBase v2.0.1-9005 (2024-10-30)
* Applied 'release' and 'oldrel' in the check-full.yaml, securing that binaries are built for the current and previous R minor versjon.
* Fixed bug with numeric vectors with NAs in factorNAfirst().
* Updated the documentation of StratumNameLabel.


# RstoxBase v2.0.1-9004 (2024-10-28)
* Added a warning in NASC() for multiple Beam with the same frequency, which may lead to over-estimation.
* Changed aggregateBaselineDataOneTableSingleFunction() used by aggregateBaselineDataOneTable() to pad with zeros for all "data" variables, as specified in the dataTypeDefinition.
Expand All @@ -6,7 +12,7 @@
* Added splitting by both "-" and "/" in formatOutput to ensure correct sorting. This change should not affect any results through imputation as all known StoX project use only one SpeciesCategory in SuperIndividuals.
* Temporarily hiding Prey functions.

# RstoxBase v2.0.1-9003 (2024-10-17)
# RstoxBase v2.0.1-9003 (2024-10-10)
* Added warning if there are duplicated StratumLayerIndividual in Individuals(). There may however be duplicated StratumLayerIndividual in SuperIndividuals(), e.g. when multiple Beam are used. Added support in imputation to tackle this and avoid errors such as "factor level [2316] is duplicated".
* Fixed bug when using DefinitionMethod = "PreDefined" in DefineAcousticPSU().
* Added support for numeric sorting of plus groups in plots, so that 9 comes before 10+.
Expand Down
2 changes: 1 addition & 1 deletion R/Spatial.R
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ simplifyStratumPolygon <- function(
#' The stratum names must be stored as the column StratumName of the data of the \code{\link[sp]{SpatialPolygonsDataFrame}} \code{stratum}.
#'
#' @param stratum A \code{\link[sp]{SpatialPolygonsDataFrame}} with a column StratumName of the data of the \code{\link[sp]{SpatialPolygonsDataFrame}} \code{stratum}.
#' @param StratumNameLabel The name of the attribute representing the stratum names in the GeoJSON file or shapefile.
#' @param StratumNameLabel The name of the attribute representing the stratum names in the GeoJSON file or shapefile. When reading WKT or txt files the StratumNameLabel is ignored, as those formats does not support column names.
#' @param check.unique Logical: If TRUE, an error is given if stratum names are not unique.
#' @param accept.wrong.name.if.only.one Logical: If TRUE, interpret stratum names if only one column in the SpatialPolygonsDataFrame.
#'
Expand Down
7 changes: 6 additions & 1 deletion R/Utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -1721,9 +1721,13 @@ setUnitRstoxBase <- function(x, dataType, variableName, unit = NULL) {




# The factorNAfirst() is placed in RstoxBase since we may need it in plots later:

#' Convert to factor and put NAs first
#'
#' @param x A vector.
#'
#' @export
#'
factorNAfirst <- function(x){
Expand Down Expand Up @@ -1752,7 +1756,7 @@ factorNAfirst <- function(x){
}

# If there are levels ending with "+", this is an indication that a plus group (e.g. age) is given, so we remove the "+" and try as numeric:
if(any(endsWith(levels, "+"), na.rm = TRUE)) {
if(any(endsWith(as.character(levels), "+"), na.rm = TRUE)) {
levels_sans_plus <- convertToNumericIfPossible(sub("+", "", levels, fixed = TRUE))
levels = levels[order(levels_sans_plus)]
}
Expand All @@ -1778,3 +1782,4 @@ convertToNumericIfPossible <- function(x) {
}



Binary file modified inst/extdata/functionArguments.rds
Binary file not shown.
2 changes: 1 addition & 1 deletion man/DefineStratumPolygon.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/getStratumNames.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e1ca7b9

Please sign in to comment.