Skip to content

Instantly share code, notes, and snippets.

@celoyd
Created March 31, 2020 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save celoyd/e999af52aaf99736f9b89929b1e1f7ec to your computer and use it in GitHub Desktop.
Save celoyd/e999af52aaf99736f9b89929b1e1f7ec to your computer and use it in GitHub Desktop.
import himawari.HimawariScene as hsd
from sys import argv
import rasterio as rio
import numpy as np
scaleup = 64
scene = hsd.HimawariScene(argv[1])
rad = scene.radiances()
rad[rad.mask] = 0
rad = np.clip(rad.data, 0, 65535/scaleup)
rad = (rad * scaleup).astype(np.uint16)
meta = {
'driver': 'GTiff',
'count': 1,
'height': rad.shape[0],
'width': rad.shape[1],
'dtype': np.uint16,
'compress': 'LZW'
}
with rio.open(argv[2], 'w', **meta) as dst:
dst.write(rad, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment