Skip to content

Commit

Permalink
Cleanup comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiddelkoop committed Dec 13, 2021
1 parent fd38405 commit 7b9dd20
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions landsat/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
import os
import rasterio

# Open the first directory, could walk entire tree
# Open the first directory in data, could walk entire tree
for dirname, dirs, files in os.walk('data'):
source = dirs[0]
break

# Open band (B2/Blue) and copy metadata for result.
with rasterio.open("data/%s/%s_B2.TIF" % (source, source)) as band2:
meta = band2.meta

# Combine bands into PNG
meta.update(count = 3, driver='PNG')
with rasterio.open('output/result.png', 'w+', **meta) as output:
for i in range(1, 4):
print(i)
output.write_band(i,rasterio.open("data/%s/%s_B%d.TIF" % (source, source, i+3)).read(1)) # Red
output.write_band(i,rasterio.open("data/%s/%s_B%d.TIF" % (source, source, i+3)).read(1))

0 comments on commit 7b9dd20

Please sign in to comment.