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/pull/5365#issuecomment-893887471,https://api.github.com/repos/pydata/xarray/issues/5365,893887471,IC_kwDOAMm_X841R6Pv,14808389,2021-08-05T23:24:53Z,2021-08-05T23:24:53Z,MEMBER,"we discussed this in the meeting yesterday, and decided that since it makes the code cleaner and there's the `dim` parameter of `to_array` and `to_dataset` (which I didn't know about when I suggested the ugly `to_unstacked_array` hack) we would like to restrict `.cross` to accept only `DataArray` objects. Could you make that change? To increase their visibility it would probably also be good to show how to use `to_array` and `to_dataset` to pass `Dataset` objects to `.cross`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-886951200,https://api.github.com/repos/pydata/xarray/issues/5365,886951200,IC_kwDOAMm_X8403c0g,14808389,2021-07-26T19:03:21Z,2021-07-26T19:03:21Z,MEMBER,"The use case is something similar to: ```python ds = xr.Dataset({""x"": (""t"", [0, 1]), ""y"": (""t"", [2, 3]), ""z"": (""t"", [4, 5])}) arr = xr.DataArray(data=[0, 2, 4], dims=""cartesian"", coords={""cartesian"": [""x"", ""y"", ""z""]}) xr.cross(arr, ds, dim=""cartesian"") # result: Dataset with x, y, z variables ``` This does return what I want it to (which is why I don't think it is a bug), but my worry was that since `ds` does not have a dimension called `""cartesian""` it might be surprising that this works (though good documentation might help). In any case, I'd like to get the opinion of other maintainers: is the integrated conversion worth the trouble, or should we make combining / splitting variables easier?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-886712077,https://api.github.com/repos/pydata/xarray/issues/5365,886712077,IC_kwDOAMm_X8402icN,14808389,2021-07-26T13:38:53Z,2021-07-26T13:38:53Z,MEMBER,"I finally got around to testing this. This works really well for the use cases I tried, but the automatic conversion of `Dataset`s with three variables to a `DataArray` is a bit surprising: ```python xr.cross(arr, ds, dim=""cartesian"") # ← ds does not have a ""cartesian"" dimension ``` not sure what to do about that. @pydata/xarray, any ideas? To be clear, the idea was to have a convenient way to convert a `Dataset` with three identically dimensioned variables to a `DataArray` with an additional additional dimension. If there's a concise way to do that I would lean towards not doing that in `cross()` (even though I was the one to propose it). For example: ```python xr.cross( arr, ds.to_array(concat_dim=""cartesian""), dim=""cartesian"" ).to_dataset(cut_dim=""cartesian"") ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876