Skip to content

Instantly share code, notes, and snippets.

@dvgodoy
Created October 8, 2022 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvgodoy/fa1f43b24046ba8100b42f096da29cb9 to your computer and use it in GitHub Desktop.
Save dvgodoy/fa1f43b24046ba8100b42f096da29cb9 to your computer and use it in GitHub Desktop.
def fill_series(gridded,
max_contiguous_na=3,
periods_for_extrapolation=5,
method='slinear'):
# Applies the fill_values function over every grid box
filled = np.apply_along_axis(func1d=lambda s: fill_values(s,
max_contiguous_na,
periods_for_extrapolation,
method),
arr=gridded.reshape(gridded.shape[0], -1).T,
axis=1)
filled = filled.T.reshape(gridded.shape)
return filled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment