pandas.DataFrame.xyz.z_smooth_time

DataFrame.xyz.z_smooth_time(**kwargs)[source]

Smooths noisy elevation time series.

Because of GPS and DEM inaccuracy, elevation data is not smooth. Calculations involving terrain slope (the derivative of elevation with respect to distance, dy/dx) will not yield reasonable values unless the data is smoothed.

This method’s approach follows the overview outlined in the NREL paper cited in README. However, unlike the algorithm in the paper, which samples regularly over distance, this algorithm samples regularly over time (well, it presumes the elevation values are sampled at even 1-second intervals). The body only cares about energy use over time, not over distance. The noisy elevation data is downsampled and passed through a Savitzky-Golay (SG) filter. Parameters for the filters were not described in the paper, so they must be tuned to yield intended results when applied to a particular type of data. Because the assumptions about user behavior depend on the activity being performed, the parameters will likely differ for a road run, a trail run, or a trail hike.

Parameters
  • **elevation (scalar) – column label in the record DataFrame containing elevation coordinates along the route in meters above sea level. Must be numeric dtype. If a label is not provided, the parameter name itself is used. Assumed 1-second interval.

  • **sample_len (int) – time (in seconds) between between desired resampled data. Default is 1.

  • **window_len (int) – length of the window used in the SG filter. Must be positive odd integer. Default 21.

  • **polyorder (int) – order of the polynomial used in the SG filter. Must be less than window_len. Default 2.

Returns

elevation coordinates that result from this smoothing algorithm.

Return type

pandas.Series