Skip to content

Commit

Permalink
changing assert statements to explicitly raise AssertionError rather …
Browse files Browse the repository at this point in the history
…than make use of assert statement
  • Loading branch information
wbierbower committed Sep 8, 2015
1 parent 2e06225 commit 99218ee
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions fauxgeo/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@ def is_aligned(self, raster):
def align(self, raster, resample_method):
'''Currently aligns other raster to this raster - later: union/intersection
'''
assert(self.get_projection() == raster.get_projection())
if not self.get_projection() == raster.get_projection():
raise AssertionError("Different Projections")

def dataset_pixel_op(x, y): return y
dataset_uri_list = [self.uri, raster.uri]
Expand Down Expand Up @@ -771,7 +772,8 @@ def dataset_pixel_op(x, y): return y
def align_to(self, raster, resample_method):
'''Currently aligns self to provided raster - later: union/intersection
'''
assert(self.get_projection() == raster.get_projection())
if not self.get_projection() == raster.get_projection():
raise AssertionError("Different Projections")

def dataset_pixel_op(x, y): return y

Expand Down Expand Up @@ -945,13 +947,11 @@ def local_op(self, raster, pixel_op_closure, broadcast=False):
resample_method = "nearest"

if not broadcast:
assert(self.is_aligned(raster))
try:
assert(self.get_nodata(1) == raster.get_nodata(1))
except AssertionError:
LOGGER.error("Rasters have different nodata values: %f, %f" % (
if not self.is_aligned(raster):
raise AssertionError("Not Aligned")
if not self.get_nodata(1) == raster.get_nodata(1):
raise AssertionError("Rasters have different nodata values: %f, %f" % (
self.get_nodata(1), raster.get_nodata(1)))
raise AssertionError
dataset_uri_list = [self.uri, raster.uri]
resample_list = [resample_method]*2
else:
Expand Down

0 comments on commit 99218ee

Please sign in to comment.