ClimateImpactLab / open-estimate

Crowd-Sourcing Model Aggregation Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FutureWarning for calling len() on xarray.Dataset in openest/generate/daily.py:251

brews opened this issue · comments

Projection runs using YearlyAverageDay emit:

/home/bmalevich/miniconda3/envs/labor_ag/lib/python3.7/site-packages/openest/generate/daily.py:251: FutureWarning: calling len() on an xarray.Dataset will change in xarray v0.11 to only include data variables, not coordinates. Call len() on the Dataset.variables property instead, like ``len(ds.variables)``, to preserve existing behavior in a forwards compatible manner.
  diagnostic.record(region, year, 'zero', float(np.nansum(curve(temps2) == 0)) / len(temps2))

This is an issue for runs using xarray pre-v0.11.

Simplest solution solution is to just swap code to len(ds.variables), as suggested.