Created
October 8, 2022 19:47
-
-
Save dvgodoy/fa1f43b24046ba8100b42f096da29cb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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