Features
-
Improve the
_altitude_interpolation
function used withinFlight.resample_and_fill
and ensure that it is consistent with the existing GAIA publication The function_altitude_interpolation
now accounts for various scenarios. For example:- Flight will automatically climb to an assumed cruise altitude if the first and next known waypoints are at very low altitudes with a large time gap.
- If there are large time gaps between known waypoints with a small altitude difference, then the flight will climb at the mid-point of the segment.
- If there are large time gaps and positive altitude difference, then the flight will climb at the start of its interpolation until the known cruising altitude and start its cruise phase.
- If there are large time gaps and negative altitude difference, then the flight will continue cruising and only starts to descend towards the end of the interpolation.
- If there is a shallow climb (ROCD < 500 ft/min), then always assume that the flight will climb at the next time step.
- If there is a shallow descent (-250 < ROCD < 0 ft/min), then always assume that the flight will descend at the final time step.
Conditions (3) to (6) is based on the logic that the aircraft will generally prefer to climb to a higher altitude as early as possible, and descend to a lower altitude as late as possible, because a higher altitude can reduce drag and fuel consumption.
Breaking changes
- Remove the optional input parameter
climb_descend_at_end
inFlight.resample_and_fill
. See the description of the new_altitude_interpolation
function for the rationale behind this change. - Remove the
copy
argument fromFleet.from_seq
. This argument was redundant and not used effectively in the implementation. TheFleet.from_seq
method always returns a copy of the input sequence.
Fixes
- Fix the
ERA5
interface when making a pressure-level request with a single pressure level. This change accommodates CDS-Beta server behavior. Previously, a ValueError was raised in this case. - Bypass the ValueError raised by
dask.array.gradient
when the input array is not correctly chunk along the level dimension. Previously,Cocip
would raise an error when computing tau cirrus in the case that themet
data had single chunks along the level dimension. - Fix the
CocipGrid
met downselection process to accommodate cases wheredt_integration
is as large as the time step of the met data. Previously, due to out-of-bounds interpolation, the output ofCocipGrid(met=met, rad=rad, dt_integration="1 hour")
was zero everywhere when themet
andrad
data had a time step of 1 hour. - By default, don't interpolate air temperature when running the
DryAdvection
model in a point-wise manner (no wind-shear simulation). - Use native python types (as opposed to
numpy
scalars) in thePSAircraftEngineParams
dataclass. - Ensure the
PSGrid
model maintains the precision of thesource
. Previously, float32 precision was lost per NEP 50. - Fix
Fleet.resample_and_fill
when the the "flight_id" field is included onFleet.data
(as opposed toFleet.fl_attrs
). Previously, this would raise a ValueError. - Use the supplied
nominal_rocd
parameter inFlight.resample_and_fill
rather thanconstants.nominal_rocd
(the default value of this parameter).
Internals
- Add new
AdvectionBuffers
dataclass to override the zero-like values used inModelParams
with the buffer previously used inCocipParams
. This is now a base class forCocipParams
andDryAdvectionParams
. In particular, theDryAdvection
now uses nonzero values for the met downselect buffers. - Change the order of advected points returned by
DryAdvection
to be consistent with the input order at each time step. - Add the
RUF
ruleset for linting and formatting the codebase. - Update type hints for
numpy
2.2 compatibility. Additional changes may be required after the next iteration of thenumpy
2.2 series. - Relax the tolerance passed into
scipy.optimize.newton
inps_nominal_grid
to avoid some convergence warnings. (These warnings were more distracting than informative.) - Remove the
_verify_altitude
check inFlight.resample_and_fill
. This was often triggered by a flight with corrupt waypoints (ie, independent from the logic inFlight.resample_and_fill
).