issue_comments: 269089778
This data as json
| 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/1151#issuecomment-269089778 | https://api.github.com/repos/pydata/xarray/issues/1151 | 269089778 | MDEyOklzc3VlQ29tbWVudDI2OTA4OTc3OA== | 6213168 | 2016-12-24T15:57:27Z | 2016-12-24T15:57:27Z | MEMBER | I updated the code and tested it in my project - it works fine. Any suggestions before I start integrating it inside xarray.broadcast()? ``` def broadcast_scalar_coords(*args, exclude=()): """Broadcast scalar coords whenever they're unambiguous, and remove them when they are ambiguous. This allows replicating the behaviour of addition or moltiplication of xarrays in concatenation. """ unambiguous = {} ambiguous = set() for arg in args: for k, v in arg.coords.items(): if k in exclude: continue # non-scalar coords are automatically ambiguous if v.shape == (): if k not in ambiguous: v = v.values.tolist() if unambiguous.get(k, v) != v: del unambiguous[k] ambiguous.add(k) else: unambiguous[k] = v else: ambiguous.add(k) unambiguous.pop(k, None)
``` |
{
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} |
193294569 |