-
Notifications
You must be signed in to change notification settings - Fork 444
Closed
Labels
Area: CalcPertains to calculationsPertains to calculationsArea: UnitsPertains to unit informationPertains to unit informationType: BugSomething is not working like it shouldSomething is not working like it should
Milestone
Description
So with our units work I just uncovered that having temperature units will not work with the n-point smoother due to the peculiarities of add temperatures together. See example for error.
Will work to pass non-unit arrays to smooth data, would just need to reattach units. Could work to make this happen behind the scenes pretty easily, but wanted to document here through stripping and reapplying units within the smooth_n_point function.
from metpy.calc as smooth_n_point
T = np.array([[ 2.73, 3.43, 6.53, 7.13, 4.83, 4.13, 5.53, 5.43, 4.03, 4.03, 4.83],
[ 3.73, 4.93, 6.13, 6.63, 8.23, 6.73, 5.63, 3.13, 4.83, 5.73, 5.83],
[ 3.03, 4.83, 6.03, 7.23, 7.63, 6.93, 6.53, 5.43, 6.53, 6.53, 6.13],
[ 3.33, 4.63, 7.23, 6.73, 6.23, 5.43, 5.73, 7.03, 7.13, 7.53, 7.53],
[ 3.93, 3.03, 7.43, 9.23, 9.23, 6.43, 7.93, 8.03, 7.73, 8.13, 8.33],
[ 5.33, 5.23, 4.63, 7.03, 8.03, 7.13, 9.13, 9.83, 9.83, 9.73, 9.43],
[ 5.23, 5.43, 5.43, 7.13, 7.43, 8.13, 8.23, 8.23, 7.93, 8.53, 11.63],
[ 4.73, 5.23, 5.43, 5.53, 6.73, 4.93, 5.93, 7.23, 9.73, 9.23, 11.93],
[ 4.33, 5.83, 4.03, 6.13, 6.23, 5.03, 7.43, 7.73, 10.83, 12.93, 15.43],
[ 8.53, 6.83, 4.43, 5.33, 4.53, 5.43, 5.23, 7.03, 11.13, 14.13, 15.53],
[ 8.53, 7.33, 8.33, 4.53, 5.03, 7.43, 8.73, 9.23, 11.43, 14.73, 16.83]]) * units.degC
smooth_T = smooth_n_point(T, 9, 1)I don't know if this came up in previous version (don't know that I tried to smooth temperature data as I primarily have smoothed height data for contouring purposes.
Metadata
Metadata
Assignees
Labels
Area: CalcPertains to calculationsPertains to calculationsArea: UnitsPertains to unit informationPertains to unit informationType: BugSomething is not working like it shouldSomething is not working like it should