dankelley / oce

R package for oceanographic processing
http://dankelley.github.io/oce/
GNU General Public License v3.0
145 stars 42 forks source link

ctdTrim() is leaving too much equilibration data #1393

Closed dankelley closed 6 years ago

dankelley commented 6 years ago
library(oce)
data(ctdRaw)
par(mfrow=c(1,2))
plotScan(ctdTrim(ctdRaw))
plotProfile(ctdTrim(ctdRaw),"salinity")

produces as below. That's a lot of equilibration phase being left behind, and the salinities don't look real, either. I'm embarrassed by this, because I had in mind that data(ctd) was produced from simply using ctdTrim(ctdRaw) but not so!

It's a bit scary to go into ctdTrim, a function that's had a lot of reworking, but if it's this bad on a sample file we give with oce, I reckon it needs some fixing.

screen shot 2018-03-29 at 3 47 15 pm
dankelley commented 6 years ago

Hm, so the diagnostics are as below. It doesn't even look at equilibration phase.

> a<-ctdTrim(ctdRaw,debug=30)
ctdTrim() {
  ctdTrim() using method "downcast"
  pmin= -5 
  removed data at indices from 379 (where pressure is 51.15) to the end of the data
  method[2]="A"
  scanStart: 1 
} # ctdTrim()
richardsc commented 6 years ago

Are you sure? I thought it fit a piecewise linear to remove equilibration. Or is that one of the other methods?

Maybe it's time for a separate "ctd processing" package rather than trying to have oce do everything perfectly ...

Sent from a mobile computer phone. Please excuse any tyops.

dankelley commented 6 years ago

I think it used to remove the equilibration -- that's why it's a bug. As for a separate package, I'd prefer to get this many-years-old function working first, but, yes, I think by Christmas or say summer 2019, the community will have access to both a glider package and a CTD package. My idea on this is that oce should retain old things but that the docs will start referring to the new packages for better versions (but that requires those packages to be on cran for the oce docs to build on cran).

dankelley commented 6 years ago

Oh hang on a tick, guvner, I see that the following removes the equilibration phase.

plotScan(ctdTrim(ctdRaw, method="sbe"))
plot(ctdTrim(ctdRaw, method="sbe"))

The scan plot looks fine:

screen shot 2018-03-29 at 5 01 38 pm

and the summary plot looks ok:

screen shot 2018-03-29 at 5 01 05 pm

so crisis averted. Closing issue.