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/2176#issuecomment-391481382,https://api.github.com/repos/pydata/xarray/issues/2176,391481382,MDEyOklzc3VlQ29tbWVudDM5MTQ4MTM4Mg==,1217238,2018-05-23T20:14:26Z,2018-05-23T20:14:26Z,MEMBER,"If you implement arithmetic special methods like `__add__` and `__radd__` on your accessor, you could write things like:
```
dt = DataArray(timestep.total_seconds(), attrs={'units': 's'})
for key in tendencies_list[0].keys():
return_state[key] = state[key].sympl + dt.sympl * (
1.5 * tendencies_list[-1][key].sympl - 0.5 * tendencies_list[-2][key].sympl
)
```
It's awkward but you can still use the infix notation.
Subclassing or writing a DataArray wrapper like what @kmpaul did in physarrays seems like the cleanest way to do this currently. The main challenge is to avoid relying on non-public parts of the DataArray API, but I think overwriting arithmetic would be pretty safe.
In the long term, I think the best solution here is probably an extensible interface for `data` in xarray objects that would let you put an array with units into an xarray object, similar to the hooks we want for sparse arrays (https://github.com/pydata/xarray/issues/1938).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,325810810
https://github.com/pydata/xarray/issues/2176#issuecomment-391441974,https://api.github.com/repos/pydata/xarray/issues/2176,391441974,MDEyOklzc3VlQ29tbWVudDM5MTQ0MTk3NA==,2443309,2018-05-23T17:59:32Z,2018-05-23T17:59:32Z,MEMBER,cc @KMPaul who has also been working on this sort of thing recently. ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,325810810