Skip to content

Instantly share code, notes, and snippets.

@rafaqz
Last active June 15, 2018 03:33
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 rafaqz/f43833deaffc37c8c50ff9cae6a8e334 to your computer and use it in GitHub Desktop.
Save rafaqz/f43833deaffc37c8c50ff9cae6a8e334 to your computer and use it in GitHub Desktop.
Load a world raster with ArchGDAL and crop australia
using ArchGDAL
function readtiff(file)
img = ArchGDAL.registerdrivers() do
ArchGDAL.read(file) do dataset
ArchGDAL.read(dataset)
end
end
img ./= maximum(img)
img .= max.(0.0, img)
img = img[:,:,1]'
end
cropaust(x) = x[950:1350, 3100:3600] # Australia
world_suitability = readtiff("your/path/limited_growth_2017_06.tif")
suit = cropaust(world_suitability)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment