Skip to content

Commit

Permalink
adding sum method to raster class
Browse files Browse the repository at this point in the history
  • Loading branch information
wbierbower committed Apr 30, 2015
1 parent 1301280 commit 19b38e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fauxgeo/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import PIL
import pygeoprocessing as pygeo

from fauxgeo.vector import Vector
from fauxgeo.affine import Affine

LOGGER = logging.getLogger('Raster Class')
Expand Down Expand Up @@ -356,9 +357,9 @@ def get_heatmap_image(self):
raise NotImplementedError

def sum(self):
# pygeo.calculate_raster_stats_uri(self.uri)
# mini, maxi, mean, stddev = pygeo.get_statistics_from_uri(self.uri)
raise NotImplementedError
vector = Vector.from_shapely(self.get_aoi(), self.get_projection())
t = pygeo.aggregate_raster_values_uri(self.uri, vector.uri)
return t.total[9999]

def min(self):
pygeo.calculate_raster_stats_uri(self.uri)
Expand Down
1 change: 1 addition & 0 deletions tests/test_raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ def test_std(self):

def test_sum(self):
raster = self.factory.alternating(1.0, -9999)
print raster
assert(raster.sum() == 8.0)

class TestRasterMinimum(unittest.TestCase):
Expand Down

0 comments on commit 19b38e8

Please sign in to comment.