COSMOS v7.655  COSMOSv7655
(AirShowerMC)
ceCent2llh.f
Go to the documentation of this file.
1  subroutine cecent2llh(xyz, llh)
2 ! xyz: /coord/ structue. Input. The coordinate system is
3 ! such that the origin is at the center of the earth
4 ! x-axis is directed to (0, 0) latitude and longitude.
5 ! y-axis is directed to (0, 90) latitude and longitude.
6 ! z-axsi is directed to the north pole.
7 ! llh: /coord/ structure. Output. to contain data in latitude,
8 ! longitude, height.
9 ! *** note ***
10 ! llh can be the same as xyz. time component is unchanged
11 !
12  implicit none
13 #include "Zglobalc.h"
14 
15 #include "Zcoord.h"
16 #include "Zearth.h"
17  type(coord)::llh
18  type(coord)::xyz
19  type(coord)::temp
20 !
21  real*8 n, cosphi, sinphi, cosl, sinl
22 #include "Zcoordtype.h"
23 
24 ! ecentricity 0 approximation ??
25  n = eradius
26 #ifdef UNIONMAP
27  temp%h = sqrt( xyz%r(1)**2 + xyz%r(2)**2 +xyz%r(3)**2)
28  * - n
29  cosphi = sqrt( (xyz%r(1)/(n+temp%h))**2 +
30  * (xyz%r(2)/(n+temp%h))**2 )
31 ! sinphi = xyz.r(3)/(n*Eone_ecen2 + temp.h)
32  sinphi = xyz%r(3)/(n + temp%h)
33 !
34  cosl = xyz%r(1)/(n+temp%h)/cosphi
35  sinl = xyz%r(2)/(n+temp%h)/cosphi
36  temp%lat = atan2(sinphi, cosphi)*todeg
37  temp%long = atan2(sinl, cosl)*todeg
38  llh%lat = temp%lat
39  llh%long = temp%long
40  llh%h = temp%h
41 #else
42  temp%r(3) = sqrt( xyz%r(1)**2 + xyz%r(2)**2 +xyz%r(3)**2)
43  * - n
44  cosphi = sqrt( (xyz%r(1)/(n+temp%r(3)))**2 +
45  * (xyz%r(2)/(n+temp%r(3)))**2 )
46 ! sinphi = xyz.r(3)/(n*Eone_ecen2 + temp.r(3))
47  sinphi = xyz%r(3)/(n + temp%r(3))
48 !
49  cosl = xyz%r(1)/(n+temp%r(3))/cosphi
50  sinl = xyz%r(2)/(n+temp%r(3))/cosphi
51  temp%r(1) = atan2(sinphi, cosphi)*todeg
52  temp%r(2) = atan2(sinl, cosl)*todeg
53  llh%r(1) = temp%r(1)
54  llh%r(2) = temp%r(2)
55  llh%r(3) = temp%r(3)
56 #endif
57  llh%sys = coord_types(2)
58  end
subroutine cecent2llh(xyz, llh)
integer max_coord_types * coord_types(2)/'llh'/
Definition: Zcoord.h:43