Skip to content

Commit

Permalink
Fix Issue 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Bierbower authored and Will Bierbower committed Apr 20, 2015
1 parent 68456c3 commit f817fc1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions fauxgeo/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,12 @@ def ones(self):
return self.zeros() + 1

def zeros(self):
return self * 0
array = self.get_band(1).data * 0
affine = self.get_affine()
proj = self.get_projection()
datatype = self.get_datatype(1)
nodata_val = self.get_nodata(1)
return Raster.from_array(array, affine, proj, datatype, nodata_val)

def band_count(self):
self._open_dataset()
Expand Down Expand Up @@ -559,13 +564,20 @@ def set_datatype(self, datatype):
return Raster.from_array(array, affine, proj, datatype, nodata_val)

def set_nodata(self, nodata_val):
array = self.get_band(1)
array = self.get_band(1).data
src_nodata_val = self.get_nodata(1)
array[array == src_nodata_val] = nodata_val

affine = self.get_affine()
proj = self.get_projection()
datatype = self.get_datatype(1)
return Raster.from_array(array, affine, proj, datatype, nodata_val)

def set_datatype_and_nodata(self, datatype, nodata_val):
array = self.get_band(1).data
src_nodata_val = self.get_nodata(1)
array[array == src_nodata_val] = nodata_val

array = self.get_band(1)
affine = self.get_affine()
proj = self.get_projection()
Expand Down

1 comment on commit f817fc1

@wbierbower
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #4

Please sign in to comment.