Created
May 22, 2015 18:14
-
-
Save celoyd/4fd5cb6d51b28286c381 to your computer and use it in GitHub Desktop.
Convert a Landsat GCP (http://landsat.usgs.gov/ground_control_points.php) to a TIFF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import numpy as np | |
| import sys | |
| import rasterio as rio | |
| chip = open(sys.argv[1]).read(4096) | |
| chip = np.fromstring(chip, dtype='uint8') | |
| chip = chip.reshape(64, 64) | |
| with rio.open(sys.argv[2], 'w', driver='GTiff', width=chip.shape[1], height=chip.shape[0], count=1, dtype='uint8') as dst: | |
| dst.write_band(1, chip) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment