New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to read microCAT cnv files created with firmware version 3 #1457
Comments
Thanks. I've started work on this. I've broken the task down as follows (cuz I like checklists) ... please note that I will tick and untick these things as I work within my not-committed branch, so the list will just be for my own purposes as a scratch paper, until I post another comment.
|
A test code follows: library(oce)
old <- read.oce("old.cnv")
new1 <- read.oce("new.cnv")
new2 <- read.oce("new.cnv",
columns=list(conductivity=list(name="cond0S/m",
unit=list(unit=expression(S/m), scale="")))) Test data files attached. Note: must rename them to |
PS on the test files: the longitude is given unsigned, so |
Done in "develop" branch, commit c27acc1 Reporter recheck requested. |
In answer to this question:
Yes! If you look in the |
Hm. If I set it to moored, it doesn't plot: new2m <- oceSetMetadata(new2, "deploymentType", "moored") then I get an error: > plot(new2m, debug=10)
plot,ctd-method(..., eos="gsw", inset=FALSE, ...) {
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ
> traceback()
9: stop("'x' and 'y' lengths differ")
8: xy.coords(x, y, xlabel, ylabel, log)
7: plot.default(x, y, axes = FALSE, xaxs = xaxs, yaxs = yaxs, xlim = if (missing(xlim)) NULL else xlim,
ylim = if (missing(ylim)) NULL else ylim, xlab = xlab, ylab = ylab,
type = type, cex = cex, ...)
6: plot(x, y, axes = FALSE, xaxs = xaxs, yaxs = yaxs, xlim = if (missing(xlim)) NULL else xlim,
ylim = if (missing(ylim)) NULL else ylim, xlab = xlab, ylab = ylab,
type = type, cex = cex, ...)
5: plot(x, y, axes = FALSE, xaxs = xaxs, yaxs = yaxs, xlim = if (missing(xlim)) NULL else xlim,
ylim = if (missing(ylim)) NULL else ylim, xlab = xlab, ylab = ylab,
type = type, cex = cex, ...) at oce.R#1203
4: oce.plot.ts(x[["time"]], x[["salinity"]], ylab = resizableLabel("S",
"y", debug = debug - 1)) at ctd.R#3569
3: .local(x, ...)
2: plot(new2m, debug = 10)
1: plot(new2m, debug = 10) I guess this could be a new issue, but I'll pursue it within this issue, because I think it relates to the use of a julian day, not stored as a time. |
Yes, it's definitely because the object has no item named So, I think the best plan would be to dig into the library(oce)
microcat <- read.oce("2062a.cnv")
microcat <- oceSetMetadata(microcat, "deploymentType", "moored")
## Get system upload time, which should give us the year of the recovery
## time. We'll need that because we are going to construct time from
## the timeJV2 column.
microcat[["metadata"]][["time"]]
## Now, we ought to check on how many days the machine has been
## recording, because it could be multiple years, and if so we'll
## need to set our start time accordingly
range(microcat[["timeJV2"]])
## OK, under a year. Assuming no wrap-around (which would give
## an upper range of 365 or 366), we can now make a time column
t0 <- as.POSIXct("2018-01-01 00:00:00", tz="UTC")
t <- t0 + microcat[["timeJV2"]] * 86400
## Let's insert this into the data
microcat <- oceSetData(microcat, "time", t)
## Finally, to avoid confusion (whew), we destroy the time
## entry from metadata
microcat <- oceDeleteMetadata(microcat, "time")
plot(microcat) NOTE: this code (or an update to it) is at https://github.com/dankelley/oce-issues/blob/master/14xx/1457/1457b.R but to make it work, you'll need the full .cnv file. This creates results as below. You can see the thing going in the water. Note that the map is completely wonky because the longitude is incorrectly given as a positive number; changing that is trivial, of course, but not the main point here. |
PS: time could be out by a day, of course; I've no idea whether seabird starts at 0 or at 1, etc. |
REQUEST to BIO colleagues: It would be wonderful if someone with access to a lot of your cnv files could run the following
and then email me (or post here) the resultant file named |
Hi Dan. I ran the code snippet above on 12 ".cnv" files, the results are posted in the attachment. What I have encountered with the time formats (regardless of "timeJ" or "timeJV2") is that it is a day number starting with 1 at Jan 01 at 00:00 UTC. It will continue at year end so that Jan 01 of the next year is 366. However I see in the module that creates the ".cnv" files that there is an option to start the next year over at day 0. While I haven't seen that used here, I will have to try it out and let you know what happens.... |
Thanks, @pettipasrg -- I converted to a checklist, and will tick items off when I've either ensured that they work (after recoding, if need be). I'll add any new ones that you send, to this comment.
|
Thanks. I tried the "start over at day 0" option in the Seabird conversion module and got 365.993056 |
@pettipasrg -- what did the column name end up being? I hope SBE is giving a different name, so people can detect this. Also, the test code https://github.com/dankelley/oce-issues/blob/master/14xx/1457/1457b.R has been updated, to spit out times as decoded by oce. The final 3 lines of output from that are now
which suggests that this code is getting the time right. If SBE is using the name |
Sorry, @pettipasrg, I now see that you were doing a test of JD wrapping, not JD start time. QUESTION: does the SBE JD always start at 1? (I think that's the matlab convention. If we know that this is always the case, then I'll code in so that the |
In my experience (I wish I could easily find documentation) it starts at day 1. But here's another wrinkle, I haven't seen it (here) before but it is an option in the Seabird time format. name 3 = timeK: Time, Instrument [seconds]I tried this and got records (the fourth column is the time)
Since the first record is 24-Apr-2018 15:00, that means that the zero time is 01-Jan-2000, so elapsed seconds since 01-Jan-2000. The sampling interval of this instrument is 10 minutes so the numbers make sense. |
Yes, |
Hm. I wonder if any of the BIO people in this thread can suggest some flag in the |
I found the following in an old SBE19 file
Can't say for sure that it would be representative of a newer file. I'll ask around! |
Pages 28, 34, 36 and 38 of SBE Data Processing have examples. |
Dear reporter, Do you think this issue (as defined by its title) has been addressed? If so, please close it. If not, please add a comment explaining what remains to be done. Thanks! PS. This is a standardized reply. |
Test code works for me. Closing this, but @pettipasrg can re-open it if need be. |
Thanks, @clayton33 . To @pettipasrg if you run the code at https://github.com/dankelley/oce-issues/blob/master/14xx/1457/1457c.R you'll see that this works quite well. The temporal variability in the second of the two plots produced by that code (i.e. the plot showing only at-depth data) makes me think this is a pretty neat dataset! |
The example from yesterday had no time field in the data portion, so the time was determined from the header. I asked around and we can't find any SBE data files with the mode set to "MOORED". |
I don't know of any reliable header field that indicates what the You could guess the deployment type by the instrument type, but I don't think that's worth the work (e.g. an SBE37 is almost always used as a moored instrument, and an SBE19/25 is almost always a profiling instrument) |
Short summary of problem
Unable to read SeaBird MicroCAT cnv files created with firmware version 3. As of now, oce is able to read cnv files from this instrument that were created with firmware version 2.
Related, but un-related to this issues, is read.ctd.sbe intended/suitable to read moored CTD data ?
Trimmed files have been sent privately in an e-mail, data are OK to be public for testing purposes.
What you did
How urgent is this?
Not urgent. This can wait a few days
Output from sessionInfo()
The text was updated successfully, but these errors were encountered: