Skip to content

Instantly share code, notes, and snippets.

@DanielJDufour
Created December 18, 2018 23:00
Show Gist options
  • Save DanielJDufour/a6ccdf62230a7a2f31c5ab9cb6f3f977 to your computer and use it in GitHub Desktop.
Save DanielJDufour/a6ccdf62230a7a2f31c5ab9cb6f3f977 to your computer and use it in GitHub Desktop.
from collections import Counter
import numpy as np
import rasterio as rio
from sys import argv
_, filepath = argv
def pad(string):
length = len(string)
padding = 10 - length
return string + " " * padding
with rio.open(filepath) as src:
firstband = src.read().tolist()
for bandid, band in enumerate(src.read()):
print("band:", bandid)
for rowid, row in enumerate(band):
print(pad(rowid + ":", 10))
for colid, cell in enumerate(row.tolist()):
#print(str(bandid) + ":" + str(rowid) + ":" + str(colid) + " >> " + str(cell) + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment