# NOT RUN {
library(oce)
# Read a CTD cast made on the Scotian Shelf. Note that the file's metadata
# states that conductivity is in S/m, but it is really conductivity ratio,
# so we must alter the unit before converting to a CTD object. Note that
# read.odf() on this data file produces a warning suggesting that the user
# repair the unit, using the method outlined here.
odf <- read.odf(system.file("extdata", "CTD_BCD2014666_008_1_DN.ODF", package="oce"))
odf[["conductivityUnit"]] <- list(unit=expression(), scale="")
#
# Figure 1. make a CTD, and plot (with span to show NS)
plot(as.ctd(odf), span=500)
# Figure 2. highlight bad data on TS diagram
plotTS(odf, type='o') # use a line to show loops
bad <- odf[["QCFlag"]]!=0
points(odf[['salinity']][bad],odf[['temperature']][bad],col='red',pch=20)
# }
Run the code above in your browser using DataLab