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/7834#issuecomment-1543526954,https://api.github.com/repos/pydata/xarray/issues/7834,1543526954,IC_kwDOAMm_X85cAFoq,5821660,2023-05-11T08:03:01Z,2023-05-11T08:03:01Z,MEMBER,"@mx-moth Yes, this casting should be fixed. I'm adding a bit of context here, as this might need to be solved in combination with #7098 and #7827. #7098 removes undefined casting for decoding. In #7827 there are efforts to do this for encoding, too. As `cast_to_int_if_safe` is called for encoding as well as decoding I'm not sure if all cases have been catched by these two PR. One issue on decoding is that at least for datetime64 based times the calculated `time_deltas` are currently converted to float64 in the presence of `NaT` (although `NaT` can perfectly be expressed as int64). It would be great if you could try your PR on top of #7827 (which includes #7098) to see if that fixes the errors in this PR.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1705163672