Skip to content

Instantly share code, notes, and snippets.

@willrayeo
Created May 4, 2021 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willrayeo/d16883edbef5ac8dce62938176ca775a to your computer and use it in GitHub Desktop.
Save willrayeo/d16883edbef5ac8dce62938176ca775a to your computer and use it in GitHub Desktop.
# assign all pixels equal or smaller than -20 a value of 1 and preserve the values of pixels
step1 = s1_cube.VV_dB.where(s1_cube.VV_dB >= -20, 1)
# assign all other pixels a value of 0.
flooded = step1.where(step1 == 1, 0)
flooded.attrs['long_name']='flooded'
flooded.attrs['units']='nounits'
s1_cube['flooded']= flooded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment