Skip to content

Instantly share code, notes, and snippets.

@celoyd
Created May 22, 2015 18:14
Show Gist options
  • Select an option

  • Save celoyd/4fd5cb6d51b28286c381 to your computer and use it in GitHub Desktop.

Select an option

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
#!/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