Esempio n. 1
0
    def __init__(self, singleSiteInstance, ensembleID, bWriteOutput=True):

        # Generate global variables
        self.GlobalVar = globalVariables.globalVariablesClass()

        # Initiate self.site variable with the getSingleSiteParametersClass class
        # self.site = getSingleSiteParameters.getSingleSiteParametersClass()
        self.site = copy.deepcopy(singleSiteInstance)

        # In VB and FAST, the output table (sqlite) should be not written, i.e., self.bWriteOutput = False
        # self.bWriteOutput = bWriteOutput

        # ensemble ID
        self.ensembleID = ensembleID

        # self.run3PG_2(ensembleID)

        # Initialize the stand age
        self.initialiseStandAge()

        self.initialiseParameters()

        self.assignVaryData()

        self.initialiseStand()

        # The entrance to function initialiseSoilWaterBalance()
        self.waterModule = water_module.water_module_class(self.site)

        self.assignSilviculturalEvents(self.site.standAge)

        # set all output variables to be zero
        self.initialiseOutputData()

        # Note: the simulation starts with the month after planting as the first month of growth
        self.site.monthOfYear = self.site.InitialMonth + 1
        self.site.metMonth = self.site.monthOfYear
        self.site.metyear = self.site.InitialYear
        self.site.monthCounter = 1

        self.getAgeDependentfactors()

        self.getStandCharacteristics()

        # Headings and variables flagged as having initial values are output here
        # self.write3PGresults(self.GlobalVar.opStart, 0)

        # open the connection to sqlite DB, only need to be open in the 1st ensemble member
        # self.connection = sqlite3.connect(self.GlobalVar.outputFilename, check_same_thread=False)
        # self.connection = DB
        # self.cursor = self.connection.cursor()

        # Create a table in sqlite
        # self.writeOutput(0)

        # month counter, write into sqlite
        self.monthIncrease = 0
Esempio n. 2
0
 def __init__(self, excel_file_path, excel_sheet):
    
     # Generate global variables
     self.GlobalVar = globalVariables.globalVariablesClass()
    
     # Set the initial excel file path and sheet name
     self.excel_file_path = excel_file_path
     self.excel_sheet =excel_sheet
     
     # Call this function to read and fill soilDict{} 
     self.fillDict()
Esempio n. 3
0
    def __init__(self, singleSiteInstance, bWriteOutput=True):

        # Generate global variables
        self.GlobalVar = globalVariables.globalVariablesClass()

        # Initiate self.site variable with the getSingleSiteParametersClass class
        self.site = getSingleSiteParameters.getSingleSiteParametersClass()
        self.site = singleSiteInstance

        # In VB and FAST, the output table (sqlite) should be not written, i.e., self.bWriteOutput = False
        self.bWriteOutput = bWriteOutput

        # Run the main procedure of Py3PG2 and print the simulation time for each site
        #t0 = time.time()
        self.run3PG_2()
Esempio n. 4
0
    def __init__(self, singleSiteInstance, ensembleID, bWriteOutput=True):
       
        # Generate global variables
        self.GlobalVar = globalVariables.globalVariablesClass()
       
        # Initiate self.site variable with the getSingleSiteParametersClass class
        # self.site = getSingleSiteParameters.getSingleSiteParametersClass()
        self.site = copy.deepcopy(singleSiteInstance)

        # In VB and FAST, the output table (sqlite) should be not written, i.e., self.bWriteOutput = False
        # self.bWriteOutput = bWriteOutput

        # ensemble ID
        self.ensembleID = ensembleID

        # Initialize the stand age
        self.initialiseStandAge()

        self.initialiseParameters()

        self.assignVaryData()

        self.initialiseStand()

        # The entrance to function initialiseSoilWaterBalance()
        self.waterModule = water_module.water_module_class(self.site)

        self.assignSilviculturalEvents(self.site.standAge)

        # set all output variables to be zero
        self.initialiseOutputData()

        # Note: the simulation starts with the month after planting as the first month of growth
        self.site.monthOfYear = self.site.InitialMonth + 1
        self.site.metMonth = self.site.monthOfYear
        self.site.metyear = self.site.InitialYear
        self.site.monthCounter = 1

        self.getAgeDependentfactors()

        self.getStandCharacteristics()

        # month counter, write into sqlite
        self.monthIncrease = 0