Skip to content

Instantly share code, notes, and snippets.

@debboutr
Created October 4, 2017 23:36
Show Gist options
  • Save debboutr/c024e7df0896a6dc275882f78248edbc to your computer and use it in GitHub Desktop.
Save debboutr/c024e7df0896a6dc275882f78248edbc to your computer and use it in GitHub Desktop.
Fill raster cell values that aren't NoData with a single value with georasters
import numpy as np
import georasters as gr
fll = 'D:/Projects/georaster_scrap/old/lakes_05b.tif'
a = gr.from_file(fll)
a.raster.data[:] = 1
a.raster.unshare_mask()
a.nodata_value = 0
a.datatype = 'Byte'
a.to_tiff('D:/Projects/georaster_scrap/test6')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment