MCPcopy Index your code
hub / github.com/pydata/xarray / func_interpolate_na

Function func_interpolate_na

xarray/core/missing.py:409–426  ·  view source on GitHub ↗

helper function to apply interpolation along 1 dimension

(interpolator, y, x, **kwargs)

Source from the content-addressed store, hash-verified

407
408
409def func_interpolate_na(interpolator, y, x, **kwargs):
410 """helper function to apply interpolation along 1 dimension"""
411 # reversed arguments are so that attrs are preserved from da, not index
412 # it would be nice if this wasn't necessary, works around:
413 # "ValueError: assignment destination is read-only" in assignment below
414 out = y.copy()
415
416 nans = pd.isnull(y)
417 nonans = ~nans
418
419 # fast track for no-nans, all nan but one, and all-nans cases
420 n_nans = nans.sum()
421 if n_nans == 0 or n_nans >= len(y) - 1:
422 return y
423
424 f = interpolator(x[nonans], y[nonans], **kwargs)
425 out[nans] = f(x[nans])
426 return out
427
428
429def _bfill(arr, n=None, axis=-1):

Callers

nothing calls this directly

Calls 4

fFunction · 0.70
copyMethod · 0.45
isnullMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…