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
| import click | |
| import rasterio as rio | |
| import os | |
| import numpy as np | |
| import re | |
| from sys import argv, exit | |
| from math import sin, radians | |
| def get_mtl_path(bundle_path): | |
| mtls = [ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 rasterio as rio | |
| import numpy as np | |
| import sys | |
| with rio.open(sys.argv[1], 'r') as src: | |
| meta = src.meta | |
| cplx = src.read(1) |
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) |
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 | |
| # Very simple rasterio NDVI (or general normalized difference ratio) demo. | |
| # python ndvi.py $landsat_scene/*B{4,5}.TIF ndvi.tif | |
| import rasterio as rio | |
| from sys import argv | |
| import numpy as np | |
| math_type = np.float32 # type for internal calculations |
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
| -- copy eight from '/Users/ch/Desktop/meta/LANDSAT_8.csv' delimiter ',' CSV header; | |
| create type sensor_t as enum ('OLI_TIRS', 'OLI', 'TIRS'); | |
| create type daynight_t as enum ('DAY', 'NIGHT'); | |
| create type datatype_t as enum ('L1GT', 'L1T', 'PR'); | |
| create type nadir_t as enum ('NADIR', 'OFFNADIR'); | |
| create table eight ( | |
| sceneID text primary key, | |
| sensor sensor_t, |
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 sys | |
| import os | |
| import numpy | |
| from osgeo import gdal, gdal_array | |
| TAIL_TRIM = 0.01 |
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 | |
| # not properly tested | |
| from sys import argv | |
| from PIL import Image | |
| import numpy as np | |
| A, B = ( | |
| np.asarray(Image.open(x)).astype(np.float32) |
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
| # Beta-quality Landsat 8-oriented windowed pansharpener by Charlie Loyd | |
| # python3 panchunk.py $SCENE/*B{4,3,2,8}.TIF ${SCENE}-pansharp.tif | |
| # Then you may want something like this to brighten it up: | |
| # convert -channel B -gamma 0.96 -channel RGB -sigmoidal-contrast 40,14% ${SCENE}-pansharp.tif ${SCENE}-pretty.tif | |
| # But that will strip geo tags. | |
| import asyncio | |
| import rasterio as rio |
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
| # To help with https://xkcd.com/936/ | |
| randword () { | |
| dict=/usr/share/dict/words | |
| r=$((($RANDOM * $RANDOM) % `wc -l $dict | awk '{print $1}'`)) | |
| head -n $r $dict | tail -n 1 | |
| } |