forked from dankelley/oce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
odf_01.R
21 lines (18 loc) · 904 Bytes
/
odf_01.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
library(oce)
options(warn=1) # print warnings as they occur
dir <- "/data/FlemishCap"
files <- system(sprintf("find '%s' -name '*.ODF'", dir), intern=TRUE)
i <- 0
for (file in files) {
cat("\n# ", file, "\n")
d <- read.oce(file)
summary(d) # VISUALLY: check .out file for incorrect units or unmatched names
if ("temperature" %in% names(d[["data"]]) && min(d[["temperature"]], na.rm=TRUE) < -5)
stop("bad min temperature in file '", file,
"'; value is ", min(d[["temperature"]], na.rm=TRUE), "; did read.oce() catch the NullValue?")
if ("u" %in% names(d[["data"]]) && min(d[["u"]], na.rm=TRUE) < -5)
stop("bad min u in file '", file,
"'; value is ", min(d[["u"]], na.rm=TRUE), "; did read.oce() catch the NullValue?")
i <- i + 1
}
cat("Successfully checked", i, "ODF files in various subdirectories of ", dir, "\n")