Skip to content

grid vars nan values breaking aggr

At the gridding step the array math is resulting in NaN value that cause issues at the aggregation step. This may be due to a change in numpy, I'm not sure.

Evidence of this issue can be seen in a warning printed to stderr:

/data/brucef/code/yori/yori/gridtools.py:133: UserWarning: Warning: converting a masked element to nan.
  varmean[sgrididx[grid_box_idx[i]]] = np.mean( var[sortidx[grid_box_idx[i]:grid_box_idx[i+1]]] )

var is a masked array and np.mean is resulting in a masked value. However, varmean is not a masked array, so setting the masked value result of np.mean to a non-masked array numpy sets it to nan resulting in the warning.