In [1]:
import numpy as np
from matplotlib import pyplot as plt
from pyturb.gas_models import isa
In [2]:
height = [0, 11000, 20000, 32000, 47000, 51000, 71000, 84852]
for i_layer, h in enumerate(height):
lapse_rate, Tbase, pbase, dbase, heightbase, layer_name = isa.get_atmosdata(h)
print('{5} -{4:>14s} - zbase={3:9.3f}m, alpha={0:9.2e}K/m, Tbase={1:6.2f}K, pbase={2:10.3f}Pa, dbase={6:6.3e}kg/m^3'.format(lapse_rate, Tbase, pbase, heightbase, layer_name, i_layer+1, dbase))
In [3]:
h = np.linspace(0,84851, 100)
T = isa.temperature_isa(h)
p = isa.pressure_isa(h)
d = isa.density_state_eq(h)
In [4]:
plt.figure()
plot_temp = plt.plot(T,h, '-x')
plt.xlabel("Temperature [K]")
plt.ylabel("geopotential height [m]")
Out[4]:
In [5]:
fig, eje1 = plt.subplots()
eje2 = eje1.twinx()
plot1, = eje1.plot(h, p, "b-+", label="pressure")
plot2, = eje2.plot(h, d, "r-x", label="density")
eje1.set_xlabel("geopotential height [m]")
eje1.set_ylabel("pressure [Pa]")
eje2.set_ylabel("density kg/m3")
eje1.yaxis.label.set_color(plot1.get_color())
eje2.yaxis.label.set_color(plot2.get_color())
tkw = dict(size=4, width=1.5)
eje1.tick_params(axis='y', colors=plot1.get_color(), **tkw)
eje2.tick_params(axis='y', colors=plot2.get_color(), **tkw)
eje1.tick_params(axis='x', **tkw)
lines = [plot1, plot2]
eje1.legend(lines, [l.get_label() for l in lines])
Out[5]:
In [6]:
isa.height_from_temperature_isa(270)
Out[6]:
In [7]:
isa.height_from_pressure_isa([50000, 95000, 2500])
Out[7]:
In [8]:
isa.height_from_temperature_isa([200, 220, 250, 275])
Out[8]:
In [9]:
print(isa.temperature_isa([0, 1000, 2000, 3000]))
print(isa.temperature_isa([0, 1000, 2000, 3000], [5, 10, 15, 20]))
In [10]:
print(isa.pressure_isa([5000, 8000, 10000, 0]))
print(isa.pressure_isa([5000, 8000, 10000, 0], [5, 10, 15, 20]))
In [11]:
T75 = isa.temperature_isa(7500)
print(T75)
T90 = isa.temperature_isa(9000, 10)
print(T90)
In [12]:
p75 = isa.pressure_isa(7500)
p90 = isa.pressure_isa(9000,10)
print(p75)
print(p90)
In [13]:
hp75 = isa.height_from_pressure_isa(p75)
hp90 = isa.height_from_pressure_isa(p90, 10)
print(hp75)
print(hp90)