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 312203596,MDU6SXNzdWUzMTIyMDM1OTY=,2042,"Anyone working on a to_tiff? Alternatively, how do you write an xarray to a geotiff? ",601025,closed,0,,,31,2018-04-07T12:43:41Z,2022-04-09T03:14:41Z,2022-04-09T01:19:10Z,NONE,,,,"Matthew Rocklin wrote a gist to demonstrate using XArray to read tiled GeoTIFF datasets, but I am still confused as to how to write them to a GeoTIFF. I can easily create a tiff with ""rasterio.open(out, 'w', **src.profile)"", but the following does not seem like the best/cleanest way to do this: ``` ds = xr.open_rasterio('myfile.tif', chunks={'band': 1, 'x': 2048, 'y': 2048}) with rasterio.open('myfile.tif', 'r') as src: with rasterio.open('new_myfile.tif', 'w', **src.profile) as dst: for i in range(1, src.count + 1): dst.write(ds.variable.data[i-1].compute(), i) ``` Also, if the profile and tags were propagated through open_rasterio, then the second open would not be necessary and would be generally useful.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2042/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 315149637,MDU6SXNzdWUzMTUxNDk2Mzc=,2065,how do you flatten an xarray?,601025,closed,0,,,5,2018-04-17T17:01:35Z,2018-05-18T05:14:31Z,2018-05-18T05:14:31Z,NONE,,,,"I got a version of TomAugspurger's Spectral Clustering modified to work with GeoTIFFs , and I have been working to modify it to run using xarrays . I'm currently stuck on getting the xarray flattened/reduced. I keep getting errors similar to: ""TypeError: 'axis' is an invalid keyword argument for this function"" no matter what I have tried. I need to find some way to change the array into nbands x (1 x N). I have not been able to figure out how to do this via the examples or docs I've read. Suggestions? Also if you have other suggestions on how to clean up either example let me know. Also, these are using publicly available data and will be free to post some place if desired.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2065/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue