Use Xarray to Save Dataarray as geoTiff, Without Using Ram Memory

I need to modify a very large geoTif file (over 200GB), however when I save it my code crashes as it loads the file in memory. The code looks like this.

import xarray as xr

#  open the file
ds = xr.open_rasterio('file.tif')

# modify here
.....

# this part uses too much memory and gives me the problem
ds.rio.to_raster('output.tif')

Is there any way to save the file as a tif, without loading it all in memory?

2
Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article