	subroutine o2scal(p,t,s,o2,c,o2mll)
c
c	title:
c	*****
c
c	  o2scal -- scale ctd o2 for display
c
c	parameters:
c	**********
c
c	  p     -> pressure (decibars)
c	  t     -> temperature (deg c)
c	  s     -> salinity (pss-78)
c	  o2    -> ctd o2 (micro-amps)
c         c     -> modeling parameters data block:
c                  1=taut-- thermal response time constant of
c                    oxygen sensor (seconds) (typically 120.0)
c                  2=tint--initial temperature offset
c                    (celsius) (typically 0.0)
c                  3=difcof--diffusion coefficient of membrane
c                    a/k where k=permeability coefficient cm**2/sec,
c                              a=area of membrane, cm**2
c                    (typically 1.3e6)
c                  4=difeng--diffusion energy of membrane
c                    r/j where r=gas constant joules/(mole-deg)
c                              j=membrane activation energy joules/mole
c                    (typically 4100.)
c                  5=bias--offset current of sensor
c                    (typically 0.0)
c                  6=offset--oxygen partial pressure offset term
c                    (typically 0.0)
c                  7=scale--slope of oxygen conversion equation
c                    (typically 6.0e-4)
c                  8=tcoef--temperature coefficient of sensor
c                    (typically 2500.)
c                  9=pcoef--pressure coefficient of sensor
c                    (typically 1.5e-4)
c                 10=ccoef-- conductivity coefficient of sensor
c                    (typically 0.0)
c	  o2mll <- approx o2 (ml/l)
c
	  real p,t,s,o2,c(10),o2mll
c
c	variables:
c	*********
c
	  real tlag,tresp,tk,tk100,tkl,o2pp,b
	  logical init
c
c	constants:
c	*********
c
	  real kelvin
          parameter (kelvin=273.16)
c
c	  /* o2 modling parameters */
c
          integer taut,tint,difcof,difeng,bias
          integer offset,scale,tcoef,pcoef,ccoef
          parameter(taut=1,tint=2,difcof=3,difeng=4,bias=5)
          parameter(offset=6,scale=7,tcoef=8,pcoef=9,ccoef=10)
c
	  data tresp/0.0/,tlag/0.0/
	  data init/.false./
c
c	code:
c	****
c
	if(.not.init) then
	  init = .true.
	  tresp = .367879**(1.0/c(taut))
	  endif
c
	tlag = tresp*tlag+(1-tresp)*t
c	  /* lagged temperature */
	tkl  = tlag+kelvin
	tk   = t+kelvin
	tk100= tk/100.0
	b    = -58.3877+8580.79/tk+23.8439*log(tk100)
	o2pp = c(scale)*o2*exp(c(pcoef)*p)*exp(c(tcoef)/tkl)*1.0e-4
c	  /* o2 partial-pressure uatm */
	o2mll= o2pp*(exp(b+s*(-0.03489+tk100*(0.015568-.0019387*tk100)))
     1         *1000.0)
	return
c
c	end o2scal
c
	end
