You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
missing_value = scs_full_cube.data.fill_value
slope = np.zeros(cube.data[0,:,:].shape)
for x in range(0,len(lons)):
for y in range(0,len(lats)):
arr =cube.data.data[:,x,y]
ind = np.where(arr < 366)[0]
if len(ind) < len(arr)*0.8: # if 20% of points are missing then set to missing value (ignore it in plot)
slope[x,y] = missing_value
else:
slope[x,y], intercept, r_value, p_value, std_err = stats.linregress(years[ind], arr[ind])
# create new mask and add to cube
new_mask = np.zeros(slope.shape)
new_mask[ slope == missing_value] = 1.
new_mask = new_mask.astype(bool) # convert to boolean array (True/False)
mx = ma.masked_array(slope, mask=new_mask)
The text was updated successfully, but these errors were encountered:
scotthosking
changed the title
Ignore missing values when calculation trend
Ignore missing values when calculating trend
Feb 2, 2018
The text was updated successfully, but these errors were encountered: