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/2267#issuecomment-405950145,https://api.github.com/repos/pydata/xarray/issues/2267,405950145,MDEyOklzc3VlQ29tbWVudDQwNTk1MDE0NQ==,1200058,2018-07-18T14:26:58Z,2018-07-18T14:27:35Z,NONE,"Maybe related: Consider the following example to calculate pairwise distances: ``` x = np.array([[1,2,3,4]]) dist = x.T - x ``` numpy automatically broadcasts the one-dimensions to get 4x4 matrices and substracts them. As far as I can see, this example is really hard to recreate with xarray, since there is nearly no possibility to add a new dimension to `x` and broadcast it properly.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,338226520 https://github.com/pydata/xarray/issues/2267#issuecomment-402528134,https://api.github.com/repos/pydata/xarray/issues/2267,402528134,MDEyOklzc3VlQ29tbWVudDQwMjUyODEzNA==,1200058,2018-07-04T17:06:51Z,2018-07-04T17:06:51Z,NONE,@shoyer so there is no direct xarray equivalent to np.broadcast_to?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,338226520 https://github.com/pydata/xarray/issues/2267#issuecomment-402524911,https://api.github.com/repos/pydata/xarray/issues/2267,402524911,MDEyOklzc3VlQ29tbWVudDQwMjUyNDkxMQ==,1200058,2018-07-04T16:45:39Z,2018-07-04T16:45:39Z,NONE,"As an explanation: I'd like to change my program to only use lazy / chunked calculations in order to save RAM. I recognized that np.broadcast_to converts the DataArray into a numpy one. Therefore I needed some xarray way to solve this. I tried: ```python DataArray.expand_dims(""new_dim"").isel(""new_dim"", np.repeat(0, target_dim_size)) ``` but this really looks ugly and I'm not sure about the performance implications of this.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,338226520 https://github.com/pydata/xarray/issues/2267#issuecomment-402459865,https://api.github.com/repos/pydata/xarray/issues/2267,402459865,MDEyOklzc3VlQ29tbWVudDQwMjQ1OTg2NQ==,1200058,2018-07-04T12:07:49Z,2018-07-04T12:18:54Z,NONE,"No, I'd need something like np.tile. expand_dims inserts only a dimension of length '1'","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,338226520