## Description

In order to achieve as accurate a surface pressure reading as possible, a procedure is applied which attempts to account for the distance the dropsonde fell to the surface after the last data point was reported. Empirical estimates of this distance are used to extrapolate the last surface pressure measurement to the surface. The last temperature and RH are simply duplicated for the surface measurement, since the distance is generally on the order of 5 meters. These fabricated measurements of pressure, temperature and RH are appended to the data series.

“Splash point” refers to time of last received observation with thermodynamic data.

## Formula

`Sounding::createSfcObs()`

If dropsonde didn’t hit surface, exit without extrapolating surface observations.

Extract from this sounding the quality-controlled series for time, pressure, temperature, relative humidity, vertical velocity, and wind speed.

If there are no observations in pressure series, exit.

Create vector of wavelengths for extrapolate: 2.0, 4.0, 6.0, 8.0

##### Determine splash time:

- Set splash time to time of last entry in (QC) pressure series.
- If the last entry of the temperature series is later than for pressure, update splash time. Do the same for relative humidity and wind speed series.
- If the time of last entry in the raw data is less than 1 second greater than splash time, we assume QC has gotten rid of some data points (but less than a second’s worth of data), so update splash time to time of last entry in raw data. If the time difference is greater than 1 second, the last raw data point is likely bad data, so do not update splash time.
- If splash time is more than 10 sec after the last entry of the pressure series, exit.

##### Determine time of sonde reaching surface:

`double delayTime = 0.84;`

//what are these from`double survivalTime = 0.3;`

`double deltaTime = delayTime - survivalTime;`

- Use extrapolate function to try and extrapolate the vertical velocity with each wavelength in wavelengths vector. If none of these work, set vertical velocity to -12 (m/s?).
- Calculate height of splash point from vertical velocity and deltaTime from above. If change in height is positive (i.e. sonde is rising), exit.
- Calculate time sonde reached surface as splash time plus deltaTime.

##### Calculate p, t, rh for splash point:

- Use
`extrapolate`

function to attempt to extrapolate rh at splash point with each wavelength in wavelengths vector, and constrain rh if necessary to be within 0-100 range. If none of these work, set rh at splash point to 70.0. - Use
`extrapolate`

function to attempt to extrapolate p at splash point with each wavelength in wavelengths vector. If none of these work, exit. - Use
`extrapolate`

function to attempt to extrapolate tdry at splash point with each wavelength in wavelengths vector.- If successful, calculate the pressure at surface using the hydrostatic equation,
`Utilities/GlobalFunctions::hydroP()`

. - If unsuccessful, approximate the pressure at surface by subtracting (distance from splash point to surface * 8.7 mb/m) from the splash point pressure.

- If successful, calculate the pressure at surface using the hydrostatic equation,

##### Calculate surface values:

- Call
`createSfcValue`

for pressure, using surface pressure calculated above. If a surface value cannot be created, exit. - If sounding file is descending, call
`createSfcValue`

for SVVpres with same surface pressure value. - If splash point tdry could be extrapolated and if last measured tdry is within 1.5 sec of splash time, call
`createSfcValue`

for temperature using splash point temperature. - If last measured RH is within 1.5 sec of splash time, call
`createSfcValue`

for relative humidity using splash point RH. - If any surface values were created, call
`createSfcValue`

to add surface time to the time series.

`Sounding::extrapolate(Series* s, int index, double wavelength, double time, double& result)`

Returns: boolean (if extrapolation was successful).

If series is less than 3 elements long, return false.

Extract x (time) and y (data) arrays from series.

Creates a `BsplineBase`

from the x data and wavelengths, then creates a `Bspline`

from it and the y data.

If bspline creation is successful, calculate the result and return: result = data series at index + slope (from bspline) * time change (between time at index and time requested)

\[~\]`Sounding::createSfcValue(Series* data, double time, double value, bool ascending)`

Returns: boolean (if adding value was successful).

If data series contains at least one value, append the time-value pair to the end of the series.

## Source

*Edit me*