Department of Oceanography and Hydrography
Bangabandhu Sheikh Mujibur Rahman Maritime University,Bangladesh
Email

Abstract
The oce package makes it easy to read, summarize and plot data from a variety of Oceanographic instruments, isolating the researcher from the quirky data formats that are common in this field. It also provides functions for working with basic seawater properties such as the equation of state, and with derived quantities such as the buoyancy frequency. Although simple enough to be used in a teaching context, oce is powerful enough for a research setting. These things are illustrated here, in the context of some practical examples. Worked examples are provided, in order to help readers take early steps towards using the oce package in their research. Author:Dan E. Kelly

We will use Ocepackage for this analysis.

load the package

library(oce)

load the data from package oce

data("ctd")

Now,Plot the data to get a summmary

plot(ctd)
top left=Temperature and salinity curve,top right=Density curve,bottom left=T-S diagram,bottom right=Station location

top left=Temperature and salinity curve,top right=Density curve,bottom left=T-S diagram,bottom right=Station location

You can also get a summmary of the data with summary(ctd)

Now,we want to plot a profile of \(σ~θ\) and \(N^2\) for the data in the pycnocline.

pycnocline <- ctdTrim(ctd,"range",parameters = list(item="pressure",from=5,to=12))
plotProfile(pycnocline,xtype = "density+N2")

Exercise answer

1.(a) What is the density of a seawater parcel at pressure 100 dbar, with salinity 34 PSU and temperature 10◦C?

swRho(salinity = 34,temperature = 10,pressure = 100)
## [1] 1026.624
  1. What temperature would the parcel have if raised adiabatically to the surface?
swTheta(salinity =34,temperature = 10,pressure = 100 )
## [1] 9.988599
  1. What density would it have if raised adiabatically to the surface?
swRho(salinity = 34,temperature = swTheta(salinity =34,temperature = 10,pressure = 100 ),pressure = 0)
## [1] 1026.173
  1. What density would it have if lowered about 100m, increasing the pressure to 200dbar?
swRho(salinity = 34,temperature = swTheta(34,10,100,200),pressure = 200)
## [1] 1027.074
  1. Draw a blank T-S diagram with S from 30 to 40 PSU and T from −2 to 20◦C.

2.Plot a profile of σθ and N2, for the data in the pycnocline.

library(oce)
data("ctd")
pycnocline <- subset(ctd,5<= pressure &pressure<=12)
plotProfile(pycnocline,xtype ="density+N2")

Example with Raw data

data("ctdRaw")
plotScan(ctdRaw)

⨂ Scanwise plot of the ctdRaw sample data set

plotScan(ctdTrim(ctdRaw,"range",parameters = list(item="scan",from=140,to=250)))

plotScan(ctdTrim(ctdRaw,"range",parameters = list(item="scan",from=150,to=250)))

### Section plot

3.Draw a T-S diagram for the section data, colour-coded by station

data("section")
SS<-TT<-PP<-id<-NULL
n<-length(section@data$station)
for(stn in section@data$station){
        SS<- c(SS,stn@data$salinity)
        TT<-c(TT,stn@data$temperature)
        PP<-c(PP,stn@data$pressure)
}
ctd.sec <- as.ctd(SS,TT,PP)
plotTS(ctd.sec)