Skip to content

Commit

Permalink
adding random_from_list method to RasterFactory class
Browse files Browse the repository at this point in the history
  • Loading branch information
wbierbower committed Apr 23, 2015
1 parent ce2de9c commit d96f85f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fauxgeo/raster_factory.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'''
RasterFactory Class
'''
import random

import numpy as np
from affine import Affine
Expand Down Expand Up @@ -46,6 +47,13 @@ def random(self):
a = np.random.rand(self.rows, self.cols)
return self._create_raster(a)

def random_list(self, l):
a = np.array((self.rows, self.cols))
for i in xrange(len(a)):
for j in xrange(len(a[0])):
a[i, j] = random.choice(l)
return self._create_raster(a)

def horizontal_ramp(self, val1, val2):
a = np.zeros((self.rows, self.cols))
col_vals = np.linspace(val1, val2, self.cols)
Expand Down

0 comments on commit d96f85f

Please sign in to comment.