Closed dankelley closed 1 year ago
The following sheds some light. (NOTE: I am not going to attempt to explain things a lot in this issue. I'm using comments as notes to myself.)
library(oce)
#> Loading required package: gsw
library(ocencdf)
data(adv, package="oce")
data(ctd, package="oce")
dput(adv@data$timeBurst[1])
#> structure(NA_real_, class = c("POSIXct", "POSIXt"), tzone = "UTC")
ctd2ncdf(ctd)
#> Converting temperature from IPTS-68 scale to ITS-90 scale.
dput(adv@data$timeBurst[1])
#> structure(NA_real_, class = c("POSIXct", "POSIXt"), tzone = "UTC")
Created on 2023-06-29 with reprex v2.0.2
It's not the mere existence of ncdf4 calls that causes the problem, as this stripped-down example shows.
Hm, I tried a test in which I just didn't specify missval
when I call ncvar_def()
, and now the test code works.
Frankly, I don't see any need to even set a particular missval
-- why not let netcdf decide on that -- and so I'll just use the missing_value
in the varTable when reading the data. Data matching that will get set to NA.
Fixed in develop branch
commit fdcd0c5a47543b3bab2b0704ad5535ca99b86615 Author: dankelley kelley.dan@gmail.com Date: Thu Jun 29 11:51:34 2023 -0300
fix problem with missing-values (issue 14)
I see a problem (illustrated below) and will look into it. Notice the last few lines: R does not recognize the NA values in the
adv
object until I reload it. It seems thatadv2ncdf()
is altering the object.Created on 2023-06-29 with reprex v2.0.2