How to specify order keyword in resample: ds.resample('time='1D').interpolate(kind='polynomial',order=2) #7380
Replies: 1 comment 1 reply
-
Are you trying to downscale or upscale your time series? I believe the operation you're trying to perform is not well defined mathematically. Perhaps I am misinterpreting what you're trying to do. But in my understanding there are two cases for the
I think there's a problem for upscaling though. Upscaling using linear interpolation works fine as you can take any two data points and fit a line between them to fill in the gaps. But how should that work for a higher polynomial, e.g. of second order? There are indefinitely many polynomials you can fit having just 2 points, so there is no unique solution. One could say, well, let's take at least three points, but then there is no guarantee that the polynomial fit of three points will smoothly fit the polynomial fit of the next following three points. In that case, what would your final time series look like? EDIT: That being said, if you want to downscale the following may do what you're looking for? ds.interp_like(ds.resample(time='1D').mean(), method='quadratic') |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use polynomial interpolation to resample an xarray in time. It says it wants the "order" keyword specfied but I don't know how. Above ds.resample('time='1D').interpolate(kind='polynomial',order=2) generates an unexpected keyword argument error.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions