Commit 67c19433 authored by Daniel Scheffler's avatar Daniel Scheffler Committed by Mathias Peters
Browse files

updated assertion from last commit

geo.coord_calc.calc_FullDataset_corner_positions(): updated assertion

- updated __version__
parent 911f5847
......@@ -15,7 +15,7 @@ __all__=[#'compatibility',
'similarity',
'GeoArray']
__version__ = '20170124_01'
__version__ = '20170124_02'
__author__='Daniel Scheffler'
# Validate GDAL version
......
......@@ -30,8 +30,8 @@ def get_corner_coordinates(gdal_ds=None, gt=None, cols=None, rows=None):
def calc_FullDataset_corner_positions(mask_1bit, assert_four_corners=True, algorithm='shapely'):
# type: (np.ndarray, bool, str) -> list
"""
Calculates the image coordinates of the true data corners for rotated datasets.
ONLY usable for entire images - no tiles!
Calculates the image coordinates of the true data corners from a nodata mask.
NOTE: Algorithm 'shapely' calculates the corner coordinates of the convex hull of the given mask. Since the convex
hull not always reflects all of the true corner coordinates the result can have a limitation in this regard.
......@@ -41,9 +41,13 @@ def calc_FullDataset_corner_positions(mask_1bit, assert_four_corners=True, algor
:return: [UL, UR, LL, LR] as [(ULrow,ULcol),(URrow,URcol),...]
"""
# check if the mask extent covers real data or only nodata
pixVals = np.unique(mask_1bit)
assert True in pixVals or 1 in pixVals, 'According to the given mask the mask extent is completely outside the ' \
'image. No calculation of image corner coordinates possible.'
if not (True in pixVals or 1 in pixVals):
# 'According to the given mask the mask extent is completely outside the image.
# No calculation of image corner coordinates possible.'
return []
rows, cols = mask_1bit.shape[:2]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment