R Program

This program tabulates Pacific Ocean Shelf Tracking (POST) and Ocean Tracking Network (OTN) reports and plans. These tables are used to predict and graph the # of tags and instruments for the period 2008-20. These predictions are then used to estimate storage needs (GBytes). The R programming environment can be obtained at - http://www.r-project.org/

# R Branton 2008/03

# estimate OTN data collection and storgare needs

rm(list=ls(all=TRUE))
par(mfrow=c(3,2))

# POST tags and detections

tags<-c(1012,1326+516+76,988+2709+13)
tags<-c(tags,sum(tags))
detects<-c(293206,480007+4234+3584,350140+260323+115)
detects<-c(detects,sum(detects))
detects.per.tag<-floor(detects/tags)
tags<-rbind(tags,detects,detects.per.tag)
dimnames(tags)[2]<-list(c(2004,2005,2006,"sum"))

tags # table 1

# Project storage based on # of tags

years<-c(2004:2006,2014,2020)
tags<-c(tags[1,1:3],250000,1000000)
plot(years,tags/1000,xlab="",ylab="1000s of tags",main="1) acoustic tags") # fig 1
years2<-2004:2020
tags2<-exp(predict(lm(log(tags)~years),data.frame(years=years2)))
lines(years2,tags2/1000)
bytes<-tags2*detects.per.tag[4]*250
plot(years2,cumsum(bytes)/10^9,type="l",xlab="",ylab="Giga Bytes",main="2) cumulative storage") # fig 2
text(2010,150,paste("total=",round(sum(bytes)/10^9,1),"GB"))

# instrument count estimates

plan<-data.frame(
instrument=c("ultrasonic receivers","archival tags","benthic pods"),
capacity=c(8,64,1024),
count.1=c(164,600,4),
count.2=c(1400,2500,50)
)

years<-c(2008,2010)
years2<-2008:2020

estimates<-NULL
for(i in 1:3){
counts<-c(plan$count.1[i],plan$count.2[i])
estimate<-predict(lm(counts~years),data.frame(years=years2))
estimates<-rbind(estimates,estimate*plan$capacity[i])
plot(years2,estimate,xlab="",ylab="# of instruments",main=paste(i+2,") ",plan$instrument[i],sep=""),type="l") # figs 3-5
}

estimates<-rbind(estimates,apply(estimates,2,sum))/10^3
plot(years2,cumsum(estimates[4,]),xlab="",ylab="Giga Bytes",main="6) cumulative storage",type="l") # fig 6
text(2012,5000,paste("total=",round(sum(estimates[4,])),"GB"))

dimnames(plan)[2]<-list(c("type","capacity MB",years))
plan # table 2

estimates<-cbind(estimates,apply(estimates,1,sum))
estimates<-rbind(estimates,cumsum(estimates[4,]))
dimnames(estimates)[1]<-list(c(as.character(plan[,1]),"combined","cumulative"))
dimnames(estimates)[2]<-list(c(years2,"sum"))
estimates["cumulative","sum"]<-NA
print(round(estimates+.5),na.print="") # table 3