Skip to content
This repository was archived by the owner on Aug 13, 2020. It is now read-only.

Commit 76d7b55

Browse files
committed
Merge pull request #55 from DLpadilla/altimetry
Altimetry
2 parents b8b1646 + ae62658 commit 76d7b55

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

src/pyfme/utils/altimetry.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"""
2+
Functions which transform geometric altitude into geopotential altitude, and
3+
vice versa.
4+
5+
"""
6+
7+
8+
def geopotential2geometric(h):
9+
"""Geometric altiude above MSL (mean sea level)
10+
11+
This function transforms geopotential altitude into geometric altitude.
12+
13+
Parameters
14+
----------
15+
h : float
16+
Geopotential altitude above MSL (mean sea level) (m)
17+
Returns
18+
-------
19+
z : float
20+
Geometric altitude above MSL (mean sea level) (m)
21+
22+
See Also
23+
--------
24+
geopotential
25+
26+
References
27+
----------
28+
.. [1] International Organization for Standardization, Standard Atmosphere,
29+
ISO 2533:1975, 1975
30+
31+
"""
32+
33+
Re = 6371000 # Mean radius Earth (m)
34+
z = Re * h / (Re - h)
35+
return z
36+
37+
38+
def geometric2geopotential(z):
39+
"""Geopotential altiude above MSL (mean sea level)
40+
41+
This function transforms geometric altitude into geopotential altitude.
42+
43+
Parameters
44+
----------
45+
z : float
46+
Geometric altitude above MSL (mean sea level) (m)
47+
Returns
48+
-------
49+
h : float
50+
Geopotential altitude above MSL (mean sea level) (m)
51+
52+
See Also
53+
--------
54+
geometric
55+
56+
References
57+
----------
58+
.. [1] International Organization for Standardization, Standard Atmosphere,
59+
ISO 2533:1975, 1975
60+
61+
"""
62+
63+
Re = 6371000 # Mean radius Earth (m)
64+
h = Re * z / (Re + z)
65+
return h
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
"""
3+
Tests of altimetry.
4+
"""
5+
6+
from numpy.testing import (assert_almost_equal)
7+
import pytest
8+
9+
from pyfme.utils.altimetry import (geopotential2geometric,
10+
geometric2geopotential)
11+
12+
13+
def test1_geopotential2geometric():
14+
15+
h = 11000.0
16+
17+
z = geopotential2geometric(h)
18+
expected_z = 11019.025157232705
19+
20+
assert_almost_equal(z, expected_z)
21+
22+
23+
def test2_geopotential2geometric():
24+
25+
h = 20000.0
26+
27+
z = geopotential2geometric(h)
28+
expected_z = 20062.982207526373
29+
30+
assert_almost_equal(z, expected_z)
31+
32+
33+
def test1_geometric2geopotential():
34+
35+
z = 0.0
36+
37+
h = geometric2geopotential(z)
38+
expected_h = 0.0
39+
40+
assert_almost_equal(h, expected_h)
41+
42+
43+
def test2_geometric2geopotential():
44+
45+
z = 86000.0
46+
47+
h = geometric2geopotential(z)
48+
expected_h = 84854.57642868205
49+
50+
assert_almost_equal(h, expected_h)

0 commit comments

Comments
 (0)