brightwind.transform.transform.adjust_slope_offset¶
-
brightwind.transform.transform.
adjust_slope_offset
(wspd, current_slope, current_offset, new_slope, new_offset)¶ Adjust a wind speed that already has a slope and offset applied with a new slope and offset. Can take either a single wind speed value or a pandas DataFrame/series.
- Parameters
wspd (float or pd.DataFrame or pd.Series) – The wind speed value or series to be adjusted.
current_slope (float) – The current slope that was applied to create the wind speed.
current_offset (float) – The current offset that was applied to create the wind speed.
new_slope (float) – The new desired slope to adjust the wind speed by.
new_offset (float) – The new desired offset to adjust the wind speed by.
- Returns
The adjusted wind speed as a single value or pandas DataFrame.
The new wind speed is calculated by equating the old and new y=mx+c equations around x and then solving for the new wind speed.
y2 = m2*x + c2 and y1 = m1*x + c1
y2 = m2*(y1 - c1)/m1 + c2
Example usage
import brightwind as bw df = bw.load_campbell_scientific(bw.datasets.demo_campbell_scientific_site_data) df['Spd80mS_adj'] = bw.adjust_slope_offset(df.Spd80mS, 0.044, 0.235, 0.04365, 0.236) df[['Spd80mS', 'Spd80mS_adj']]