Skip to content

Commit

Permalink
adding negative operation to Raster class
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Bierbower authored and Will Bierbower committed Apr 17, 2015
1 parent 163d96a commit f2367b9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fauxgeo/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def __str__(self):
string += '\nBand 1:\n' + self.get_band(1).__repr__()
string += self.get_affine().__repr__()
string += '\nNoData for Band 1: ' + str(self.get_nodata(1))
string += '\nDatatype for Band 1: ' + str(self.get_band(1).dtype)
string += '\nProjection (EPSG): ' + str(self.get_projection())
string += '\nuri: ' + self.uri
string += '\n'
Expand All @@ -104,6 +105,13 @@ def __str__(self):
def __len__(self):
return self.band_count()

def __neg__(self):
def neg_closure(nodata):
def neg(x):
return np.where((np.not_equal(x, nodata)), np.negative(x), nodata)
return neg
return self.local_op(None, neg_closure, broadcast=True)

def __mul__(self, raster):
if type(raster) in [float, int]:
def mul_closure(nodata):
Expand Down

0 comments on commit f2367b9

Please sign in to comment.