HWRF  trunk@4391
constants.py
1 """!Constants used throughout the hwrf package
2 
3 This module contains various constants, including the Earth
4 "radius" and unit conversions. Unit conversion constants are given as
5 fractions.Fraction objects to allow the conversion to be exact."""
6 
7 ##@var __all__
8 # ensures that "from hwrf.constants import *" does nothing
9 __all__=['']
10 
11 import fractions
12 
13 # Metric/SI/nautical unit conversions: these conversions are exact.
14 # knots, nmi: http://www.nist.gov/pml/wmd/metric/length.cfm
15 # ft/inches: http://physics.nist.gov/cuu/Units/outside.html
16 
17 ##@var ft2m
18 # """US foot to meters conversion (exact)."""
19 ft2m = fractions.Fraction(12*254,10000)
20 """US foot to meters conversion (exact)."""
21 
22 ##@var m2ft
23 # Meters to US foot conversion (exact).
24 m2ft = 1/ft2m
25 """Meters to US foot conversion (exact)."""
26 
27 ##@var nmi2km
28 # Nautical miles to kilometers conversion (exact).
29 nmi2km = fractions.Fraction(1852,1000)
30 "Nautical miles to kilometers conversion (exact)."""
31 
32 ##@var km2nmi
33 # Kilometers to nautical miles conversion (exact).
34 km2nmi = 1/nmi2km
35 """Kilometers to nautical miles conversion (exact)."""
36 
37 ##@var kts2mps
38 # Knots to meters per second conversion (exact).
39 kts2mps = fractions.Fraction(1852,3600)
40 """Knots to meters per second conversion (exact)."""
41 
42 ##@var mps2kts
43 # Meters per second to knots conversion (exact).
44 mps2kts = 1/kts2mps
45 """Meters per second to knots conversion (exact)."""
46 
47 # Various earth radii from the hwrfutil library constants_module:
48 ##@var Rpole
49 # EGM2008 Earth radius at the pole.
50 Rpole = 6356752.3142
51 """EGM2008 Earth radius at the pole."""
52 
53 ##@var Requator
54 # EGM2008 Earth radius at the equator.
55 Requator = 6378137.0000
56 """EGM2008 Earth radius at the equator."""
57 
58 ##@var flattening
59 # EGM2008 Earth flattening ratio.
60 flattening = 1/298.257223563
61 """EGM2008 Earth flattening ratio."""
62 
63 ##@var REmean
64 # Earth mean ellipsoid radius from IUGG 1980
65 REmean = 6371009.0
66 """Earth mean ellipsoid radius from IUGG 1980"""
67 
68 ##@var REauthalic
69 # Earth authalic (equal surface area) radius from IUGG 1980
70 REauthalic = 6371007.2
71 """Earth authalic (equal surface area) radius from IUGG 1980"""
72 
73 ##@var REvolume
74 # Earth equal volume radius from IUGG 1980
75 REvolume = 6371000.8
76 """Earth equal volume radius from IUGG 1980"""
77 
78 ##@var RErectifying
79 # Earth rectivying (equal circumference) radius from IUGG 1980
80 RErectifying = 6367449.1
81 """Earth rectivying (equal circumference) radius from IUGG 1980"""
82 
83 ##@var Rearth
84 # A compromise: the average of the mean ellipsoid radius, authalic radius and equal volume radius
85 Rearth = (REmean+REauthalic+REvolume)/3
86 """Average of the mean ellipsoid radius, authalic radius and equal
87 volume radius."""