added warning messages if input lulc rasters have undefined nodata. #BITBUCKET-3851.

This commit is contained in:
David Fisher 2019-02-21 16:26:57 -08:00
parent d74414aebc
commit 50c7adc259
3 changed files with 10 additions and 1 deletions

View File

@ -142,6 +142,11 @@ def execute(args):
pixel_area_ha = numpy.product([
abs(x) for x in landcover_raster_info['pixel_size']]) / 10000.0
landcover_nodata = landcover_raster_info['nodata'][0]
if landcover_nodata is None:
LOGGER.warning(
"%s does not have nodata value defined; "
"assuming all pixel values are valid"
% args['landcover_raster_path'])
# Calculate lat/lng bounding box for landcover map
wgs84srs = osr.SpatialReference()

View File

@ -226,6 +226,11 @@ def execute(args):
pixel_area_ha = numpy.product([
abs(x) for x in landcover_raster_info['pixel_size']]) / 10000.0
landcover_nodata = landcover_raster_info['nodata'][0]
if landcover_nodata is None:
LOGGER.warning(
"%s does not have nodata value defined; "
"assuming all pixel values are valid"
% args['landcover_raster_path'])
# Calculate lat/lng bounding box for landcover map
wgs84srs = osr.SpatialReference()

View File

@ -30,7 +30,6 @@ def make_simple_raster(base_raster_path, fill_val, nodata_val):
n = 10
gtiff_driver = gdal.GetDriverByName('GTiff')
# raster_path = os.path.join(self.workspace_dir, 'small_raster.tif')
new_raster = gtiff_driver.Create(
base_raster_path, n, n, 1, gdal.GDT_Int32, options=[
'TILED=YES', 'BIGTIFF=YES', 'COMPRESS=LZW',