Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dankelley committed Aug 19, 2024
2 parents 3f42c84 + fd6f495 commit aae31f5
Show file tree
Hide file tree
Showing 189 changed files with 1,256 additions and 1,771 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ issues
^CRAN-RELEASE$
^codemeta\.json$
^CRAN-SUBMISSION$
.markdownlint.yaml
94 changes: 94 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: "A comma separated list of R-hub platforms to use."
type: string
default: "linux,windows,macos"
name:
description: "Run name. You can leave this empty now."
type: string
id:
description: "Unique ID. You can leave this empty now."
type: string

jobs:
setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://github.com/DavidAnson/markdownlint/blob/v0.32.1/schema/.markdownlint.yaml
MD013: false
MD025: false
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: gsw
Version: 1.1-1
Version: 1.2-0
Title: Gibbs Sea Water Functions
Authors@R: c(
person(given="Dan",
Expand All @@ -16,7 +16,7 @@ Authors@R: c(
family="SCOR/IAPSO",
role=c("aut","cph"),
comment="Original 'Matlab' and derived code"))
Copyright: Original algorithms and 'Matlab'/C library (c) 2015-2022 WG127 SCOR/IAPSO (Scientific Committee on Oceanic Research / International Association for the Physical Sciences of the Oceans, Working Group 127); C wrapper code and R code (c) 2015-2021 Dan Kelley and Clark Richards
Copyright: Original algorithms and 'Matlab'/C library (c) 2015-2023 WG127 SCOR/IAPSO (Scientific Committee on Oceanic Research / International Association for the Physical Sciences of the Oceans, Working Group 127); C wrapper code and R code (c) 2015-2023 Dan Kelley and Clark Richards
Maintainer: Dan Kelley <[email protected]>
Depends:
R (>= 3.5.0),
Expand All @@ -32,6 +32,6 @@ LazyLoad: yes
LazyData: no
Packaged: Dan Kelley
Encoding: UTF-8
RoxygenNote: 7.2.1
RoxygenNote: 7.3.2
BuildVignettes: true
VignetteBuilder: knitr
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export(argfix,
gsw_grav,
gsw_Helmholtz_energy_ice,
gsw_ice_fraction_to_freeze_seawater,
gsw_infunnel,
gsw_internal_energy,
gsw_internal_energy_ice,
gsw_IPV_vs_fNsquared_ratio,
Expand Down
39 changes: 22 additions & 17 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# gsw 1.2-0

* add `gsw_infunnel()`
* switch from `Calloc` to `R_Calloc` etc, so package builds with "strict"
header checking (issue #63).

# gsw 1.1-1

* Remove a journal link that fails because of an invalid certificate.
* Fix a C function declaration that is invalid for some compilers.

# gsw 1.1-0

This update is based on C code from https://github.com/TEOS-10/GSW-C (release
This update is based on C code from <https://github.com/TEOS-10/GSW-C> (release
v3.06-16-0, commit 657216dd4f5ea079b5f0e021a4163e2d26893371) and the .mat data
file from https://github.com/TEOS-10/GSW-Matlab (commit
file from <https://github.com/TEOS-10/GSW-Matlab> (commit
38c9635d6fd93e74c2648e4ee23cec49c1f58530). It was necessary to make some
changes to the within-documentation test suite, as listed below; MRD stands for
Mean Relative Difference from the values in the previous CRAN release of `gsw`,
Expand All @@ -21,35 +27,34 @@ version 1.0-6 released 2021-07-07.

# gsw 1.0-7

- Update to GSW-C as of 2021-07-14, github commit
* Update to GSW-C as of 2021-07-14, github commit
`bad2c9e4e154597ce563aaaf3ce09b1c52a2ab46`. This does not change any
existing functions in GSW-R.
- Add gsw_SP_salinometer().
- Add gsw_o2sol().
- Add gsw_o2sol_SP_pt().
* Add gsw_SP_salinometer().
* Add gsw_o2sol().
* Add gsw_o2sol_SP_pt().

# gsw 1.0-6

- Update to GSW-C as of 2021-07-06, github commit
* Update to GSW-C as of 2021-07-06, github commit
`9c10670e89fce906da2cebce3399d73c054e769e`.
- Remove dependency on the 'testthat' package.
- gsw_z_from_p() and gsw_p_from_z() gain parameters geo_strf_dyn_height and
* Remove dependency on the 'testthat' package.
* gsw_z_from_p() and gsw_p_from_z() gain parameters geo_strf_dyn_height and
sea_surface_geopotential.
- Relax gsw_geo_strf_dyn_height() test, since values are tied to a new Matlab
* Relax gsw_geo_strf_dyn_height() test, since values are tied to a new Matlab
interpolation scheme that is not incorporated in GSW-C.

# gsw 1.0-5

- Update to GSW-C 3.05-4.
- Make internal sort routines be machine-independent.
* Update to GSW-C 3.05-4.
* Make internal sort routines be machine-independent.

# gsw 1.0-4

- Update to GSW-C 3.05-3.
- Handle NaN values better.
- Add dozens of new GSW functions.
* Update to GSW-C 3.05-3.
* Handle NaN values better.
* Add dozens of new GSW functions.

# gsw 1.0-3

- First version, using GSW version 3.03.

* First version, using GSW version 3.03.
62 changes: 61 additions & 1 deletion R/gsw.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
#'
#' @docType package
#' @name gsw
#' @keywords internal
"_PACKAGE"
NULL

#' Global SA lookup file
Expand Down Expand Up @@ -3297,7 +3299,7 @@ gsw_pot_enthalpy_from_pt_ice_poly <- function(pt0_ice)
#'
#' 2. The R code does not reproduce the check values stated at
#' \url{http://www.teos-10.org/pubs/gsw/html/gsw_pot_enthalpy_ice_freezing.html}. Those
#' values are incorporated in the test provided in \dQuote{Examples}, so that test
#' values are incorporated in the test provided in \sQuote{Examples}, so that test
#' is not performed during build tests. See https://github.com/TEOS-10/GSW-R/issues/27.
#' @family things related to enthalpy
## @family things related to ice
Expand Down Expand Up @@ -6082,3 +6084,61 @@ gsw_z_from_p <- function(p, latitude, geo_strf_dyn_height, sea_surface_geopotent
rval
}

#' Determine whether a point is inside the 'funnel' of acceptable values
#'
#' This function determines whether a given hydrographic value lies what
#' the TEOS-10 literature calls a "funnel" of values that lead to acceptably
#' accurate computation of specific volume. For more details, consult the
#' TEOS-10 literature, perhaps starting with the materials referred to in the
#' webpage cited in the \sQuote{References} section.
#'
#' @return a logical value indicating whether the given
#' point is inside the funnel of acceptable values.
#'
#' @template SAtemplate
#' @template CTtemplate
#' @template ptemplate
#'
#' @examples
#' library(gsw)
#' gsw_infunnel(35, 10, 100) # TRUE
#' gsw_infunnel(45, 10, 100) # FALSE: too salty
#' gsw_infunnel(35, -4, 100) # FALSE: below freezing
#'
#' @references
#' \url{https://www.teos-10.org/pubs/gsw/html/gsw_infunnel.html}
#'
#' @family things related to density
gsw_infunnel <- function(SA, CT, p)
{
l <- argfix(list(SA=SA, CT=CT, p=p))
n <- length(l[[1]])
rval <- !((l$p > 8000) |
(l$SA < 0.0) |
(l$SA > 42.0) |
(l$p < 500.0 & l$CT < gsw_CT_freezing(l$SA, l$p)) |
(l$p >= 500.0 & l$p < 6500.0 & l$SA < l$p*4e-3 - 2.5) |
(l$p > 500.0 & l$p < 6500.0 & l$CT > (31.66666666666667 - l$p*3.333333333333334e-3)) |
(l$p >= 500.0 & l$CT < gsw_CT_freezing(l$SA, 500.0)) |
(l$p >= 6500.0 & l$SA < 30) |
(l$p >= 6500.0 & l$CT > 10.0))
# Catch both NA input values and NA or NaN computed values
rval[!is.finite(rval)] <- TRUE
if (is.matrix(SA))
dim(rval) <- dim(SA)
rval
#in_funnel = ones(size(SA));
#
#in_funnel(p > 8000 |...
# SA < 0 |...
# SA > 42 |...
# (p < 500 & CT < gsw_CT_freezing(SA,p)) |...
# (p >= 500 & p < 6500 & SA < p*5e-3 - 2.5) |...
# (p > 500 & p < 6500 & CT > (31.66666666666667 - p*3.333333333333334e-3)) | ...
# (p >= 500 & CT < gsw_CT_freezing(SA,500)) |...
# (p >= 6500 & SA < 30) |...
# (p >= 6500 & CT > 10.0)) = 0;
#
#in_funnel(isnan(SA) | isnan(CT) | isnan(p)) = NaN;
}

26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@ state and is being actively
developed.](http://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/gsw)](https://cran.r-project.org/package=gsw)
[![R-CMD-check](https://github.com/TEOS-10/GSW-R/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/TEOS-10/GSW-R/actions/workflows/R-CMD-check.yaml)
<<<<<<< HEAD
![RStudio CRAN mirror downloads](http://cranlogs.r-pkg.org/badges/last-month/gsw)
![RStudio CRAN mirror downloads](http://cranlogs.r-pkg.org/badges/last-week/gsw)
![RStudio CRAN mirror downloads](http://cranlogs.r-pkg.org/badges/last-day/gsw)
=======
[![R-hub](https://github.com/dankelley/GSW-R/actions/workflows/rhub.yaml/badge.svg)](https://github.com/dankelley/GSW-R/actions/workflows/rhub.yaml)
![RStudio CRAN mirror downloads](https://cranlogs.r-pkg.org/badges/last-month/gsw)
![RStudio CRAN mirror downloads](https://cranlogs.r-pkg.org/badges/last-week/gsw)
![RStudio CRAN mirror downloads](https://cranlogs.r-pkg.org/badges/last-day/gsw)
>>>>>>> develop
![RStudio CRAN mirror downloads](https://cranlogs.r-pkg.org/badges/grand-total/gsw)

gsw is an R package that provides a connection to software relating to TEOS,
the Thermodynamic Equation Of Seawater (see http://www.teos-10.org). This
the Thermodynamic Equation Of Seawater (see <http://www.teos-10.org>). This
connection involves R wrappers to C functions within the GSW-C library
(https://github.com/TEOS-10/GSW-C, release v3.06-16-0, commit
(<https://github.com/TEOS-10/GSW-C>, release v3.06-16-0, commit
657216dd4f5ea079b5f0e021a4163e2d26893371), along with a data file within the
GSW-Matlab library
(https://github.com/TEOS-10/GSW-Matlab/blob/master/Toolbox/library/gsw_data_v3_0.mat,
(<https://github.com/TEOS-10/GSW-Matlab/blob/master/Toolbox/library/gsw_data_v3_0.mat>,
commit 38c9635d6fd93e74c2648e4ee23cec49c1f58530).

The foundational algorithms upon which both GSW-C and GSW-R rest were devised
Expand All @@ -26,12 +33,11 @@ recommended as a replacement for a previous system (called UNESCO-80) at the
twenty-fifth assembly in the Intergovernmental Oceanographic Commission in
2009.

The gsw functions reproduce test values in the GSW-Fortran documentation to
a tolerance of 1.5e-8, the default for numerical comparison in R working on
a 64-bit machine. This offers some assurance that the coding process
has not introduced errors.
The gsw functions reproduce test values in the GSW-Matlab documentation to a
tolerance of 1.5e-8, the default for numerical comparison in R working on a
64-bit machine. This offers some assurance that the coding process has not
introduced errors.

The naming convention in gsw is patterned on the system described at
http://www.teos-10.org/pubs/gsw/html/gsw_contents.html, as a way to reduce the
effort users might face in switching to R.

<http://www.teos-10.org/pubs/gsw/html/gsw_contents.html>, as a way to reduce
the effort users might face in switching to R.
19 changes: 9 additions & 10 deletions check_package.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#install.packages("codemetar")
# install.packages("codemetar")
requireNamespace(c("codemetar", "devtools", "urlchecker", "rhub", "revdepcheck"))
# codemeta changes a timestamp, so requiring a commit after every call. That is
# senseless, so I only run the false part of the following conditional in the
Expand All @@ -14,14 +14,13 @@ urlchecker::url_check()
devtools::check_win_release()
devtools::check_win_devel()
devtools::check_win_oldrelease()
# rhub was broken in 2022 June/July but seen to work again on Aug 16
rhub::check_for_cran(email="[email protected]", show_status=FALSE)
rhub::check(platform="debian-clang-devel", show_status=FALSE)
#> rhub::platforms()
#debian-clang-devel:
# Debian Linux, R-devel, clang, ISO-8859-15 locale
#> rhub::check_rhub()

# 2024-08-19 DEK: rhub has been replaced by rhub2, so the following no longer
# work. The new system is complicated, and has the disadvantage that it only
# works on code that has been pushed to github ... so I will just use a github
# action instead, I think.
# rhub::check_for_cran(email = "[email protected]", show_status = FALSE)
# rhub::check(platform = "debian-clang-devel", show_status = FALSE)
remotes::install_github("r-lib/revdepcheck")
revdepcheck::revdep_reset()
revdepcheck::revdep_check(num_workers=4)

revdepcheck::revdep_check(num_workers = 4)
8 changes: 4 additions & 4 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"codeRepository": "https://github.com/TEOS-10/GSW-R",
"issueTracker": "https://github.com/TEOS-10/GSW-R/issues",
"license": "https://spdx.org/licenses/GPL-2.0",
"version": "1.1.1",
"version": "1.2.0",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.2.1 (2022-06-23)",
"runtimePlatform": "R version 4.4.1 (2024-06-14)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down Expand Up @@ -118,11 +118,11 @@
},
"SystemRequirements": null
},
"fileSize": "5224.627KB",
"fileSize": "5165.753KB",
"relatedLink": ["http://teos-10.github.io/GSW-R/", "https://CRAN.R-project.org/package=gsw"],
"releaseNotes": "https://github.com/TEOS-10/GSW-R/blob/master/NEWS.md",
"readme": "https://github.com/TEOS-10/GSW-R/blob/main/README.md",
"contIntegration": "https://github.com/TEOS-10/GSW-R/actions/workflows/R-CMD-check.yaml",
"contIntegration": ["https://github.com/TEOS-10/GSW-R/actions/workflows/R-CMD-check.yaml", "https://github.com/dankelley/GSW-R/actions/workflows/rhub.yaml"],
"developmentStatus": "https://www.repostatus.org/",
"keywords": ["seawater", "gibbs", "teos-10", "oceanography"]
}
Loading

0 comments on commit aae31f5

Please sign in to comment.