-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsum_flight_range.py
67 lines (57 loc) · 1.56 KB
/
consum_flight_range.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# %%
from traffic.core import Traffic
from mass import FuelEstimator
import numpy as np
import altair as alt
import pandas as pd
from flight import (
FlightProfiles,
FlightProfileGenerator,
_to_df,
gen_flight_profile,
FlightPhaseEstimator,
gentraj,
)
import openturns as ot
import openturns.viewer as viewer
ot.RandomGenerator.SetSeed(0)
# %%
inputDesign = ot.Sample.ImportFromCSVFile("results/input/A320_1600km.csv")
outputDesign = ot.Sample.ImportFromCSVFile("results/output/A320_1600km.csv")
df_in = inputDesign.asDataFrame()
df_out = outputDesign.asDataFrame()
# -------------------------------------------------------
#
# Chart for L / 100 RPKs
#
# -------------------------------------------------------
ac_type = "A320"
df_all = pd.concat([df_in, df_out], axis=1)
base_3 = (
alt.Chart(
df_all.sample(5000, random_state=0),
title=alt.Title("Consumption in liters of kerosen", anchor="start"),
)
.mark_circle()
.encode(
(alt.X("cruising range").bin(maxbins=22).title("Range")),
(alt.Y("y0", scale=alt.Scale(domain=(0, 10000)))),
)
)
mean = base_3.transform_regression("cruising range", "y0").mark_line().encode()
# %%
chart = (
(base_3 + mean)
.configure_axisX(titleAnchor="middle")
.configure_header(titleFontSize=0, labelAngle=0, labelFontSize=0)
.configure_text(font="Calibri")
.configure_legend(
strokeColor="gray",
fillColor="#EEEEEE",
padding=10,
cornerRadius=10,
orient="top-right",
)
).properties(width=800, height=400)
chart
# %%