我有一个独立变量值的一维数组(x_array),它与具有多个时间步长()的3D numpy空间数据数组中的时间步长相匹配y_array.我的实际数据要大得多:300+时间步长和高达3000*3000像素:
import numpy as np
from scipy.stats import linregress
# Independent variable: four time-steps of 1-dimensional data
x_array = np.array([0.5, 0.2, 0.4, 0.4])
# Dependent variable: four time-steps of 3x3 spatial data
y_array = np.array([[[-0.2, -0.2, -0.3],
[-0.3, -0.2, -0.3],
[-0.3, -0.4, -0.4]],
[[-0.2, -0.2, -0.4],
[-0.3, np.nan, -0.3],
[-0.3, -0.3, -0.4]],
[[np.nan, np.nan, -0.3],
[-0.2, -0.3, -0.7],
[-0.3, -0.3, -0.3]],
[[-0.1, -0.3, np.nan],
[-0.2, -0.3, np.nan],
[-0.1, np.nan, np.nan]]])
Run Code Online (Sandbox Code Playgroud)
我想计算每个像素的线性回归,将获得的R平方,P值,截距和斜率为每个xy像素y_array,为每个时间步长值 …