interp#
-
float sharp::interp_pressure(const float pressure_val, const float pressure_arr[], const float data_arr[], const std::ptrdiff_t N)#
Linearly interpolate a data field to a requested pressure level.
- Author
Kelton Halbert - NWS Storm Prediction Center
Interpolates data in pressure coordinates (mb) when given the array of pressure values, the array of data to interpolate, a pressure level to interpolate to, and the number of levels in the arrays.
The pressure array must be sorted in descending order and monotonic. Duplicate pressure values or increasing pressure values may produce unexpected results.
- Parameters:
pressure_val – The pressure value to interpolate data to
pressure_arr – The array of pressure values in the profile
data_arr – The array of data values you want interpolated
N – The the array length (number of elements)
- Returns:
The value of data_arr at the requested pressure_val.
-
float sharp::interp_height(const float height_val, const float height_arr[], const float data_arr[], const std::ptrdiff_t N)#
Linearly interpolate a data field to a requested height level.
- Author
Kelton Halbert - NWS Storm Prediction Center
Interpolates data in height coordinates (meters) when given the array of heights, the array of data to interpolate, a height level to interpolate to, and the number of levels in the arrays.
The height array must be sorted in ascending order and monotonic. For performance reasons, this routine assumes your data is well ordered. If weird stuff happens, check the ordering of your array values first.Duplicate height values or decreasing height values may produce unexpected results.
- Parameters:
height_val – The height value to interpolate data to
height_arr – The array of height values in the profile
data_arr – The array of data values you want interpolated
N – The the array length (number of elements)
- Returns:
The value of data_arr at the requested height_val.
-
float sharp::find_first_pressure(const float data_val, const float pressure_arr[], const float data_arr[], const std::ptrdiff_t N)#
Find the pressure level of first occurrence of a given value.
- Author
Kelton Halbert - NWS Storm Prediction Center
Conduct a bottom-up search for the first occurrence of a given value, and interpolate in order to get the pressure level it occurs at.
- Parameters:
data_val – The value being searched for
pressure_arr – The pressure array to get the level from (Pa)
data_arr – The data array of values being searched over
N – The length of the arrays (number of values)
- Returns:
pressure_level (Pa)
-
float sharp::find_first_height(const float data_val, const float height_arr[], const float data_arr[], const std::ptrdiff_t N)#
Find the height level of first occurrence of a given value.
- Author
Kelton Halbert - NWS Storm Prediction Center
Conduct a bottom-up search for the first occurrence of a given value, and interpolate in order to get the pressure level it occurs at.
- Parameters:
data_val – The value being searched for
height_arr – The height array to get the level from (meters)
data_arr – The data array of values being searched over
N – The length of the arrays (number of values)
- Returns:
height_level (meters)