File size: 2,599 Bytes
64ab846
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""

Contains model information regarding dates and step times etc.



"""


class ClockStruct:
    """

    Contains model information regarding dates and step times etc.



    Attributes:



        time_step_counter (int): Keeps track of current timestep



        model_is_finished (Bool): False unless model has finished



        simulation_start_date (np.Datetime64): Date of simulation start



        simulation_end_date (np.Datetime64): Date of simulation end



        time_step (int): time step (evaluation needed



        n_steps (int): total number of days of simulation



        time_span (np.array): all dates that lie within the start and end dates of simulation



        step_start_time (np.Datetime64): Date at start of timestep



        step_end_time (np.Datetime64): Date at end of timestep



        evap_time_steps (int): Number of time-steps (per day) for soil evaporation calculation



        sim_off_season (str): 'Y' if you want to simulate the off season,'N' otherwise



        planting_dates (list-like): list of planting dates in datetime format



        harvest_dates (list-like): list of harvest dates in datetime format



        n_seasons (int): Total number of seasons to be simulated



        season_counter (int): counter to keep track of which season we are currenlty simulating





    """

    def __init__(self):

        self.time_step_counter = 0  # Keeps track of current timestep
        self.model_is_finished = False  # False unless model has finished
        self.simulation_start_date = 0  # Date of simulation start
        self.simulation_end_date = 0  # Date of simulation end
        self.time_step = 0  # time step (evaluaiton needed)
        self.n_steps = 0  # total number of days of simulation
        self.time_span = (
            0  # all dates that lie within the start and end dates of simulation
        )
        self.step_start_time = 0  # Date at start of timestep
        self.step_end_time = 0  # Date at start of timestep
        # Number of time-steps (per day) for soil evaporation calculation
        self.evap_time_steps = 20
        self.sim_off_season = (
            "N"  # 'Yes' if you want to simulate the off season, 'N' otherwise
        )
        self.planting_dates = (
            []
        )  # list of crop planting dates during simulation
        self.harvest_dates = []  # list of crop planting dates during simulation
        self.n_seasons = 0  # total number of seasons (plant and harvest)
        self.season_counter = -1  # running counter of seasons