Several fixes and refactorings to the interpolation methods
Fixes #388 (closed), unfortunately the implementation of interpolateNANs
with limit is not None
is quite a bit slower, then the incorrect previous one. Any ideas to speed things up are highly appreciated, I couldn't find a better solution despite a few hours of trying.
Merge request reports
Activity
added BUG category: algorithms labels
requested review from @palmb
assigned to @schaefed
added 5 commits
-
5d9e43c1...86fa51ae - 4 commits from branch
develop
- 66213cda - Merge branch 'develop' into interpolation_fixes
-
5d9e43c1...86fa51ae - 4 commits from branch
added 2 commits
I just made a fix for #388 (closed) (not noticing there is already a MR related to this) (!600 (merged)). Since it was a one-off error my version/fix should be as fast as prevous one (didnt check).
Edited by Peter Lünenschloßmentioned in merge request !600 (merged)
63 63 qc = SaQC(data, flags) 64 64 qc_lin_1 = qc.interpolateInvalid(field, method="linear", limit=2) 65 65 qc_lin_2 = qc.interpolateInvalid(field, method="linear", limit=3) 66 qc_lin_3 = qc.interpolateInvalid(field, method="linear", limit=4) 67 66 68 67 assert qc_lin_1.data[field][characteristics["missing"]].isna().all() 69 assert qc_lin_2.data[field][characteristics["missing"]].isna().all() 70 assert qc_lin_3.data[field][characteristics["missing"]].notna().all() 68 assert qc_lin_2.data[field][characteristics["missing"]].notna().all() 251 ), 252 ( 253 None, 254 None, 255 "both", 256 [np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan], 257 [0, 0, 1, 2, 3, 4, 4], 258 ), 259 ], 260 ) 261 def test_interpolatNANs(limit, area, direction, data, expected): 262 263 got = interpolateNANs( 264 pd.Series(data), limit=limit, limit_area=area, limit_direction=direction 265 ) 266 assert got.equals(pd.Series(expected, dtype=float))