## Description

Algorithm for calculating additional levels between mandatory significant levels, so that the thermodynamic or winds profile can be reproduced from the minimum number of points. Levels are identified at points of greatest departure from linearity (GDL) throughout the sounding, recursively.

Aspen includes user-settable thresholds for GDL for temperature, humidity, wind speed, and wind direction that limit level creation to differences above the threshold. Note that for dropsondes only, there are two thresholds for wind speed, to allow for more detail in winds data below 850mb.

## Algorithm

GDL levels for each data series are calculated separately. For each data series, the starting point is the list of all levels already calculated that contain the data field in use. For each pair of existing levels in the list, run the GDL algorithm on the values of the data series between the times of the two levels.

Between each pair of levels:

- Calculate the slope of the data series between endpoints (data value change over pressure change)
- Iterate through all data indices between the bounding levels, comparing the interpolated data value (based on slope) with the actual data value. Save the largest difference found between interpolated and actual data.
- If the maximum difference found is greater than the supplied threshold, create a new GDL level at that point.
- If a new level is created, recursively start the GDL algorithm on subsets of the data series on either side of the new level.

## Source

Charlie Martin

*Edit me*