NCEPLIBS-ip  4.4.0
earth_radius_mod.F90
Go to the documentation of this file.
1 
4 
8  implicit none
9 
10  private
11  public :: earth_radius
12 
13 contains
14 
40  SUBROUTINE earth_radius(IGDTMPL, IGDTLEN, RADIUS, ECCEN_SQUARED)
41  IMPLICIT NONE
42 
43  INTEGER, INTENT(IN ) :: igdtlen
44  INTEGER, INTENT(IN ) :: igdtmpl(igdtlen)
45 
46  REAL, INTENT( OUT) :: eccen_squared
47  REAL, INTENT( OUT) :: radius
48 
49  REAL :: flat
50  REAL :: major_axis, minor_axis
51 
52  SELECT CASE (igdtmpl(1))
53  CASE (0)
54  radius = 6367470.0
55  eccen_squared = 0.0
56  CASE (1) ! USER SPECIFIED SPHERICAL
57  radius = float(igdtmpl(3))/float(10**igdtmpl(2))
58  eccen_squared = 0.0
59  CASE (2) ! IAU 1965
60  radius = 6378160.0 ! SEMI MAJOR AXIS
61  flat = 1.0/297.0 ! FLATTENING
62  eccen_squared = (2.0*flat) - (flat**2)
63  CASE (3) ! USER SPECIFIED ELLIPTICAL (KM)
64  major_axis = float(igdtmpl(5))/float(10**igdtmpl(4))
65  major_axis = major_axis * 1000.0
66  minor_axis = float(igdtmpl(7))/float(10**igdtmpl(6))
67  minor_axis = minor_axis * 1000.0
68  eccen_squared = 1.0 - (minor_axis**2 / major_axis**2)
69  radius = major_axis
70  CASE (4) ! IAG-GRS80 MODEL
71  radius = 6378137.0 ! SEMI MAJOR AXIS
72  flat = 1.0/298.2572 ! FLATTENING
73  eccen_squared = (2.0*flat) - (flat**2)
74  CASE (5) ! WGS84 DATUM
75  radius = 6378137.0 ! SEMI MAJOR AXIS
76  eccen_squared = 0.00669437999013
77  CASE (6)
78  radius = 6371229.0
79  eccen_squared = 0.0
80  CASE (7) ! USER SPECIFIED ELLIPTICAL (M)
81  major_axis = float(igdtmpl(5))/float(10**igdtmpl(4))
82  minor_axis = float(igdtmpl(7))/float(10**igdtmpl(6))
83  eccen_squared = 1.0 - (minor_axis**2 / major_axis**2)
84  radius = major_axis
85  CASE (8)
86  radius = 6371200.0
87  eccen_squared = 0.0
88  CASE DEFAULT
89  radius = -9999.
90  eccen_squared = -9999.
91  END SELECT
92  !
93  RETURN
94  !
95  END SUBROUTINE earth_radius
96 end module earth_radius_mod
Determine earth radius and shape.
subroutine, public earth_radius(IGDTMPL, IGDTLEN, RADIUS, ECCEN_SQUARED)
Determine earth radius and shape.