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/7299#issuecomment-1330164500,https://api.github.com/repos/pydata/xarray/issues/7299,1330164500,IC_kwDOAMm_X85PSLMU,1217238,2022-11-29T06:53:48Z,2022-11-29T06:53:48Z,MEMBER,"> Difference between empty and non-empty arrays comes from different logic used for empty arrays in `Variable._getitem_with_mask`. > > The problem itself can be solved by fixing `dtypes.maybe_promote` to return `fill_value=np.float32('nan')` instead of `fill_value=np.nan` on `dtype('float32')` input. Thanks for the excellent report! I agree, this sounds like a good fix to me. I think something like the following would work: Replace the return line of `maybe_promote` ```python return np.dtype(dtype), fill_value ``` with ```python dtype = np.dtype(dtype) fill_value = dtype.type(fill_value) return dtype, fill_value ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1455771929 https://github.com/pydata/xarray/issues/7299#issuecomment-1329743185,https://api.github.com/repos/pydata/xarray/issues/7299,1329743185,IC_kwDOAMm_X85PQkVR,2448579,2022-11-28T20:46:50Z,2022-11-28T20:46:50Z,MEMBER,"> The problem itself can be solved by fixing dtypes.maybe_promote to return fill_value=np.float32('nan') instead of fill_value=np.nan on dtype('float32') input. This seems like better behaviour to me. @shoyer, what do you think?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1455771929