python - Rolling correlation coefficients for two xarray DataArrays -
i trying calculate rolling correlation between 2 xarray dataarrays.
suppose dataset is:
<xarray.dataset> dimensions: (date: 2621, x: 100) coordinates: * date (date) datetime64[ns] 2007-01-03 2007-01-04 ... * x (x) int64 1 2 3 4 5 6 ... data variables: (date) float64 -0.001011 0.001227 -0.006087 0.002535 ... b (date, x) float64 -0.001007 -0.0001312 -0.02594 ...
i compute rolling coefficients between , b dimensions of each coefficient (date, x). note date dimension present because rolling applied along date axis.
i able put , ugly way full of loops wondering if there way somehow applying reduce function on rolling dataset object. can't see way there may entirely different approach missing.
this problem can generalized applying arbitrary function takes 2 series of numbers inputs (in case correlation function.
Comments
Post a Comment