html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/448#issuecomment-116412391,https://api.github.com/repos/pydata/xarray/issues/448,116412391,MDEyOklzc3VlQ29tbWVudDExNjQxMjM5MQ==,1217238,2015-06-29T03:26:39Z,2015-06-29T03:26:39Z,MEMBER,"Xray doesn't use numpy ndarray subclasses, mostly because that would tie our underlying array implementations to numpy and stop us from using interesting alternative array implementations like [dask](http://dask.pydata.org/en/latest/array.html). Hence, `np.asanyarray` does not work either. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,91676831 https://github.com/pydata/xarray/issues/448#issuecomment-116411269,https://api.github.com/repos/pydata/xarray/issues/448,116411269,MDEyOklzc3VlQ29tbWVudDExNjQxMTI2OQ==,10137,2015-06-29T03:22:52Z,2015-06-29T03:22:52Z,NONE,"I agree that it's the point with np.asarray, but given the implementation you'd think np.asanyarray would work. My initial takeaway (until examining the source) was that this was an ndarray with additional attributes and properties. Perhaps, I'm leaning too far towards numpy and too far away from pandas. As background: my usage involves RF pattern data which typically involves a lot of independent variables to lug around as well as the measured data. I'll look into your other suggestions. Thank you for your reply. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,91676831 https://github.com/pydata/xarray/issues/448#issuecomment-116406425,https://api.github.com/repos/pydata/xarray/issues/448,116406425,MDEyOklzc3VlQ29tbWVudDExNjQwNjQyNQ==,1217238,2015-06-29T03:13:33Z,2015-06-29T03:13:33Z,MEMBER,"Unfortunately, there's no way to make `np.asarray` return anything other than a numpy array without metadata -- that's kind of the entire point of `asarray`. We do have some other options, though. The first two already work: - use `xray.Dataset.apply` to call a function, e.g., `ds.apply(db2w)` - write a numpy universal function using numba: ``` python @numba.vectorize def db2w(arr): return 10 ** (arr / 20.0) ``` - we could write a modified version of `asarray` that passes through xray objects - we could write a decorator that transforms a function to preserve/restore xray metadata, e.g., ``` python def keep_metadata(func): def wrapper(array, **kwargs): return array.__array_wrap__(func(array)) return wrapper @keep_metadata def db2w(arr): return 10 ** (np.asarray(arr) / 20.0) ``` ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,91676831