Exemple #1
0
 def setUp(self):
     self.model = Model()
     self.model.objects += [Tree(1, 1, dbh=30.2, height=20, species='Quercus mongolica', stage='adult')]
     self.model.objects += [Tree(0, 1, dbh=18.0, height=20, species='Quercus mongolica', stage='sapling')]
     self.model.objects += [Tree(1, 0, ddh=3.0, height=20, species='Quercus mongolica', stage='seedling')]
     self.model.insert_action(ConstantRadialGrowthAction())
     self.snapshooter = Snapshots()  # Use memory backend by default
Exemple #2
0
 def test_object_container_select_by_type(self):
     tree = Tree(1, 1, species='Mongolian Oak', dbh=30, height=26, ddh=7)
     shrub = Shrub(3, 3, species='Nothing', height=26, diam=7)
     self.model.objects.append(tree)
     self.model.objects.append(shrub)
     self.assertEqual(self.model.objects.select_by_type('tree')[0], tree)
     self.assertEqual(self.model.objects.select_by_type('shrub')[0], shrub)
Exemple #3
0
 def process(self):
     for ind in range(self._treenum):
         tree = Tree(random.uniform(*self._bbox[0]),
                     random.uniform(*self._bbox[1]),
                     species=random.choice(self._treesp),
                     height=random.uniform(*self._heights),
                     dbh=random.uniform(*self._dbhs),
                     stage=self._stage)
         self.model.objects.append(tree)
Exemple #4
0
 def test_tree_ids(self):
     self.tree1 = Tree(1,
                       1,
                       name='mytree',
                       species='Mongolian Oak',
                       dbh=30,
                       height=26,
                       ddh=7)
     self.assertNotEqual(self.tree.id, self.tree1.id)
Exemple #5
0
    def setUp(self):
        # mycrown is example of a tree component
        mycrown = {'par1': 0, 'par2': 12}

        self.tree = Tree(1,
                         1,
                         name='mytree',
                         species='Mongolian Oak',
                         dbh=30,
                         height=26,
                         ddh=7)
Exemple #6
0
 def setUp(self):
     self.model = Model()
     self.model.objects += [Tree(1, 1, dbh=30.2, height=20, species='Quercus mongolica', stage='adult')]
     self.model.objects += [Tree(0, 1, dbh=18.0, height=20, species='Quercus mongolica', stage='sapling')]
     self.model.objects += [Tree(1, 0, ddh=3.0, height=20, species='Quercus mongolica', stage='seedling')]
Exemple #7
0
                                    KillOldSeedlings,
                                    KillOldSaplings)

from pyforest.actions.spreads import RadialDecayTreeSeedingAction


from pyforest.core import MemoryBackend, Model, Snapshots
from pyforest.core import Model
from pyforest.objects.trees import Tree



# ------------ Initialization -----------------------------


# ---------------------------------------------------------


# ------------ Create simple model instance ---------------

model = Model()

# ---------------------------------------------------------



# ------------- Filling the model space with trees --------

model.objects += [Tree(1, 1, dbh=30.2, height=20, species='Quercus mongolica', stage='adult')]
model.objects += [Tree(0, 1, dbh=18.0, height=20, species='Quercus mongolica', stage='sapling')]
model.objects += [Tree(1, 0, ddh=3.0, height=20, species='Quercus mongolica', stage='seedling')]
Exemple #8
0
'''
Plots a few trees with different diameters

'''

from pyforest.objects.trees import Tree
from pyforest.core import Model
from pyforest.visual.D2 import Scene2D

m = Model(bbox=[(0, 10), (0, 40)])

t1 = Tree(1, 1, dbh=35, stage='adult')
t2 = Tree(12, 2, dbh=15, stage='sapling')
t3 = Tree(3, 13, ddh=1, dbh=0, stage='seedling')

m.objects += [t1, t2, t3]

d2 = Scene2D()
d2.plot_model(m)
d2.show()