id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 841012076,MDU6SXNzdWU4NDEwMTIwNzY=,5075,Losing data when add a raster to a dataset,18444902,open,0,,,13,2021-03-25T14:54:05Z,2021-05-05T15:40:30Z,,NONE,,,,"As I mentioned [here](https://github.com/corteva/geocube/issues/62), when I add a raster inside a [geocube](https://github.com/corteva/geocube) are produced a lot of nodata. After a test @snowman2 has [indicates](https://github.com/corteva/geocube/issues/62#issuecomment-806283019) that this is a possible bug of xarray libraries. > I was able to reproduce the issue you demonstrated. I think it has to do with decimal precision of the coordinates when adding the DataArray to the Dataset. That being said, I checked that the `x` coordinate and `y` coordinates were the exact same for `raster_in` and `out_grid`. This is likely an issue with `xarray` and not `geocube`. > > For a workaround, this got it working without the gaps for me: > > ```python > import geopandas > import rioxarray > from geocube.api.core import make_geocube > > vector_in = geopandas.read_file(""vector_data.shp"") > raster_in = rioxarray.open_rasterio(""raster_data.tif"", masked=True).sel(band=1).drop(""band"") > > out_grid = make_geocube( > vector_data=vector_in, > measurements=[""id""], > like=raster_in, > ) > > out_grid[""process_value""] = (raster_in.dims, raster_in.values, raster_in.attrs, raster_in.encoding) > ``` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5075/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue