pyBADA 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyBADA/TCL.py +391 -341
- pyBADA/aircraft.py +81 -131
- pyBADA/bada3.py +269 -312
- pyBADA/bada4.py +212 -260
- pyBADA/badaH.py +84 -169
- pyBADA/configuration.py +60 -0
- {pybada-0.1.1.dist-info → pybada-0.1.2.dist-info}/METADATA +5 -7
- {pybada-0.1.1.dist-info → pybada-0.1.2.dist-info}/RECORD +11 -11
- {pybada-0.1.1.dist-info → pybada-0.1.2.dist-info}/WHEEL +1 -1
- {pybada-0.1.1.dist-info → pybada-0.1.2.dist-info}/licenses/AUTHORS +0 -0
- {pybada-0.1.1.dist-info → pybada-0.1.2.dist-info}/licenses/LICENCE.txt +0 -0
pyBADA/badaH.py
CHANGED
|
@@ -19,7 +19,7 @@ from pyBADA import constants as const
|
|
|
19
19
|
from pyBADA import conversions as conv
|
|
20
20
|
from pyBADA import atmosphere as atm
|
|
21
21
|
from pyBADA import configuration as configuration
|
|
22
|
-
from pyBADA.aircraft import Helicopter, BadaFamily
|
|
22
|
+
from pyBADA.aircraft import Helicopter, BadaFamily, Bada
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def proper_round(num, dec=0):
|
|
@@ -43,32 +43,7 @@ class Parser:
|
|
|
43
43
|
pass
|
|
44
44
|
|
|
45
45
|
@staticmethod
|
|
46
|
-
def
|
|
47
|
-
"""
|
|
48
|
-
Lists all subfolders within a specified directory.
|
|
49
|
-
|
|
50
|
-
:param folderPath: Path to the directory where subfolders are to be listed.
|
|
51
|
-
:type folderPath: str
|
|
52
|
-
:returns: A list of subfolder names within the specified directory.
|
|
53
|
-
:rtype: list of str
|
|
54
|
-
|
|
55
|
-
This function retrieves all entries in the given directory and filters out
|
|
56
|
-
the ones that are not directories. Only the names of the subfolders are returned.
|
|
57
|
-
"""
|
|
58
|
-
# List all entries in the directory
|
|
59
|
-
entries = os.listdir(folderPath)
|
|
60
|
-
|
|
61
|
-
# Filter out entries that are directories
|
|
62
|
-
subfolders = [
|
|
63
|
-
entry
|
|
64
|
-
for entry in entries
|
|
65
|
-
if os.path.isdir(os.path.join(folderPath, entry))
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
return subfolders
|
|
69
|
-
|
|
70
|
-
@staticmethod
|
|
71
|
-
def parseXML(filePath, badaVersion, acName):
|
|
46
|
+
def parseXML(filePath, acName):
|
|
72
47
|
"""
|
|
73
48
|
Parses the BADAH XML file for a specific aircraft model and extracts various parameters.
|
|
74
49
|
|
|
@@ -76,10 +51,8 @@ class Parser:
|
|
|
76
51
|
general information about the aircraft, engine type, aerodynamic configurations, performance parameters, and more.
|
|
77
52
|
|
|
78
53
|
:param filePath: The path to the folder containing the BADAH XML file.
|
|
79
|
-
:param badaVersion: The version of BADA (e.g., "1.1") being used.
|
|
80
54
|
:param acName: The aircraft code name for which the XML file is being parsed.
|
|
81
55
|
:type filePath: str
|
|
82
|
-
:type badaVersion: str
|
|
83
56
|
:type acName: str
|
|
84
57
|
:raises IOError: If the XML file cannot be found or parsed.
|
|
85
58
|
|
|
@@ -87,10 +60,7 @@ class Parser:
|
|
|
87
60
|
:rtype: pd.DataFrame
|
|
88
61
|
"""
|
|
89
62
|
|
|
90
|
-
acXmlFile = (
|
|
91
|
-
os.path.join(filePath, "BADAH", badaVersion, acName, acName)
|
|
92
|
-
+ ".xml"
|
|
93
|
-
)
|
|
63
|
+
acXmlFile = os.path.join(filePath, acName, acName) + ".xml"
|
|
94
64
|
|
|
95
65
|
try:
|
|
96
66
|
tree = ET.parse(acXmlFile)
|
|
@@ -189,15 +159,13 @@ class Parser:
|
|
|
189
159
|
return df_single
|
|
190
160
|
|
|
191
161
|
@staticmethod
|
|
192
|
-
def readSynonym(filePath
|
|
162
|
+
def readSynonym(filePath):
|
|
193
163
|
"""
|
|
194
164
|
Parses the BADAH Synonym XML file and returns a dictionary mapping aircraft code names
|
|
195
165
|
to their respective model files.
|
|
196
166
|
|
|
197
167
|
:param filePath: Path to the directory containing the BADA4 synonym XML file.
|
|
198
|
-
:param badaVersion: The version of BADA4 being used.
|
|
199
168
|
:type filePath: str
|
|
200
|
-
:type badaVersion: str
|
|
201
169
|
:returns: A dictionary where the keys are aircraft codes and the values are associated file names.
|
|
202
170
|
:rtype: dict
|
|
203
171
|
:raises IOError: If the XML file is missing or has an invalid format.
|
|
@@ -207,7 +175,7 @@ class Parser:
|
|
|
207
175
|
and file name data for each aircraft in the synonym list.
|
|
208
176
|
"""
|
|
209
177
|
|
|
210
|
-
filename = os.path.join(filePath, "
|
|
178
|
+
filename = os.path.join(filePath, "SYNONYM.xml")
|
|
211
179
|
|
|
212
180
|
# synonym - file name pair dictionary
|
|
213
181
|
synonym_fileName = {}
|
|
@@ -230,15 +198,13 @@ class Parser:
|
|
|
230
198
|
return synonym_fileName
|
|
231
199
|
|
|
232
200
|
@staticmethod
|
|
233
|
-
def parseSynonym(filePath,
|
|
201
|
+
def parseSynonym(filePath, acName):
|
|
234
202
|
"""
|
|
235
203
|
Retrieves the file name associated with a given aircraft code from the BADAH synonym file.
|
|
236
204
|
|
|
237
205
|
:param filePath: Path to the directory containing the BADAH synonym XML file.
|
|
238
|
-
:param badaVersion: The version of BADAH being used.
|
|
239
206
|
:param acName: The ICAO aircraft code or name to search for in the synonym file.
|
|
240
207
|
:type filePath: str
|
|
241
|
-
:type badaVersion: str
|
|
242
208
|
:type acName: str
|
|
243
209
|
:returns: The associated file name if found, otherwise None.
|
|
244
210
|
:rtype: str
|
|
@@ -246,7 +212,7 @@ class Parser:
|
|
|
246
212
|
This function uses the `readSynonym` function to load the synonym dictionary and looks up the
|
|
247
213
|
given aircraft code (acName) to return the associated file name. If no match is found, it returns None.
|
|
248
214
|
"""
|
|
249
|
-
synonym_fileName = Parser.readSynonym(filePath
|
|
215
|
+
synonym_fileName = Parser.readSynonym(filePath)
|
|
250
216
|
|
|
251
217
|
if acName in synonym_fileName:
|
|
252
218
|
fileName = synonym_fileName[acName]
|
|
@@ -276,15 +242,16 @@ class Parser:
|
|
|
276
242
|
"""
|
|
277
243
|
|
|
278
244
|
if filePath == None:
|
|
279
|
-
filePath = configuration.
|
|
245
|
+
filePath = configuration.getBadaVersionPath(
|
|
246
|
+
badaFamily="BADAH", badaVersion=badaVersion
|
|
247
|
+
)
|
|
280
248
|
else:
|
|
281
249
|
filePath = filePath
|
|
282
250
|
|
|
283
|
-
synonym_fileName = Parser.readSynonym(filePath
|
|
251
|
+
synonym_fileName = Parser.readSynonym(filePath)
|
|
284
252
|
|
|
285
253
|
# get names of all the folders in the main BADA model folder to search for XML files
|
|
286
|
-
|
|
287
|
-
subfolders = Parser.list_subfolders(folderPath)
|
|
254
|
+
subfolders = configuration.list_subfolders(filePath)
|
|
288
255
|
|
|
289
256
|
merged_df = pd.DataFrame()
|
|
290
257
|
|
|
@@ -294,7 +261,7 @@ class Parser:
|
|
|
294
261
|
|
|
295
262
|
if file in subfolders:
|
|
296
263
|
# parse the original XML of a model
|
|
297
|
-
df = Parser.parseXML(filePath,
|
|
264
|
+
df = Parser.parseXML(filePath, file)
|
|
298
265
|
|
|
299
266
|
# rename acName in the data frame to match the synonym model name
|
|
300
267
|
df.at[0, "acName"] = synonym
|
|
@@ -305,79 +272,15 @@ class Parser:
|
|
|
305
272
|
else:
|
|
306
273
|
for file in subfolders:
|
|
307
274
|
# Parse the original XML of a model
|
|
308
|
-
df = Parser.parseXML(filePath,
|
|
275
|
+
df = Parser.parseXML(filePath, file)
|
|
309
276
|
|
|
310
277
|
# Merge DataFrames
|
|
311
278
|
merged_df = pd.concat([merged_df, df], ignore_index=True)
|
|
312
279
|
|
|
313
280
|
return merged_df
|
|
314
281
|
|
|
315
|
-
@staticmethod
|
|
316
|
-
def getBADAParameters(df, acName, parameters):
|
|
317
|
-
"""
|
|
318
|
-
Retrieves specified parameters for a given aircraft name from a DataFrame.
|
|
319
|
-
|
|
320
|
-
:param df: DataFrame containing BADA aircraft data.
|
|
321
|
-
:param acName: Name of the aircraft or list of aircraft names to search for.
|
|
322
|
-
:param parameters: List of column names (or a single column name) to retrieve.
|
|
323
|
-
:type df: pd.DataFrame
|
|
324
|
-
:type acName: list or str
|
|
325
|
-
:type parameters: list or str
|
|
326
|
-
:returns: A DataFrame containing the specified parameters for the given aircraft.
|
|
327
|
-
:rtype: pd.DataFrame
|
|
328
|
-
:raises ValueError: If any of the specified columns or aircraft names are not found.
|
|
329
|
-
"""
|
|
330
|
-
|
|
331
|
-
# Ensure parameters is a list
|
|
332
|
-
if isinstance(parameters, str):
|
|
333
|
-
parameters = [parameters]
|
|
334
|
-
|
|
335
|
-
# Ensure acName is a list
|
|
336
|
-
if isinstance(acName, str):
|
|
337
|
-
acName = [acName]
|
|
338
|
-
|
|
339
|
-
# Ensure all requested parameters exist in the DataFrame
|
|
340
|
-
missing_cols = [col for col in parameters if col not in df.columns]
|
|
341
|
-
if missing_cols:
|
|
342
|
-
raise ValueError(
|
|
343
|
-
f"The following parameters are not in the DataFrame columns: {missing_cols}"
|
|
344
|
-
)
|
|
345
|
-
|
|
346
|
-
# Filter rows where 'acName' matches any of the specified aircraft names
|
|
347
|
-
filtered_df = df[df["acName"].isin(acName)]
|
|
348
282
|
|
|
349
|
-
|
|
350
|
-
if filtered_df.empty:
|
|
351
|
-
raise ValueError(f"No entries found for aircraft(s): {acName}.")
|
|
352
|
-
else:
|
|
353
|
-
# Select the required columns
|
|
354
|
-
result_df = filtered_df[["acName"] + parameters].reset_index(
|
|
355
|
-
drop=True
|
|
356
|
-
)
|
|
357
|
-
return result_df
|
|
358
|
-
|
|
359
|
-
@staticmethod
|
|
360
|
-
def safe_get(df, column_name, default_value=None):
|
|
361
|
-
"""
|
|
362
|
-
Safely retrieves a column's value from a DataFrame, returning a default value if the column does not exist.
|
|
363
|
-
|
|
364
|
-
:param df: DataFrame to retrieve the value from.
|
|
365
|
-
:param column_name: Name of the column to retrieve.
|
|
366
|
-
:param default_value: Value to return if the column does not exist. Default is None.
|
|
367
|
-
:type df: pd.DataFrame
|
|
368
|
-
:type column_name: str
|
|
369
|
-
:type default_value: any
|
|
370
|
-
:returns: The value from the specified column or the default value if the column is missing.
|
|
371
|
-
:rtype: any
|
|
372
|
-
"""
|
|
373
|
-
|
|
374
|
-
if column_name in df.columns:
|
|
375
|
-
return df[column_name].iloc[0]
|
|
376
|
-
else:
|
|
377
|
-
return default_value
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
class BADAH(Helicopter):
|
|
283
|
+
class BADAH(Helicopter, Bada):
|
|
381
284
|
"""This class implements the part of BADAH performance model that will be used in other classes following the BADAH manual.
|
|
382
285
|
|
|
383
286
|
:param AC: Aircraft object {BADAH}.
|
|
@@ -1312,8 +1215,6 @@ class Optimization(BADAH):
|
|
|
1312
1215
|
|
|
1313
1216
|
filename = os.path.join(
|
|
1314
1217
|
self.AC.filePath,
|
|
1315
|
-
self.AC.BADAFamilyName,
|
|
1316
|
-
self.AC.BADAVersion,
|
|
1317
1218
|
self.AC.acName,
|
|
1318
1219
|
optParam + ".OPT",
|
|
1319
1220
|
)
|
|
@@ -4093,7 +3994,9 @@ class BadaHAircraft(BADAH):
|
|
|
4093
3994
|
self.acName = acName
|
|
4094
3995
|
|
|
4095
3996
|
if filePath == None:
|
|
4096
|
-
self.filePath = configuration.
|
|
3997
|
+
self.filePath = configuration.getBadaVersionPath(
|
|
3998
|
+
badaFamily="BADAH", badaVersion=badaVersion
|
|
3999
|
+
)
|
|
4097
4000
|
else:
|
|
4098
4001
|
self.filePath = filePath
|
|
4099
4002
|
|
|
@@ -4101,28 +4004,34 @@ class BadaHAircraft(BADAH):
|
|
|
4101
4004
|
if allData is not None and acName in allData["acName"].values:
|
|
4102
4005
|
filtered_df = allData[allData["acName"] == acName]
|
|
4103
4006
|
|
|
4104
|
-
self.model =
|
|
4105
|
-
self.engineType =
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
self.
|
|
4109
|
-
self.
|
|
4110
|
-
self.
|
|
4111
|
-
self.
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
self.
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
self.
|
|
4118
|
-
self.
|
|
4119
|
-
self.
|
|
4120
|
-
self.
|
|
4121
|
-
self.
|
|
4122
|
-
self.
|
|
4123
|
-
self.
|
|
4124
|
-
self.
|
|
4125
|
-
self.
|
|
4007
|
+
self.model = configuration.safe_get(filtered_df, "model", None)
|
|
4008
|
+
self.engineType = configuration.safe_get(
|
|
4009
|
+
filtered_df, "engineType", None
|
|
4010
|
+
)
|
|
4011
|
+
self.engines = configuration.safe_get(filtered_df, "engines", None)
|
|
4012
|
+
self.WTC = configuration.safe_get(filtered_df, "WTC", None)
|
|
4013
|
+
self.ICAO = configuration.safe_get(filtered_df, "ICAO", None)
|
|
4014
|
+
self.MR_radius = configuration.safe_get(
|
|
4015
|
+
filtered_df, "MR_radius", None
|
|
4016
|
+
)
|
|
4017
|
+
self.MR_Speed = configuration.safe_get(
|
|
4018
|
+
filtered_df, "MR_Speed", None
|
|
4019
|
+
)
|
|
4020
|
+
self.cpr = configuration.safe_get(filtered_df, "cpr", None)
|
|
4021
|
+
self.n_eng = configuration.safe_get(filtered_df, "n_eng", None)
|
|
4022
|
+
self.P0 = configuration.safe_get(filtered_df, "P0", None)
|
|
4023
|
+
self.cf = configuration.safe_get(filtered_df, "cf", None)
|
|
4024
|
+
self.Pmax_ = configuration.safe_get(filtered_df, "Pmax_", None)
|
|
4025
|
+
self.cpa = configuration.safe_get(filtered_df, "cpa", None)
|
|
4026
|
+
self.hmo = configuration.safe_get(filtered_df, "hmo", None)
|
|
4027
|
+
self.vne = configuration.safe_get(filtered_df, "vne", None)
|
|
4028
|
+
self.MTOW = configuration.safe_get(filtered_df, "MTOW", None)
|
|
4029
|
+
self.OEW = configuration.safe_get(filtered_df, "OEW", None)
|
|
4030
|
+
self.MFL = configuration.safe_get(filtered_df, "MFL", None)
|
|
4031
|
+
self.MREF = configuration.safe_get(filtered_df, "MREF", None)
|
|
4032
|
+
self.MPL = configuration.safe_get(filtered_df, "MPL", None)
|
|
4033
|
+
self.VMO = configuration.safe_get(filtered_df, "VMO", None)
|
|
4034
|
+
self.MMO = configuration.safe_get(filtered_df, "MMO", None)
|
|
4126
4035
|
|
|
4127
4036
|
self.flightEnvelope = FlightEnvelope(self)
|
|
4128
4037
|
self.OPT = Optimization(self)
|
|
@@ -4137,15 +4046,13 @@ class BadaHAircraft(BADAH):
|
|
|
4137
4046
|
self.ACinSynonymFile = False
|
|
4138
4047
|
|
|
4139
4048
|
# check if SYNONYM file exist - since for BADAH this is not a standard procedure (yet)
|
|
4140
|
-
synonymFile = os.path.join(
|
|
4141
|
-
self.filePath, "BADAH", badaVersion, "SYNONYM.xml"
|
|
4142
|
-
)
|
|
4049
|
+
synonymFile = os.path.join(self.filePath, "SYNONYM.xml")
|
|
4143
4050
|
if os.path.isfile(synonymFile):
|
|
4144
4051
|
self.synonymFileAvailable = True
|
|
4145
4052
|
|
|
4146
4053
|
# if SYNONYM exist - look for synonym based on defined acName
|
|
4147
4054
|
self.SearchedACName = Parser.parseSynonym(
|
|
4148
|
-
self.filePath,
|
|
4055
|
+
self.filePath, acName
|
|
4149
4056
|
)
|
|
4150
4057
|
|
|
4151
4058
|
# if cannot find - look for full name (in sub folder names) based on acName (may not be ICAO designator)
|
|
@@ -4162,56 +4069,64 @@ class BadaHAircraft(BADAH):
|
|
|
4162
4069
|
acXmlFile = (
|
|
4163
4070
|
os.path.join(
|
|
4164
4071
|
self.filePath,
|
|
4165
|
-
"BADAH",
|
|
4166
|
-
badaVersion,
|
|
4167
4072
|
self.SearchedACName,
|
|
4168
4073
|
self.SearchedACName,
|
|
4169
4074
|
)
|
|
4170
4075
|
+ ".xml"
|
|
4171
4076
|
)
|
|
4172
|
-
OPTFilePath = os.path.join(
|
|
4173
|
-
self.filePath, "BADAH", badaVersion, acName
|
|
4174
|
-
)
|
|
4077
|
+
OPTFilePath = os.path.join(self.filePath, acName)
|
|
4175
4078
|
|
|
4176
4079
|
if os.path.isfile(acXmlFile):
|
|
4177
4080
|
self.ACModelAvailable = True
|
|
4178
4081
|
|
|
4179
4082
|
ACparsed_df = Parser.parseXML(
|
|
4180
|
-
self.filePath,
|
|
4083
|
+
self.filePath, self.SearchedACName
|
|
4181
4084
|
)
|
|
4182
4085
|
|
|
4183
4086
|
self.OPTFilePath = OPTFilePath
|
|
4184
4087
|
|
|
4185
|
-
self.model =
|
|
4186
|
-
|
|
4088
|
+
self.model = configuration.safe_get(
|
|
4089
|
+
ACparsed_df, "model", None
|
|
4090
|
+
)
|
|
4091
|
+
self.engineType = configuration.safe_get(
|
|
4187
4092
|
ACparsed_df, "engineType", None
|
|
4188
4093
|
)
|
|
4189
|
-
self.engines =
|
|
4094
|
+
self.engines = configuration.safe_get(
|
|
4190
4095
|
ACparsed_df, "engines", None
|
|
4191
4096
|
)
|
|
4192
|
-
self.WTC =
|
|
4193
|
-
self.ICAO =
|
|
4194
|
-
|
|
4097
|
+
self.WTC = configuration.safe_get(ACparsed_df, "WTC", None)
|
|
4098
|
+
self.ICAO = configuration.safe_get(
|
|
4099
|
+
ACparsed_df, "ICAO", None
|
|
4100
|
+
)
|
|
4101
|
+
self.MR_radius = configuration.safe_get(
|
|
4195
4102
|
ACparsed_df, "MR_radius", None
|
|
4196
4103
|
)
|
|
4197
|
-
self.MR_Speed =
|
|
4104
|
+
self.MR_Speed = configuration.safe_get(
|
|
4198
4105
|
ACparsed_df, "MR_Speed", None
|
|
4199
4106
|
)
|
|
4200
|
-
self.cpr =
|
|
4201
|
-
self.n_eng =
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
self.
|
|
4205
|
-
self.
|
|
4206
|
-
self.
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
self.
|
|
4210
|
-
self.
|
|
4211
|
-
self.
|
|
4212
|
-
self.
|
|
4213
|
-
|
|
4214
|
-
|
|
4107
|
+
self.cpr = configuration.safe_get(ACparsed_df, "cpr", None)
|
|
4108
|
+
self.n_eng = configuration.safe_get(
|
|
4109
|
+
ACparsed_df, "n_eng", None
|
|
4110
|
+
)
|
|
4111
|
+
self.P0 = configuration.safe_get(ACparsed_df, "P0", None)
|
|
4112
|
+
self.cf = configuration.safe_get(ACparsed_df, "cf", None)
|
|
4113
|
+
self.Pmax_ = configuration.safe_get(
|
|
4114
|
+
ACparsed_df, "Pmax_", None
|
|
4115
|
+
)
|
|
4116
|
+
self.cpa = configuration.safe_get(ACparsed_df, "cpa", None)
|
|
4117
|
+
self.hmo = configuration.safe_get(ACparsed_df, "hmo", None)
|
|
4118
|
+
self.vne = configuration.safe_get(ACparsed_df, "vne", None)
|
|
4119
|
+
self.MTOW = configuration.safe_get(
|
|
4120
|
+
ACparsed_df, "MTOW", None
|
|
4121
|
+
)
|
|
4122
|
+
self.OEW = configuration.safe_get(ACparsed_df, "OEW", None)
|
|
4123
|
+
self.MFL = configuration.safe_get(ACparsed_df, "MFL", None)
|
|
4124
|
+
self.MREF = configuration.safe_get(
|
|
4125
|
+
ACparsed_df, "MREF", None
|
|
4126
|
+
)
|
|
4127
|
+
self.MPL = configuration.safe_get(ACparsed_df, "MPL", None)
|
|
4128
|
+
self.VMO = configuration.safe_get(ACparsed_df, "VMO", None)
|
|
4129
|
+
self.MMO = configuration.safe_get(ACparsed_df, "MMO", None)
|
|
4215
4130
|
|
|
4216
4131
|
self.flightEnvelope = FlightEnvelope(self)
|
|
4217
4132
|
self.OPT = Optimization(self)
|
pyBADA/configuration.py
CHANGED
|
@@ -8,6 +8,66 @@ Developped @EUROCONTROL (EIH)
|
|
|
8
8
|
|
|
9
9
|
import os
|
|
10
10
|
import importlib.resources
|
|
11
|
+
import pandas as pd
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@staticmethod
|
|
15
|
+
def list_subfolders(folderPath):
|
|
16
|
+
"""
|
|
17
|
+
Lists all subfolders within a specified directory.
|
|
18
|
+
|
|
19
|
+
:param folderPath: Path to the directory where subfolders are to be listed.
|
|
20
|
+
:type folderPath: str
|
|
21
|
+
:returns: A list of subfolder names within the specified directory.
|
|
22
|
+
:rtype: list of str
|
|
23
|
+
|
|
24
|
+
This function retrieves all entries in the given directory and filters out
|
|
25
|
+
the ones that are not directories. Only the names of the subfolders are returned.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
# List all entries in the directory
|
|
29
|
+
entries = os.listdir(folderPath)
|
|
30
|
+
|
|
31
|
+
# Filter out entries that are directories
|
|
32
|
+
subfolders = [
|
|
33
|
+
entry
|
|
34
|
+
for entry in entries
|
|
35
|
+
if os.path.isdir(os.path.join(folderPath, entry))
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
return subfolders
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@staticmethod
|
|
42
|
+
def safe_get(df, column_name, default_value=None):
|
|
43
|
+
"""
|
|
44
|
+
Safely retrieves a column's value from a DataFrame, returning a default value if the column does not exist or if the value is NaN.
|
|
45
|
+
|
|
46
|
+
:param df: DataFrame to retrieve the value from.
|
|
47
|
+
:param column_name: Name of the column to retrieve.
|
|
48
|
+
:param default_value: Value to return if the column does not exist. Default is None.
|
|
49
|
+
:type df: pd.DataFrame
|
|
50
|
+
:type column_name: str
|
|
51
|
+
:type default_value: any
|
|
52
|
+
:returns: The value from the specified column or the default value if the column is missing.
|
|
53
|
+
:rtype: any
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
if column_name in df.columns:
|
|
57
|
+
value = df[column_name].iloc[0]
|
|
58
|
+
|
|
59
|
+
if isinstance(value, list):
|
|
60
|
+
if pd.isna(value).all():
|
|
61
|
+
return default_value
|
|
62
|
+
else:
|
|
63
|
+
return value
|
|
64
|
+
else:
|
|
65
|
+
if pd.isna(value):
|
|
66
|
+
return default_value
|
|
67
|
+
else:
|
|
68
|
+
return value
|
|
69
|
+
else:
|
|
70
|
+
return default_value
|
|
11
71
|
|
|
12
72
|
|
|
13
73
|
def getVersionsList(badaFamily):
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pyBADA
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: pyBADA
|
|
5
5
|
Project-URL: Homepage, https://github.com/eurocontrol/pybada
|
|
6
6
|
Author-email: Henrich Glaser-Opitz <henrich.glaser-opitz@eurocontrol.int>
|
|
7
7
|
License: EUPL-1.2
|
|
8
|
-
License-File: AUTHORS
|
|
9
|
-
License-File: LICENCE.txt
|
|
10
8
|
Classifier: License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)
|
|
11
9
|
Classifier: Programming Language :: Python :: 3
|
|
12
10
|
Requires-Python: >=3.11
|
|
@@ -44,11 +42,11 @@ pip install pyBADA
|
|
|
44
42
|
## Examples
|
|
45
43
|
|
|
46
44
|
- `file_parser`: BADA file parser and retrieval of some basic BADA parameters for all BADA3/4/H
|
|
47
|
-
- `BADAData`: loading complete BADA3 dataset and
|
|
45
|
+
- `BADAData`: loading complete BADA3 dataset and retrieval of a specific parameters for a specific aircraft
|
|
48
46
|
- `optimum_speed_altitude`: calculation of optimum speeds and altitude for BADA4 and BADAH aircraft
|
|
49
|
-
- `ac_trajectory`: simple, but complete aircraft trajectory for BADA3 and BADA4 aircraft
|
|
50
|
-
- `ac_trajectory_GPS`: simple, but complete aircraft trajectory for BADA3 and BADA4 aircraft including geodesic calculations
|
|
51
|
-
- `heli_trajectory`: simple, but complete helicopter trajectory for BADAH aircraft
|
|
47
|
+
- `ac_trajectory`: simple, but complete, aircraft trajectory for BADA3 and BADA4 aircraft
|
|
48
|
+
- `ac_trajectory_GPS`: simple, but complete, aircraft trajectory for BADA3 and BADA4 aircraft including geodesic calculations
|
|
49
|
+
- `heli_trajectory`: simple, but complete, helicopter trajectory for BADAH aircraft
|
|
52
50
|
|
|
53
51
|
## Development
|
|
54
52
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
pyBADA/TCL.py,sha256=
|
|
1
|
+
pyBADA/TCL.py,sha256=yWXZFxbHBsdXEACPQR6bk8za3ATmdljxS7ZfY8-1xG8,368866
|
|
2
2
|
pyBADA/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
pyBADA/aircraft.py,sha256=
|
|
3
|
+
pyBADA/aircraft.py,sha256=tvldebj44Klh-E5garzuMNZrvaib6mmrmiYyMH3bQPM,13075
|
|
4
4
|
pyBADA/atmosphere.py,sha256=tp8erWZ67WtgO8Wii8b4jvVCyYzFRuBEl7T1i_BCiKQ,10820
|
|
5
|
-
pyBADA/bada3.py,sha256=
|
|
6
|
-
pyBADA/bada4.py,sha256=
|
|
7
|
-
pyBADA/badaH.py,sha256=
|
|
8
|
-
pyBADA/configuration.py,sha256=
|
|
5
|
+
pyBADA/bada3.py,sha256=bV4O_2MHg27R4rHQ7j4o_mG3eroEdRdtvh3Jcbhf3RA,186048
|
|
6
|
+
pyBADA/bada4.py,sha256=0X3GRC_ppkbcagrkMpf6e-HqLWtiK15yLhSUVmXOzXQ,219079
|
|
7
|
+
pyBADA/badaH.py,sha256=qvJR2l09pL8dgGxgjh4_gS35WDF32AK6-Ismo-d2zXI,150673
|
|
8
|
+
pyBADA/configuration.py,sha256=tR2fAs3frPQ1L1zAZkqe-mj9MypJGNBHi9RsRmcozUA,6500
|
|
9
9
|
pyBADA/constants.py,sha256=2qC7wPPpf0zr-eo4lTFrK_muK-WI1hDlWRnl-gMsYF4,1018
|
|
10
10
|
pyBADA/conversions.py,sha256=uujcv6Rmh2sY54v6cDT5Fr4T5l3Nglcd6N-xkN8yGCo,3362
|
|
11
11
|
pyBADA/flightTrajectory.py,sha256=LC2j15kb3IRRugQJeNDumYnQ-P0oqpJcnEtvkoGQL5Q,35609
|
|
@@ -90,8 +90,8 @@ pyBADA/aircraft/BADAH/DUMMY/DUMH/DUMH_ISA.PTF,sha256=aEthZF1xztp6QSHYEwU5tH4HF8x
|
|
|
90
90
|
pyBADA/aircraft/BADAH/DUMMY/DUMH/LRC.OPT,sha256=7WecIu4kfw5nM_ADih06Hb8pCoxLVsEdHHJTqQrx4hg,10123
|
|
91
91
|
pyBADA/aircraft/BADAH/DUMMY/DUMH/MEC.OPT,sha256=yKczjH6lZqTplmcV79tZLvwXmHM2F9bYoB2gIM8hBpg,10123
|
|
92
92
|
pyBADA/aircraft/BADAH/DUMMY/DUMH/MRC.OPT,sha256=fTGqt0P9xgt9Q4sKPlL0CZi9aj73prAPlXj1dpWHSOk,10123
|
|
93
|
-
pybada-0.1.
|
|
94
|
-
pybada-0.1.
|
|
95
|
-
pybada-0.1.
|
|
96
|
-
pybada-0.1.
|
|
97
|
-
pybada-0.1.
|
|
93
|
+
pybada-0.1.2.dist-info/METADATA,sha256=fr3MA2yqNiu1gUyYIaVW8T1feyEiK9LZXx4EzH8tv3M,2829
|
|
94
|
+
pybada-0.1.2.dist-info/WHEEL,sha256=3U_NnUcV_1B1kPkYaPzN-irRckL5VW_lytn0ytO_kRY,87
|
|
95
|
+
pybada-0.1.2.dist-info/licenses/AUTHORS,sha256=iCKpU7CHp2sB4u5hkS2WyMJHLzL0gfMm-bobd7QDmzE,108
|
|
96
|
+
pybada-0.1.2.dist-info/licenses/LICENCE.txt,sha256=RpvAZSjULHvoTR_esTlucJ08-zdQydnoqQLbqOh9Ub8,13826
|
|
97
|
+
pybada-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|