File size: 1,577 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
import numpy as np

def cc_required_time(

    cc_prev: float,

    CCo: float,

    CCx: float,

    CGC: float,

    CDC: float,

    Mode: str,

    ) -> float:
    """

    Function to find time required to reach canopy_cover at end of previous day, given current CGC or CDC



    <a href="https://www.fao.org/3/BR248E/br248e.pdf#page=30" target="_blank">Reference Manual: canopy_cover devlopment</a> (pg. 21-24)





    Arguments:



        cc_prev (float): Canopy Cover at previous timestep.



        CCo (float): Fractional canopy cover size at emergence



        CCx (float): Maximum canopy cover (fraction of soil cover)



        CGC (float): Canopy growth coefficient (fraction per gdd)



        CDC (float): Canopy decline coefficient (fraction per gdd/calendar day)



        Mode (str): Canopy growth/decline coefficient (fraction per gdd/calendar day)





    Returns:



        tReq (float): time required to reach canopy_cover at end of previous day











    """

    ## Get CGC and/or time (gdd or CD) required to reach canopy_cover on previous day ##
    if Mode == "CGC":
        if cc_prev <= (CCx / 2):

            # print(cc_prev,CCo,(tSum-dt),tSum,dt)
            CGCx = np.log(cc_prev / CCo)
            # print(np.log(cc_prev/CCo),(tSum-dt),CGCx)
        else:
            # print(CCx,CCo,cc_prev)
            CGCx = np.log((0.25 * CCx * CCx / CCo) / (CCx - cc_prev))

        tReq = CGCx / CGC

    elif Mode == "CDC":
        tReq = (np.log(1 + (1 - cc_prev / CCx) / 0.05)) / (CDC / CCx)

    return tReq