Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def do_stats(self, exclude=(0, )):
- """ do some stats on the integer types in the array.
- returns the area of cells for each type found in the array.
- you can use this after masking to only calc inside the polygon.
- """
- raster_info = self.agoodle.raster_info
- classes = np.unique(self)
- cell_area = abs(raster_info.xsize * raster_info.ysize)
- stats = {}
- for cls in (c for c in classes if c not in exclude):
- stats[cls] = len(self[self == cls]) * cell_area
- return stats
Add Comment
Please, Sign In to add comment