I have the following script using rasterio:
if not os.path.isfile(out_dir + os.sep + name_adm1 + '.tif'):
with rasterio.drivers():
with rasterio.open(constants.ras_cmask) as src:
b1 = src.read(1)
profile = src.profile
profile.update(
dtype=rasterio.float64,
count=1,
compress='lzw')
ndvi = b1.astype(float)
ndvi[ndvi != int(num_ID)] = np.nan
with rasterio.open(out_dir + os.sep + name_adm1 + '.tif', 'w', **profile) as dst:
dst.write(ndvi.astype(rasterio.float64), 1)
However, when I run it, it produces a lot of messages like this:
03/13/2016 13:40:22 rasterio DEBUG Creating a not-responsible GDALEnv in drivers()
03/13/2016 13:40:22 rasterio DEBUG Got coordinate system
03/13/2016 13:40:22 rasterio DEBUG Got coordinate system
03/13/2016 13:40:22 rasterio DEBUG Input CRS: {'init': u'epsg:4326'}
03/13/2016 13:40:22 rasterio DEBUG Exported WKT: GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
03/13/2016 13:40:22 rasterio DEBUG Self CRS: {'init': u'epsg:4326'}
03/13/2016 13:40:22 rasterio DEBUG Got coordinate system
03/13/2016 13:40:22 rasterio DEBUG Got coordinate system
03/13/2016 13:40:23 rasterio DEBUG Option: ('BLOCKYSIZE', '1')
03/13/2016 13:40:23 rasterio DEBUG Option: ('COMPRESS', 'LZW')
03/13/2016 13:40:23 rasterio DEBUG Option: ('BLOCKXSIZE', '7200')
03/13/2016 13:40:23 rasterio DEBUG Option: ('TILED', 'FALSE')
Warning 6: driver ENVI does not support creation option BLOCKYSIZE
Warning 6: driver ENVI does not support creation option COMPRESS
Warning 6: driver ENVI does not support creation option BLOCKXSIZE
Warning 6: driver ENVI does not support creation option TILED
Warning 6: driver ENVI does not support creation option BLOCKYSIZE
Warning 6: driver ENVI does not support creation option COMPRESS
Warning 6: driver ENVI does not support creation option BLOCKXSIZE
Is there a way to either suppress these, or redirect to logging file?