Skip to content

Commit

Permalink
Merge pull request #711 from avaldebe/fix-corr
Browse files Browse the repository at this point in the history
fix IndexError on xarray 2022.6.0
  • Loading branch information
avaldebe authored Aug 2, 2022
2 parents bee5311 + 67109d1 commit 28314a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyaerocom/aeroval/coldatatojson_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,8 @@ def _calc_temporal_corr(coldata):
# Use only sites that contain at least 3 valid data points (otherwise
# correlation will be 1).
obs_ok = arr[0].count(dim="time") > 2
arr = arr.where(obs_ok, drop=True)
arr[0] = arr[0].where(obs_ok, drop=True)
arr[1] = arr[1].where(obs_ok, drop=True)
if np.prod(arr.shape) == 0:
return np.nan, np.nan
corr_time = xr.corr(arr[1], arr[0], dim="time")
Expand Down

0 comments on commit 28314a6

Please sign in to comment.