I'm trying to get a matrix, (lat, lon) size, with the Pearson Coefficient value for every grid point, for
x : a 3D DataArray (time, lat, lon) (time size is 30)
y : a DataArray column vector with a 30 values series inside
So i would like to calculate the pearson coefficient for every (lat,lon) for a column vector of 30 elements for x.
I tried:
corrmap = xr.DataArray(x2)
for i in range(len(corrmap['lat']))
for j in range(len(corrmap['lon']))
corrmap[i, j], p_value = pearsonr(x[:, i, j], y)
but i get this error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
that i cannot perfectly understand in the meaning. Is my method uncorrect? Should i use another type of code to solve my problem?
Any help would be greatly appreciated.