OK. I'm setting up a model which will describe the effects of a number of management decisions on forests. Each forest is an instance of the forest class and you can see a simplified version below:
class forest():
instancelist = [] # a list of all the forest instances so I can run functions on all of them at once
growth_rate = 2 #very simple rate of growth (not realistic!)
felling_year = 50 #all forest areas are felled at age 50
def __init__(self, x=0, y=0,age=0,size=0):
self.instancelist.append(self) # add the forest area to the instance list
self.x = x # x coordinate
self.y = y # y coordinate
self.age = age # age, not all forests are planted on bare sites, - we have some pre-existing ones to consider.
self.size = size # very rough - but this is an indicator of the physical volume of timber (not area)
I can now generate a forest object, for example:
f = forest(1,1,20,40)
So, the difficulty I'm having is that I need to generate a number of forest blocks (so we see what the effect is on a wider area). To do this, I'll need to create a lot of areas.
I can do this easily if I don't specify any properties:
forests = [forest() for x in range(20)]
But I can't see how to generate a large number of areas each with unique properties without going through and specifying them all by hand. Is there a method that I can use where I feed in data from another source (lists, tuples, csv, whatever) and use it to build up an inventory of different objects?
Sorry if this is a stupid question (I have been known to ask them from time to time) but it's really confusing me.