ks905383 / xagg

Aggregating gridded data (xarray) to polygons

Home Page:https://xagg.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mistaken use of ds.var() in `core.py`?

jrising opened this issue · comments

In core.py, there are a few loops of the form: for var in ds.var():.

This tries to compute a variance across all dimensions, for each variable. Is that the intention? I think you just mean for var in ds:.

Note that if any variables are of a type for which var cannot be computed (e.g., timedelta64[ns]) then aggregate fails.

Yikes, yeah that's definitely a bug. Weird that it hasn't triggered any of the tests yet...

Yeah, should likely be for var in ds:

Thanks for pointing this out, will take a look.

Ok thankfully it hasn't caused any computational problems, since for types for which ds.var() doesn't fail [var for var in ds.var()] returns the same thing as [var for var in ds] (with an additional computation time of course). But it definitely needs to get fixed - it'll be out in the next minor release.

Thanks!