TEOS-10 / GSW-R

R implementation of the Thermodynamic Equation Of Seawater - 2010 (TEOS-10)
http://teos-10.github.io/GSW-R/
Other
8 stars 5 forks source link

some functions returning e.g. 0 instead of NA #37

Closed dankelley closed 7 years ago

dankelley commented 7 years ago

This example came up in some work with oce, and so I'll illustrate with oce code. I see how to fix this, and have done it for the CT as a test case (i.e. below is from the OLD code; the 0.00000 will become NA in the NEW code)

library(oce)
a <- as.ctd(30:35,c(10,NA,12,13,14,15),10:15)
a[["CT"]]
[1] 10.07951  0.00000 12.05066 13.03213 14.01094 14.98715
dankelley commented 7 years ago

This is now fixed in the develop branch, commit 44df9b05db38e2a9c58e4a564c91fd784d03b24a, for this single function (see below). I'll fix the other functions within a week or so.

library(oce)
a <- as.ctd(30:35,c(10,NA,12,13,14,15),10:15)
a[["CT"]]
[1] 10.07951       NA 12.05066 13.03213 14.01094 14.98715
dankelley commented 7 years ago

I think I've addressed this in all functions, in the develop branch, commit 31ae749b1bd810ceae79544a5f877165906b271d (click the link in a webbrowser to see the git-diff).

This is the sort of repetitive editing exercise that is easy to get wrong, but

  1. I did it reasonably carefully, with editor macros that reduce errors
  2. I used some grep patterns and other tricks to look for possible typos
  3. I ran code-diagnostic tests in R
  4. I made sure that the build-test still works, which suggests that I've not broken things for the case of non-NA argument values

Given all of this, I'm closing the issue.