Created
February 3, 2015 00:25
-
-
Save dnomadb/bf744521cb97a9598c4d to your computer and use it in GitHub Desktop.
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 os, rasterio | |
import matplotlib.pyplot as plot | |
basedir = '/Users/dnomadb/Documents/pwat_hrrr/' | |
savedir = '/Users/dnomadb/Documents/pwat_hrrr_pngs/' | |
with rasterio.drivers(): | |
for i in os.listdir(basedir): | |
if i.split('.')[-1] == 'grib': | |
print i | |
# fig = figure() | |
with rasterio.open(os.path.join(basedir, i), 'r') as src: | |
fig = plot.imshow(src.read_band(1), cmap='YlGnBu_r') | |
plot.axis('off') | |
fig.axes.get_xaxis().set_visible(False) | |
fig.axes.get_yaxis().set_visible(False) | |
plot.savefig(os.path.join(savedir, i.replace('.grib', '.png')),bbox_inches='tight') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment