OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
spathz.f
Go to the documentation of this file.
1  subroutine spathz(amu0,htp,taur,taum,taua,totsp,nmodl)
2 c
3  implicit real*8 (a-h,o-z)
4  real*8 htp(1000),taur(1000),taum(1000),taua(1000),
5  1 totsp(1000),fxsp(1000)
6  real*8 dht(1000),dtr(1000),dtm(1000),dtot(1000),sum(1000)
7  real*8 hs(1000),dta(1000)
8 c
9  pi=dacos(-1.0d0)
10  conv=pi/180.0d0
11  snmu0=dsqrt(1.0-amu0**2)
12 c scale heights
13  shp=7.930024d0
14  sho=4.178129d0
15  re=6371.0d0
16 c compute (h+re)/re for each pressure level and geometric thickness
17 c of each layer
18  do i=1,nmodl
19  hs(i)=(re+htp(i))/re
20  if(i.lt.nmodl)then
21  dht(i)=htp(i)-htp(i+1)
22  dtr(i)=taur(i+1)-taur(i)
23  dtm(i)=taum(i+1)-taum(i)
24  dta(i)=taua(i+1)-taua(i)
25  endif
26 c write(6,801)i,dht(i),dtr(i),dtm(i),dta(i)
27 801 format('i,dht,dtr,dtm,dta',i5,1p4e12.4)
28  enddo
29 c compute the slant path
30 c
31  sdp=(re+htp(1))/shp
32  sdo=(re+htp(1))/sho
33  do i=1,nmodl
34  sum(i)=0.0d0
35  aa=snmu0*hs(i)
36  if(i.eq.1)then
37  call chapmn(sdp,amu0,chpp)
38  call chapmn(sdo,amu0,chpo)
39  sum(i)=sum(i)+taur(1)*chpp+taua(1)*chpo
40  totsp(i)=sum(i)
41  fxsp(i)=amu0*exp(-sum(i))
42  else
43  xx=sqrt((hs(1)+aa)*(hs(1)-aa))
44  do j=2,i
45  yy=sqrt((hs(j)+aa)*(hs(j)-aa))
46  ds=(xx-yy)*re
47  dst=ds/dht(j-1)
48  sum(i)=sum(i)+dst*(dtr(j-1)+dtm(j-1)+dta(j-1))
49 c write(6,803)i,j,xx,yy,ds,dst,sum(i)
50 803 format('i,j,xx,yy,ds,dst,sum',2i4,1p5e10.2)
51  xx=yy
52  enddo
53  snmu=aa/hs(1)
54  amu=dsqrt(1.0-snmu**2)
55  call chapmn(sdp,amu,chpp)
56  call chapmn(sdo,amu,chpo)
57  sum(i)=sum(i)+taur(1)*chpp+taua(1)*chpo
58  totsp(i)=sum(i)
59  fxsp(i)=amu0*dexp(-sum(i))
60 c write(6,802)i,snmu,amu,chpp,sum(i),fxsp(i)
61 802 format('i,snmu,amu,chpp,sum(i),fxsp(i)',
62  1 i5,1p5e11.3)
63 c write(6,809)i,sum(i),htp(i),fxsp(i)
64 809 format('i,sum,htp,fxsp',i3,1x,1p3e12.4)
65  endif
66  enddo
67  return
68  end
69 c***********************************************************************
subroutine chapmn(x, y, dchap)
Definition: chapman.f:3
subroutine spathz(amu0, htp, taur, taum, taua, totsp, nmodl)
Definition: spathz.f:2
#define real
Definition: DbAlgOcean.cpp:26
#define re
Definition: l1_czcs_hdf.c:701
#define pi
Definition: vincenty.c:23