pycontrails.ext.bada.BADAFlight¶
- class pycontrails.ext.bada.BADAFlight(met=None, params=None, **params_kwargs)¶
Bases:
AircraftPerformance
Compute aircraft properties and fuel consumption.
- Parameters:
met (
MetDataset | None
, optional) – Dataset containing “air_temperature”, “eastward_wind”, and “northward_wind” variables. Only used if these variables are not already found on parametersource
ineval()
. By default None.params (
dict[str
,Any]
, optional) – Override model parameters with dictionary. SeeBADAFlightParams
for model parameters.**params_kwargs – Override model parameters with keyword arguments. See
BADAFlightParams
for model parameters.
See also
-
meth:eval
-
class:BADAFlightParams
- __init__(met=None, params=None, **params_kwargs)¶
Methods
__init__
([met, params])calculate_aircraft_performance
(*, ...)Calculate aircraft performance along a trajectory.
downselect_met
()ensure_true_airspeed_on_source
()Add
true_airspeed
field tosource
data if not already present.eval
([source])Extract aircraft properties and calculate the fuel consumption.
get_bada
(aircraft_type)Check BADA databases for
aircraft_type
.get_source_param
(key[, default, set_attr])Get source data with default set by parameter key.
require_met
()Ensure that
met
is a MetDataset.require_source_type
(type_)Ensure that
source
istype_
.set_source
([source])Attach original or copy of input
source
tosource
.set_source_met
(*args, **kwargs)Ensure or interpolate each required
met_variables
onsource
.simulate_fuel_and_performance
(*, ...)Calculate aircraft mass, fuel mass flow rate, and overall propulsion efficiency.
transfer_met_source_attrs
([source])Transfer met source metadata from
met
tosource
.update_params
([params])Update model parameters on
params
.Attributes
Instantiated model parameters, in dictionary form
Meteorology data
Data evaluated in model
hash
Generate a unique hash for model instance.
interp_kwargs
Shortcut to create interpolation arguments from
params
.met_required
Require meteorology is not None on __init__()
Required meteorology pressure level variables.
Optional meteorology variables
processed_met_variables
Set of required parameters if processing already complete on
met
input.- calculate_aircraft_performance(*, aircraft_type, altitude_ft, air_temperature, time, true_airspeed, aircraft_mass, engine_efficiency, fuel_flow, thrust, q_fuel, **kwargs)¶
Calculate aircraft performance along a trajectory.
When
time
is not None, this method should be used for a single flight trajectory. Waypoints are coupled via thetime
parameter.This method computes the rate of climb and descent (ROCD) to determine flight phases: “cruise”, “climb”, and “descent”. Performance metrics depend on this phase.
When
time
is None, this method can be used to simulate flight performance over an arbitrary sequence of flight waypoints by assuming nominal flight characteristics. In this case, each point is treated independently and all points are assumed to be in a “cruise” phase of the flight.- Parameters:
aircraft_type (
str
) – Used to query the underlying model database for aircraft engine parameters.altitude_ft (
npt.NDArray[np.float64]
) – Altitude at each waypoint, [\(ft\)]air_temperature (
npt.NDArray[np.float64]
) – Ambient temperature for each waypoint, [\(K\)]time (
npt.NDArray[np.datetime64] | None
) – Waypoint time innp.datetime64
format. If None, only drag force will is used in thrust calculations (ie, no vertical change and constant horizontal change). In addition, aircraft is assumed to be in cruise.true_airspeed (
npt.NDArray[np.float64] | float | None
) – True airspeed for each waypoint, [\(m s^{-1}\)]. If None, a nominal value is used.aircraft_mass (
npt.NDArray[np.float64] | float
) – Aircraft mass for each waypoint, [\(kg\)].engine_efficiency (
npt.NDArray[np.float64] | float | None
) – Override the engine efficiency at each waypoint.fuel_flow (
npt.NDArray[np.float64] | float | None
) – Override the fuel flow at each waypoint, [\(kg s^{-1}\)].thrust (
npt.NDArray[np.float64] | float | None
) – Override the thrust setting at each waypoint, [:math: N].q_fuel (
float
) – Lower calorific value (LCV) of fuel, [\(J \ kg_{fuel}^{-1}\)].**kwargs (
Any
) – Additional keyword arguments to pass to the model.
- Returns:
AircraftPerformanceData
– Derived performance metrics at each waypoint.
- default_params¶
alias of
BADAFlightParams
- eval(source=None, **params)¶
Extract aircraft properties and calculate the fuel consumption.
Input
source
must contain a validaircraft_type
in itssource.attrs["aircraft_type"]
.If
met
data is not passed into instance constructor, parametersource
must contain the following data variables. - true_airspeed - air_temperatureIf the following variables are not provided in the flight attribute, the default aircraft-engine assignment and aircraft mass properties from BADA will be assumed: - engine_uid - max_takeoff_weight - operating_empty_weight - max_payload
If ‘load_factor’ (ranging between 0 and 1) is not provided in the flight attribute, the aircraft mass at the first waypoint will be set to the reference mass for the specific aircraft type from the BADA database.
- This method extracts the following aircraft properties from the BADA database.
aircraft_type_bada
wingspan
max_mach
max_altitude
engine_name
n_engine
- From these BADA derived quantities, each of the following is computed.
fuel_flow: fuel mass flow rate, [\(kg s^{-1}\)]
fuel_burn: total fuel burn between two waypoints, [\(kg\)]
aircraft_mass
engine_efficiency
thrust
- get_bada(aircraft_type)¶
Check BADA databases for
aircraft_type
.- Parameters:
aircraft_type (
str
) – Aircraft type to check for.- Returns:
BADA
– BADA database object.
- long_name = 'Base of aircraft data flight model'¶
- met¶
Meteorology data
- met_variables = (MetVariable(short_name='t', standard_name='air_temperature', long_name='Air Temperature', level_type='isobaricInhPa', ecmwf_id=130, grib1_id=11, grib2_id=(0, 0, 0), units='K', amip='ta', description='Air temperature is the bulk temperature of the air, not the surface (skin) temperature.'),)¶
Required meteorology pressure level variables. Each element in the list is a
MetVariable
or atuple[MetVariable]
. If element is atuple[MetVariable]
, the variable depends on the data source. Only one variable in the tuple is required.
- name = 'bada'¶
- optional_met_variables = (MetVariable(short_name='u', standard_name='eastward_wind', long_name='Eastward Wind', level_type='isobaricInhPa', ecmwf_id=131, grib1_id=33, grib2_id=(0, 2, 2), units='m s**-1', amip='ua', description='"Eastward" indicates a vector component which is positive when directed eastward (negative westward). Wind is defined as a two-dimensional (horizontal) air velocity vector, with no vertical component.'), MetVariable(short_name='v', standard_name='northward_wind', long_name='Northward Wind', level_type='isobaricInhPa', ecmwf_id=132, grib1_id=34, grib2_id=(0, 2, 3), units='m s**-1', amip='va', description='"Northward" indicates a vector component which is positive when directed northward (negative southward). Wind is defined as a two-dimensional (horizontal) air velocity vector, with no vertical component.'))¶
Optional meteorology variables
- params¶
Instantiated model parameters, in dictionary form
- source¶
Data evaluated in model