-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstage.py.py
89 lines (67 loc) · 3.14 KB
/
stage.py.py
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# ============================================================================================
# module stage.py : calculate dvs
# Usage:
# bd = stage.BD()
# bd.calcBD(temperature)
# ============================================================================================
import numpy as np
# temp. function sum for veg. and rep. stage
# tempdvs = sumtemp/satVS or 1 + (sumtemp - satVS)/(satRS - satVS) or 2
satVS = 50 # flowering 16 days after full vernalization, Guttormsen(1985)
satRS = 150 # harvest about 60 days after flowering in Jeju
Totemp = 12 # opt. temp for veg and rep. growth
shape_temp = 2
# ver. function sum for vernalization
# verdvs = sumver / satVer or 1
satVer = 50
Tover1 = 6 # opt. temp. for vernalization
Tover2 = 6.4
shape_ver = 4 # shape param. for log-normal function (verrate = np.exp(-1*(np.log(temp/Tover)**shape) )
LNlimit = 20 # limit leaf number to sense ver. effect
# dvs = tempdvs * verdvs
#timestep
time = 'hour'
conv = 1/24 if time == 'hour' else 1.0
class BD():
def __init__(self) :
self.dvs = 0.0 # development stage (0 - 2)
self.sumTemp = 0.0 # rate sum of temperature effect
self.sumVer = 0.0 # rate sum of vernilization effect
self.tempdvs = 0.0 # dvs by temperature effect
self.verdvs = 0.0 # dev by vernilezation effect
def calcBD(self, Ta):
## ----------------------------------------------------------------------------------
# calculate devolpment stage of temp. function and tempdvs.
# if sum of temp effect is over critical value(satVS), then tempdvs will be over 1.
#temp_rate
temprate = np.exp(-1*(np.log(Ta/Totemp)**shape_temp)) if Ta > 0 else 0
self.sumTemp += temprate * conv
sumTemp = self.sumTemp
#sum_temp_rate
if sumTemp > satRS :
self.tempdvs = 2.0
elif sumTemp > satVS :
self.tempdvs = 1 + (sumTemp-satVS)/(satRS-satVS)
else :
self.tempdvs = sumTemp/satVS
# --------------------------------------------------------------------------------------
# Venalization effect by low temp
# To calculate verilization effec(verdvs), lognormal function is used for ver. rate.
#ver_rate
if 0 < Ta < 5 :
self.verrate = np.exp(-1*(np.log(Ta/Tover1)**shape_ver))
elif Ta >= 5
self.verrate = np.exp(-1*(np.log(Ta/Tover2)**shape_ver))
else :
self.verrate = 0
#sum_ver
self.sumVer += verrate * conv
sumVer = self.sumVer
if (sumVer/satVer) > 1 :
self.verdvs = 1
else :
self.verdvs = sumVer/satVer
# ---------------------------------------------------------------------------------
# Net dvs is calculated by multipling temdvs and verdvs
# ---------------------------------------------------------------------------------
self.dvs = self.tempdvs * self.verdvs