x <- read.oce(system.file("extdata", "ctd.cnv", package="oce"),debug=10)
source('~/src/R-kelley/oce/R/ctd.R');source('~.src/R-kelley/oce/R/ctd.R');x <- read.oce(system.file("extdata", "ctd.cnv", package="oce"),debug=10)
source('~/src/R-kelley/oce/R/ctd.R');source('~/src/R-kelley/oce/R/ctd.R');x <- read.oce(system.file("extdata", "ctd.cnv", package="oce"),debug=10)
pressure
waterDepth
names(d)
names(data)
data
source('~/src/R-kelley/oce/R/oce.R');source('~/src/R-kelley/oce/R/ctd.R');x <- read.oce(system.file("extdata", "ctd.cnv", package="oce"),debug=10)
plot(x)
plot(x, which=c(1,2,3,5))
system.file("extdata", "ctd.cnv", package="oce")
readLines(system.file("extdata", "ctd.cnv", package="oce"))
readLines(system.file("extdata", "ctd.cnv", package="oce"))[1:23]
readLines(system.file("extdata", "ctd.cnv", package="oce"))[1:33]
readLines(system.file("extdata", "ctd.cnv", package="oce"))[1:99]
readLines(system.file("extdata", "ctd.cnv", package="oce"))[1:88]
readLines(system.file("extdata", "ctd.cnv", package="oce"))[1:77]
readLines(system.file("extdata", "ctd.cnv", package="oce"))[1:55]
readLines(system.file("extdata", "ctd.cnv", package="oce"))[1:42]
ctd@metadata
str(ctd@metadata$systemUploadTime)
d
decodeTime(d)
ll
lline
d <- sub("([^=]*)[ ]*=[ ]*", "", ignore.case=TRUE, lline);
systemUploadTime <- decodeTime(d)
systemUploadTime
source('~/src/R-kelley/oce/R/processingLog.R');source('~/src/R-kelley/oce/R/oce.R');source('~/src/R-kelley/oce/R/ctd.R');x <- read.oce(system.file("extdata", "ctd.cnv", package="oce"),debug=10)
ctd[["startTime"]]
names(ctd@metadata)
ctd@metadata$systemUploadTime
source('~/src/R-kelley/oce/R/processingLog.R');source('~/src/R-kelley/oce/R/oce.R');source('~/src/R-kelley/oce/R/ctd.R');ctd <- read.oce(system.file("extdata", "ctd.cnv", package="oce"),debug=10)
str(ctd)
str(ctd@metadat)
str(ctd@metadata)
ctd[["systemUploadTime"]]
ctd <- read.oce("ctd.cnv")
ctd[["startTime"]]<-ctd[["systemUploadTime"]]
summary(ctd)
save(ctd, file="../oce/data/ctd.rda")
save(ctd, file="~/src/R-kelley/oce/data/ctd.rda")
?ctree
]data(adp)#
par(mfrow=c(2,1))#
imagep(adp[['v']][,,1])#
imagep(adp[['v']][,,1], filledContour=T)
data(adp)#
par(mfrow=c(2,1))#
imagep(adp[['v']][,,1])#
imagep(adp[['v']][,,1], filledContour=T)
source("/tmp/r-plugin-kelley/Rsource-74775-decision_tree.R", echo=TRUE)
?ctd
plot(ctd)
dev.new()
data(ctd.raw)
data(ctdraw)
data(ctdRaw)
plot(ctdRaw)
t<-as.POSIXct("2011-12-03", "2011-12-10", "2012-01-14", "2012-01-28")
plot(t,kWh)
length(t)
t
t<-as.POSIXct(c("2011-12-03", "2011-12-10", "2012-01-14", "2012-01-28"))
kWh <- c(938, 936, 924, 926)
plot(t, kWh)
plot(t, kWh, ylim=c(0, max(kWh)))
plot(t, kWh, ylim=c(0, max(kWh)), type='s')
oce.plot.ts(t, kWh, ylim=c(0, max(kWh)), type='s', xlab="", ylab="kWh between midnight and 6AM")
grid()
source("/tmp/r-plugin-kelley/Rsource-7514-fridge.R", echo=TRUE)
example(adp)
plot(adp, which='a1')
lines(adp[["time"]], adp[["pressure"]])
lines(adp[["time"]], adp[["pressure"]], col='white',lwd=3)
lines(adp[["time"]], adp[["pressure"]]*cos(20*pi/180), col='red',lwd=3)
lines(adp[["time"]], adp[["pressure"]]/cos(20*pi/180), col='red',lwd=3)
lines(adp[["time"]], adp[["pressure"]]/cos(0*pi/180), col='blue',lwd=3)
?solarangle
?sunAngle
1023*9.9
1023*9.8
lines(adp[["time"]], 1.0025adp[["pressure"]]/cos(0*pi/180), col='blue',lwd=3)
lines(adp[["time"]], 1.0025*adp[["pressure"]]/cos(0*pi/180), col='green',lwd=3)
library(oce)#
beam <- read.oce("/data/archive/sleiwex/2008/moorings/m09/adp/rdi_2615/raw/adp_rdi_2615.000",#
from=as.POSIXct("2008-06-26", tz="UTC"),  to=as.POSIXct("2008-06-27", tz="UTC"),  by="10:00", #
latitude=47.88126, longitude=-69.73433)#
plot(beam, which='u1')#
lines(beam[["time"]], beam[["pressure"]], lwd=3, col='blue')#
lines(beam[["time"]], beam[["pressure"]]/cos(20*pi/180), lwd=3, col='green')
unit<-c(0,0)
beamAngle<-20
bin1Distance <- 2.23
binSize <- 0.5
bins<-1:84
bins<-1:10
distance<-bin1Distance+bins*binSize
plot(distance*sin(beamAngle*pi/180), distance*cos(beamAngle*pi/90), asp=1)
points(unit)
unit
plot(distance*sin(beamAngle*pi/180), distance*cos(beamAngle*pi/90), asp=1, ylim=c(0,6))
points(unit[1], unit[2])
abline(v=0)
points(1:10, 1:10, pch=1:10)
plot(1:10, 1:10, pch=1:10)
plot(1:10, 1:10, pch=10+1:10)
source("/tmp/r-plugin-kelley/Rsource-29243-adp_geometry.R", echo=TRUE)
help('adp-class','oce')
?adp
beam <- read.oce(#
"/data/archive/sleiwex/2008/moorings/m09/adp/rdi_2615/raw/adp_rdi_2615.000",#
from=as.POSIXct("2008-06-26", tz="UTC"), #
to=as.POSIXct("2008-06-27", tz="UTC"),#
by="10:00", #
latitude=47.88126, longitude=-69.73433)#
xyz <- beamToXyzAdp(beam)#
adp <- xyzToEnuAdp(xyz, declination=-18.1)
names(adp@metadata)
adp[["metadata"]]
str(adp[["metadata"]])
d<-adp
adp[["numberofBeams"]]
adp[["numberOfBeams"]]
plot(adp)
save(adp, file='~/src/R-kelley/oce/data/adp.rda')
source("/tmp/r-plugin-kelley/Rsource-95517-roast.R", echo=TRUE)
plot(adp, which='u1')
plot(adp, which='u1', color=oceColorsSomething)
?plot.adp
png('l.png');plot(adp, which='u1', col=oceColorsSomething);dev.off()
system('open .')
oceColorsSomething <- function(n)#
{#
if (missing(n) || n <= 0)#
colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",#
"white", "ffe45e", "#FF7F00", "red", "#7F0000"))#
else {#
colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",#
"white", "ffe45e", "#FF7F00", "red", "#7F0000"))(n)#
}#
}
oceColorsSomething <- function(n)#
{#
if (missing(n) || n <= 0)#
colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",#
"white", "#ffe45e", "#FF7F00", "red", "#7F0000"))#
else {#
colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",#
"white", "#ffe45e", "#FF7F00", "red", "#7F0000"))(n)#
}#
}
plot(adp, which='u1', col=oceColorsSomething)
oceColorsSomething <- function(n)#
{#
if (missing(n) || n <= 0)#
colorRampPalette(c("#00007F", "blue", "#007FFF", "#22e4e7",#
"white", "#ffe45e", "#FF7F00", "red", "#7F0000"))#
else {#
colorRampPalette(c("#00007F", "blue", "#007FFF", "#22e4e7",#
"white", "#ffe45e", "#FF7F00", "red", "#7F0000"))(n)#
}#
}
dev.new();plot(adp, which='u1', col=oceColorsPalette)
oceColorsSomething <- function(n)#
{#
if (missing(n) || n <= 0)#
colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",#
"white", "yellow", "#FF7F00", "red", "#7F0000"))#
else {#
colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",#
"white", "yellow", "#FF7F00", "red", "#7F0000"))(n)#
}#
}
dev.new();plot(adp, which='u1', col=oceColorsSomething)
a9a<-3
a9a
plot(adp, which='u1', col=oceColors9A)
plot(adp, which='u1', col=oceColors9B)
source('~/src/R-kelley/oce/R/oce.R')
par(mfrow=c(2,1)); plot(adp, which='u1', col=oceColorsJet);plot(adp, which='u1', col=oceColors9B)
par(mfrow=c(1,2)); plot(adp, which='u1', col=oceColorsJet);plot(adp, which='u1', col=oceColors9B)
par(mfrow=c(1,3));plot(adp, which='u1'); plot(adp, which='u1', col=oceColorsJet);plot(adp, which='u1', col=oceColors9B)
par(mfrow=c(3,1));plot(adp, which='u1'); plot(adp, which='u1', col=oceColorsJet);plot(adp, which='u1', col=oceColors9B)
9.8*1024
edit(swDepth)
data(adp)
35*.00069
1.02 - 35*.00069
1.02 - 34*.00069
1.02 - 36*.00069
1.02 - 40*.00069
1.02 - 30*.00069
1.02 - 20*.00069
1.02 - 25*.00069
library(oce);data(adp);distance<-adp[["distance"]];time<-adp[["time"]];par(mfrow=c(2,1));plot(adp,which='u1');x <- rep(time, times=length(distance));plot(adp,whic='u1');y <- rep(distance, each=length(time));points(x,y,cex=ifelse(as.vector(na), 1, 0),pch=20,col='gray')
?rect
time[1]
dtime <- as.numeric(time[2]) - as.numeric(time[1])
ddistance <- distance[2] - distance[1]
dim(na)
length(x)
prod(dim(na))
source("/tmp/r-plugin-kelley/Rsource-54852-missing.R", echo=TRUE)
image(time,distance,is.na(adp[["v"]][,,1]),add=TRUE)
?image
image(time,distance,!is.na(adp[["v"]][,,1]),add=TRUE)
plot(adp,which='u1')
image(time,distance,!is.na(adp[["v"]][,,1]),col=c("gray", "transparent"),add=TRUE)
source('~/src/R-kelley/oce/R/imagep.R'); plot(adp,which='u1')
source('~/src/R-kelley/oce/R/imagep.R'); plot(adp,which='u1', missingColor='red')
source('~/src/R-kelley/oce/R/imagep.R'); plot(adp,which='u1', missingColour='red')
source('~/src/R-kelley/oce/R/adp.R');source('~/src/R-kelley/oce/R/imagep.R'); plot(adp,which='u1', missingColor='red')
source('~/src/R-kelley/oce/R/adp.R');source('~/src/R-kelley/oce/R/imagep.R'); plot(adp,which='u1', missingColor='gray')
plot(adp, which=1:3, missingColor="gray")
abline(v=as.POSIXct('2008-06-26 06:00:00',tz='UTC'),col='green',lwd=3)
lines(time(x), pressure(x), lwd=3, col='blue')
plot(adp, which=1:2,
missingColor='gray',
adorn=expression({
lines(x[["time"]], x[["pressure"]], lwd=3, col='blue')
}))
plot(adp, which=1, missingColor='gray',
plot(adp, which='b1', missingColor='gray',
plot(adp, which='a1', missingColor='gray',
source('~/src/R-kelley/oce/R/imagep.R')
plot(adp, which=5, missingColor='gray',
adorn=expression({ lines(x[["time"]], x[["pressure"]], lwd=3, col='blue') }))
source('~/src/R-kelley/oce/R/imagep.R');plot(adp, which=5, missingColor='gray')
sum(na)
length(na)
sum(na)/length(na)
sum(is.na(z))
sum(is.na(z))/length(is.na(z))
missingColor
image(x=x, y=y, z=is.na(z), col=c(missingColor, "transparent"), add=TRUE)
image(x=x, y=y, z=is.na(z), col=c(missingColor, "transparent"), breaks=c(0,1), add=TRUE)
image(x=x, y=y, z=z, axes=FALSE, xlab="", ylab=ylab, col=col,
xlim=xlim, ylim=ylim, zlim=zlim, ...)
box()
image(x=x, y=y, z=is.na(z), col=c(missingColor, "transparent"), breaks=c(0,1,2), add=TRUE)
image(x, y, is.na(z), col=c(missingColor, "transparent"), breaks=c(0,1,2), add=TRUE)
image(x, y, !is.na(z), col=c(missingColor, "transparent"), breaks=c(0,1,2), add=TRUE)
image(x, y, as.numeric(is.na(z)), col=c(missingColor, "transparent"), breaks=c(0,1,2), add=TRUE)
dim(is.na(z))
class(is.na(z))
is.na(z)[1,1]
is.na(z)[1,1]+0
image(x, y, 0+is.na(z), col=c(missingColor, "transparent"), breaks=c(0,1,2), add=TRUE)
image(x, y, 0+!is.na(z), col=c(missingColor, "transparent"), breaks=c(0,1,2), add=TRUE)
image(x, y, is.na(z), col=c(missingColor, "transparent"), breaks=c(0,1/2,1), add=TRUE)
source('~/src/R-kelley/oce/R/adp.R');source('~/src/R-kelley/oce/R/imagep.R');plot(adp, which=1, missingColor='gray')
source('~/src/R-kelley/oce/R/adp.R');source('~/src/R-kelley/oce/R/imagep.R');plot(adp, which=2, missingColor='gray')
source('~/src/R-kelley/oce/R/adp.R');source('~/src/R-kelley/oce/R/imagep.R');plot(adp, which=3, missingColor='gray')
source('~/src/R-kelley/oce/R/adp.R');source('~/src/R-kelley/oce/R/imagep.R');plot(adp, which=4, missingColor='gray')
source('~/src/R-kelley/oce/R/adp.R');source('~/src/R-kelley/oce/R/imagep.R');plot(adp, which=5, missingColor='gray')
source('~/src/R-kelley/oce/R/adp.R');source('~/src/R-kelley/oce/R/imagep.R');plot(adp, which=6, missingColor='gray')
source('~/src/R-kelley/oce/R/adp.R');source('~/src/R-kelley/oce/R/imagep.R');plot(adp, which=7, missingColor='gray')
load("/data/archive/sleiwex/2008/moorings/m08/adp/sontek_c360/r/m08_adp_enu.rda")
plot(m08AdpEnu)
d<-read.oce('/Users/kelley/data/sleiwex/2008/SLEIWEX2008data/2008-06-25/Merlu/Biosonics/20080625_193528.dt4')
d<-subset(d, depth<10)
?plot.echosounder
dev.new(); plot(d, which=2, atTop=seq(as.POSIXct("2008-06-25 19:35:30",tz="UTC"),as.POSIXct("2008-06-25 19:40:00",tz="UTC",by="10")))
seq(as.POSIXct("2008-06-25 19:35:30",tz="UTC"),as.POSIXct("2008-06-25 19:40:00",tz="UTC",by=10)
seq(as.POSIXct("2008-06-25 19:35:30",tz="UTC"),as.POSIXct("2008-06-25 19:40:00",tz="UTC"),by=10)
at<-seq(as.POSIXct("2008-06-25 19:35:30",tz="UTC"),as.POSIXct("2008-06-25 19:40:00",tz="UTC"),by=10)
plot(d, which=2, atTop=at)
plot(d, which=2, atTop=at,format="%M:%S")
example(formatPosition)
example(echosounder)
dev.off()
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=oceColorsPalette)
?oceColorsJet
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=oceColors9A)
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=oceColors9B)
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors)
?gray.colors
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(start=0))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(n=10,start=0))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(n=100,start=0,end=1))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(n=100,start=0,end=1,gamma=3))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(n=100,start=0,end=1,gamma=.3))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(n=100,start=0,end=1,gamma=10))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(n=100,start=0,end=1,gamma=2))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(n=100,start=0,end=.3,gamma=2))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(n=100,start=0.3,end=1,gamma=2))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(n=100,start=0.3,end=1,gamma=1))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(n=100,start=0.3,end=1,gamma=.91))
h<-hist(echosounder[["a"]],plot=FALSE)
h<-hist(echosounder[["a"]],plot=FALSE)$counts
h<-hist(echosounder[["a"]],breaks=100,plot=FALSE)$counts
h<-hist(echosounder[["a"]],breaks=1000,plot=FALSE)$counts
h
plot(h)
plot(h,type='l')
h<-hist(echosounder[["a"]],breaks=256,plot=FALSE)$counts
plot(cumsum(h))
plot(cumsum(h),type='l')
hh<-cumsum(h)/sum(h)
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray(hh))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray[256](256*hh))
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray(256)[256*hh])
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=gray.colors(256)[256*hh])
plot(256*hh)
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=oceColorsJet(256)[256*hh])
plot(hh)
col<-gray(0.1+0.8*hh)
plot(echosounder, which=2, drawBottom=TRUE, atTop=pretty(echosounder[["time"]]),col=col)
plot(1:256,col=col)
col
substitute(expression(degrees*degree), list(degree=90))
plot(1,1);text(1,1.1,substitute(expression(degrees*degree), list(degree=90)))
plot(1,1);text(1,1.1,expression(substitute(degrees*degree, list(degree=90)))
plot(1,1);text(1,1.1,expression(substitute(degrees*degree, list(degrees=90)))))
plot(1,1);text(1,1.1,expression(substitute(degrees*degree, list(degrees=90))))
plot(1,1);text(1,1.1,substitute(degrees*degree, list(degrees=90)))
plot(1,1);text(1,1.1,substitute(degrees*degree, list(degrees=1,minutes=2,seconds=3.4)))
plot(1,1);text(1,1.1,substitute(degrees*degree*phantom(.)*minutes*minute*phantom(.)*seconds*second, list(degrees=1,minutes=2,seconds=3.4)))
formatPosition(echosounder[["latitude"]])
lab<-formatPosition(echosounder[["latitude"]])
str(lab)
lab<-formatPosition(pretty(echosounder[["latitude"]]))
lab
source('~/src/R-kelley/oce/R/misc.R');formatPosition(pretty(echosounder[["latitude"]]))
as.list(f)
as.expression(f)
vector("expression",3)
f[1]
f[[1]]
source('~/src/R-kelley/oce/R/misc.R');f<-formatPosition(pretty(echosounder[["latitude"]]))
f
length(f)
source('~/src/R-kelley/oce/R/misc.R');f<-formatPosition(pretty(echosounder[["latitude"]]),t="e")
plot(1:10,1:10, type='n'); text(1:10, 1:10, f)
plot(1:10,1:10, type='n')
mtext(side=3, at=1:10, labels=f)
mtext(side=3, at=1:10, text=f)
plot(echosounder)
plot(echosounder, showTimeRange=FALSE)
f <- formatPosition(pretty(echosounder[["latitude"]]), type="expression")
lats <- pretty(echosounder[["latitude"]])
f <- formatPosition(lats, type="expression")
data(echosounder)
plot(echosounder, drawTimeRange=FALSE)
lat <- pretty(echosounder[["latitude"]])
latlab <- formatPosition(lat, type="expression")
mtext(side=3, at=lat, text=latlab)
lat
lat <- pretty(coastlineHalifax[["latitude"]])
lon <- pretty(coastlineHalifax[["lonitude"]])
lon <- pretty(coastlineHalifax[["longitude"]])
?pretty()
?round
round(pi)
round(pi,3)
round(pi,2)
source('~/src/R-kelley/oce/R/misc.R')
data(coastlineHalifax)
rug(lon,side=3)
?rug
par('ticksize')
mtext(side=3, at=lon, text=lonlab)
mtext(side=3, at=lon, text=lonlab, line=par('mgp')[1])
mtext(side=3, at=lon, text=lonlab, line=par('mgp')[2])
mtext(side=1, at=lon, text=lonlab, line=2)
rug(lon,side=3, ticksize=-0.03)
rug(lon,side=1, ticksize=-0.03, col='red')
plot(coastlineHalifax)
lon <- pretty(coastlineHalifax[["longitude"]], n=3)
lonlab <- formatPosition(lon, type="expression")
mtext(side=1, at=lon, text=lonlab, line=2, col='red')
rug(lon,side=1, ticksize=-0.03, col='red', lwd=3)
d<-read.adp("/data/archive/sleiwex/2008/moorings/m09/adp/rdi_2615/raw/adp_rdi_2615.000")
d<-read.oce("/data/archive/sleiwex/2008/moorings/m09/adp/rdi_2615/raw/adp_rdi_2615.000")
d<-read.adp.rdi("/data/archive/sleiwex/2008/moorings/m09/adp/rdi_2615/raw/adp_rdi_2615.000")
d<-read.adp.rdi("/data/archive/sleiwex/2008/moorings/m09/adp/rdi_2615/raw/adp_rdi_2615.000",from=1,to=1000)
x11()
plot(d)
d<-read.adp.rdi("/data/archive/sleiwex/2008/moorings/m09/adp/rdi_2615/raw/adp_rdi_2615.000",from=1,to=10000)
plot(d, which='pressure')
dev.new(); hist(d[["pressure"]],breaks=100)
??swSoundSpeed
swSoundSpeed(35,10)
swSoundSpeed(30,20)
ls()
d[["metadata"]]
swSoundSpeed(30,10)
100*(swSoundSpeed(30,10)-1500)/1500
100*(swSoundSpeed(28,10)-1500)/1500
100*(swSoundSpeed(28,9)-1500)/1500
100*(swSoundSpeed(28,4)-1500)/1500
100*(swSoundSpeed(27,4)-1500)/1500
100*(swSoundSpeed(23,6)-1500)/1500
??bibentry
par('mfg') <- c(3,3,1,1)
par('mfg') <- c(1,2,1,2)
par('mfrow')
par('mfrow')<-c(2,2)
par(mfrow=c(2,2))
par('mfg')
par(mfg=c(1,2,1,2))
par(mfg=c(1,2,2,2))
plot(1:3)
source("/tmp/r-plugin-kelley/Rsource-75712-test.R", echo=TRUE)
?par
par()
source("/tmp/r-plugin-kelley/Rsource-83358-test.R", echo=TRUE)
par()$mfcol
par()$mfrow
par()$mfg
setwd("/Users/kelley/oar")
?x11
plot(3)
?teos
sp <- ctd[["salinity"]]
temperature <- ctd[["temperature"]]
n <- length(sp)
p <- ctd[["pressure"]]
lat <- rep(ctd[["latitude"]], n)
lon <- rep(ctd[["longitude"]], n)
sa <- teos("gsw_sa_from_sp", sp, p, lon, lat)
plot(ctd, which="salinity", col.salinity="black")
plot(ctd, which="density", col.density="black")
?plot.ctd
plot(ctd, which="density", col.rho="black")
plotProfile(ctd, which="density", col.rho="black")
plotProfile(ctd, "salinity", col.salinity="black")
lines(sa, p, lty='dotted')
plotProfile(ctd, "density", col.rho="black")
rhopot <- teos("gsw_pot_rho_t_exact", sa, temperature, p, rep(0,length(p)))
lines(rhopot - 1000, p, lty='dotted')
contour(x, y, outer(x, y, psi))
contour(x, y, outer(x, y, function(x, y) sin(pi * x) * sin(pi * y))
x <- seq(0, 1, length.out=100)
y <- seq(0, 1, length.out=100)
psi <- function(x, y)
sin(pi * x) * sin(pi * y)
z <- outer(x, y, psi)
contour(x, y, z)
z <- outer(x, y, function(x, y) sin(pi * x) * sin(pi * y))
contour(x<-seq(0,1, length.out=100),
y<-seq(0,1, length.out=100),
outer(x, y, function(x, y) sin(pi * x) * sin(pi * y))
)
x
d <- as.ctd(salinity, temperature, pressure, longitude=longitude, latitude=latitude)
SA <- swAbsoluteSalinity(salinity, pressure, longitude, latitude)
CT <- swConservativeTemperature(salinity, temperature, pressure)
points(SA[eastern], CT[eastern], cex=3/4, pch=20)
gridsize <- c(100, 100)
bandwidth  <- 3 * c(diff(range(SA)), diff(range(CT))) / gridsize
library(KernSmooth)
pData <- bkde2D(cbind(SA, CT),
pDataGivenMed <- bkde2D(cbind(SA[eastern], CT[eastern]),
gridsize=gridsize, bandwidth=bandwidth,
range.x=list(range(SA), range(CT)))
pData$fhat <- pData$fhat / max(pData$fhat, na.rm=TRUE)
pDataGivenMed$fhat <- pDataGivenMed$fhat / max(pDataGivenMed$fhat, na.rm=TRUE)
plotTS(d, eos='teos', col="gray", pch=20, cex=3/4)
br <- par('usr')[c(2,3)]
rect(br[1]-bandwidth[1], br[2], br[1], br[2]+bandwidth[2])
level <- c(0.01, 0.02, 0.05)
contour(pData$x1, pData$x2, pData$fhat, add=TRUE,
level=level, drawlabels=FALSE)#, lty=c(3, 2, 1), lwd=1.5)
eastern <- as.ctd(salinity[easter], temperature[eastern], pressure[eastern],
eastern <- as.ctd(salinity[eastern], temperature[eastern], pressure[eastern],
latitude=latitude[eastern], longitude=longitude[eastern])
plotTS(eastern, eos='teos', col='gray')
contour(pDataGivenMed$x1, pDataGivenMed$x2, pDataGivenMed$fhat, add=TRUE,
level=level, drawlabels=FALSE,
lty=c(3, 2, 1), lwd=1)
pMedGivenData <- pDataGivenMed$fhat / pData$fhat
pMedGivenData[pData$fhat < 1e-4] <- 0
pMedGivenData <- pMedGivenData / max(pMedGivenData, na.rm=TRUE) # normalize
plotTS(all, eos='teos', col="gray")
contour(pData$x1, pData$x2, pMedGivenData, level=c(0.8, 0.9),
add=TRUE,
lty=c("dashed", "solid"), drawlabels=FALSE)
n <- length(salinity)
x <- unlist(lapply(1:n,
function(i) which.min(abs(salinity[i] - pData$x1))))
y <- unlist(lapply(1:n,
function(i) which.min(abs(temperature[i] - pData$x2))))
p <- unlist(lapply(1:n,
function(i) pMedGivenData[x[i],y[i]]))
isMed <- p > 0.9
plot(a03, which="data", xtype="longitude", ylim=ylim, cex=3/4, pch=20, col="gray")
points(longitude[isMed], -pressure[isMed], cex=3/4, pch=20)
plotTS(all, eos='teos', col="gray", pch=20, cex=3/4)
points(SA[isMed], CT[isMed], cex=3/4, pch=20)
data(a03)
a03 <- subset(a03, latitude < 36.3)
par(mfrow=c(1,2))
ylim <- c(6000, 0)
plot(a03, which="data", xtype="longitude", ylim=ylim,
cex=3/4, pch=20, col="gray")
latitude <- a03[["longitude"]]
longitude <- a03[["longitude"]]
eastern <- (-40) < longitude
pressure <- a03[["pressure"]]
points(longitude[eastern], -pressure[eastern], cex=3/4, pch=20)
options(eos="teos")
salinity <- a03[["salinity"]]
temperature <- a03[["temperature"]]
all <- as.ctd(salinity, temperature, pressure, longitude=longitude, latitude=latitude)
plotTS(all, col="gray", pch=20, cex=3/4)
library(oce)
dTemperature <- temperature(ctd)-swTheta(ctd)
summary(dTemperature)
plot(dTemperature, swZ(ctd), type='l',
xlab=expression(paste(T - theta, " [", degree, "C]")),
ylab="z [m]")
data(ctd)
t <- temperature(ctd)                  # or ctd[["temperature"]]
pottemp <- swTheta(ctd)
CT <- swConservativeTemperature(ctd)   # or ctd[["CT"]]
plotProfile(ctd, which="temperature")
help(plotProfile)
lines(CT, p, lty="dashed")
lines(theta, p, lty="dotteded")
theta <- swTheta(ctd)
lines(theta, p, lty="dotted")
par(mfrow=c(3,1))
par(mfrow=c(1,3))
plot(t - theta, p)
plot(t - CT, p)
plotProfile(ctd, xtype="temperature")
p <- pressure(ctd)                     # or ctd[["pressure"]]
plot(t - theta, p, type='l')
plot(t - CT, p, type='l')
grep("\\+", "dan")
grep("\\+", "dan+boy")
grep("\\+", 33)
source('~/src/R-kelley/');plotProfile(ctd, xtype="temperature")
theta
source('~/src/R-kelley/');plotProfile(ctd, xtype=temperature-theta)
plot.default
temperature
source('~/src/R-kelley/');plotProfile(ctd, xtype=t-theta)
xtype
class(xtype)
is.vector(xtype)
length(xtype)
Q
?plotProfile
?plot.default
source('~/src/R-kelley/oce/R/ctd.R');plotProfile(ctd, xtype=t-theta)
source('~/src/R-kelley/oce/R/ctd.R');plotProfile(ctd, xtype=t-theta,xlab="dan")
source('~/src/R-kelley/oce/R/ctd.R');plotProfile(ctd, xtype=t-theta,xlab=t-theta)
source('~/src/R-kelley/oce/R/ctd.R');plotProfile(ctd, xtype=t-theta,xlab="t-theta")
source('~/src/R-kelley/oce/R/ctd.R');plotProfile(ctd, xtype=t-theta,xlab=expression(t-theta))
setwd("/Users/kelley/src/R-kelley/oce/inst/doc")
q()
