class PhotoperiodReductionFactor(SimulationObject): """Photoperiod reduction factor for soybean (short day) approach and parameters based on Setiyono et al. doi 10.1016/j.fcr.2006.07.011 http://digitalcommons.unl.edu/agronomyfacpub/112 """ alpha = Float() m = Float(3) p0 = Float() class Parameters(ParamTemplate): MG = Float() # Maturity Group rating Popt = Float() Pcrt = Float() def initialize(self, day, kiosk, parvalues): # First compute Popt and Pcrt based on maturity group rating # equation based on Setiyono et al. doi 10.1016/j.fcr.2006.07.011 # http://digitalcommons.unl.edu/agronomyfacpub/112 # if "Pcrt" in parvalues and "Popt" in parvalues: # # both optimal and critical daylength are there MG is not needed # # but dummy needs to be specified if missing (set to -99) # if "MG" not in parvalues: # parvalues["MG"] = -99 # elif "MG" in parvalues: # MG = parvalues["MG"] # # derived Popt/Pcrt from MG based on setiyono equation # if "Popt" not in parvalues: # Popt = 12.759 - 0.388*MG - 0.058*MG**2 # if "Pcrt" not in parvalues: # Pcrt = 27.275 - 0.493*MG - 0.066*MG**2 # parvalues._cropdata.update({"Pcrt":Pcrt, "Popt":Popt}) # derived Popt/Pcrt from MG based on setiyono equation #MG = parvalues["MG"] #Popt = 12.759 - 0.388*MG - 0.058*MG**2 #Pcrt = 27.275 - 0.493*MG - 0.066*MG**2 #parvalues.update({"Pcrt":Pcrt, "Popt":Popt}) self.params = self.Parameters(parvalues) p = self.params self.alpha = log(2.) / log(((p.Pcrt - p.Popt) / self.m) + 1.) self.p0 = (p.Pcrt - p.Popt) / self.m def __call__(self, x): p = self.params if x < p.Popt: v = 1. elif x > p.Pcrt: v = 0. else: p1 = ((x - p.Popt) / self.m + 1.) p2 = ((p.Pcrt - x) / (p.Pcrt - p.Popt)) v = (p1 * (p2**self.p0))**self.alpha return v
class StateVariables(StatesTemplate): DVS = Float(-99.) # Development stage TSUM = Float(-99.) # Temperature sum state TSUME = Float(-99.) # Temperature sum for emergence state # States which register phenological events DOS = Instance(date) # Day of sowing DOE = Instance(date) # Day of emergence DOR1 = Instance(date) # Day of start of flowering DOR3 = Instance(date) # Day of pod development DOR5 = Instance(date) # Day of seed filling DOR8 = Instance(date) # Day of full ripeness DOH = Instance(date) # Day of harvest STAGE = Enum( [None, "emerging", "vegetative", "reproductive", "mature"])
class TemperatureReductionFactor(SimulationObject): alpha = Float() class Parameters(ParamTemplate): Topt = Float() Tmin = Float() Tmax = Float() def initialize(self, day, kiosk, parvalues): self.params = self.Parameters(parvalues) p = self.params self.alpha = log(2.) / (log((p.Tmax - p.Tmin) / (p.Topt - p.Tmin))) self._cache = {} def __call__(self, x, _cache={}): try: return _cache[x] except KeyError: pass p = self.params if x < p.Tmin or x > p.Tmax: v = _cache[x] = 0. else: p1 = (2 * (x - p.Tmin)**self.alpha) p2 = ((p.Topt - p.Tmin)**self.alpha) p3 = ((x - p.Tmin)**(2 * self.alpha)) p4 = ((p.Topt - p.Tmin)**(2 * self.alpha)) v = _cache[x] = (p1 * p2 - p3) / p4 return v
class Parameters(ParamTemplate): FRTB = AfgenTrait() FLTB = AfgenTrait() FSTB = AfgenTrait() FOTB = AfgenTrait() NPART = Float( -99.) # coefficient for the effect of N stress on leaf allocation
class Parameters(ParamTemplate): TSUMEM = Float(-99.) # Temp. sum for emergence TBASEM = Float(-99.) # Base temp. for emergence TEFFMX = Float(-99.) # Max eff temperature for emergence DVRMAX1 = Float(-99.) # Max development rate towards anthesis DVRMAX2 = Float(-99.) # Max development rate towards maturity DVSI = Float(-99.) # Initial development stage DVSEND = Float(-99.) # Final development stage CROP_START_TYPE = Enum(["sowing", "emergence"]) CROP_END_TYPE = Enum(["maturity", "harvest", "earliest"])
class StateVariables(StatesTemplate): TAGP = Float(-99.) GASST = Float(-99.) MREST = Float(-99.) CTRAT = Float(-99.) CEVST = Float(-99.) HI = Float(-99.) DOF = Instance(datetime.date) FINISH_TYPE = Unicode(allow_none=True)
class Parameters(ParamTemplate): CVL = Float(-99.) CVO = Float(-99.) CVR = Float(-99.) CVS = Float(-99.)
class Parameters(ParamTemplate): MG = Float() # Maturity Group rating Popt = Float() Pcrt = Float()
class RateVariables(RatesTemplate): PE = Float(-99.) PT = Float(-99.) EPT = Float(-99.) PREC = Float(-99.) nl = Int FC = Float(-99.) PWP = Float(-99.) ADWC = Float(-99.) B = Float(-99.) A = Float(-99.) INTERC = Float(-99.) GPREC = Float(-99.) RUNOFF = Float(-99.) INFIL = Float(-99.) RW = Float(-99.) values_RW = [] RWATER = Instance(np.ndarray) NWC = Float(-99.) EVS = Float(-99.) SPSI = Float(-99.) values_SPSI = [] SP = Instance(np.ndarray) #root FcR = Instance(np.ndarray) values_FR = [] FROOT = Float(-99.) AVEPSI = Float(-99.) RBAR = Float(-99.) PSIX = Float(-99.) z = Float(-99.) LOSS = Instance(np.ndarray) W = Instance(np.ndarray) arr_bool = Instance(np.ndarray) arr_TRUE = Instance(np.ndarray) TL = Instance(np.ndarray) net_RW = Instance(np.ndarray) T = Float(-99.) arr_subt = Instance(np.ndarray) arr_mult = Instance(np.ndarray) AT = Instance(np.ndarray) check = Float(-99.)
class StateVariables(StatesTemplate): PTa = Float(-99.) #Soil water balance TPE = Float(-99.) TPT = Float(-99.) TPREC = Float(-99.) TINTERC = Float(-99.) TRUNOFF = Float(-99.) PERC = Float(-99.) TE = Float(-99.) Ta = Float(-99.) WC = Instance(np.ndarray) WCv = Instance(np.ndarray) #To chech WB closed TT = Float(-99.) WB_close = Float(-99.) Diff_WC = Float(-99.) TWC = Float(-99.) W_Stress = Float(-99.)
class StateVariables(StatesTemplate): TDM = Float(-99.) TDMv = Float(-99.) TSTEM = Float(-99.) TLEAF = Float(-99.) TSEED = Float(-99.) YIELD = Float(-99.) LAI = Float(-99.) LAIFlowering = Float(-99.) TDLEAF = Float(-99.) SLA = Float(-99.) TDMFlowering = Float(-99.) TDMTRANSL = Float(-99.) POOLTRSL = Float(-99.) #root TRD = Float(-99.) da = Int CWDv = Float(-99.) CWDr = Float(-99.)
class Parameters(ParamTemplate): #Soil water balance FCP = Float(-99.) PWPP = Float(-99.) ADWCP = Float(-99.) TCK = Float(-99.) RUNOFF1 = Float(-99.) RUNOFF2 = Float(-99.) RMIN = Float(-99.) PSIPWP = Float(-99.) PSIFC = Float(-99.) S = Float(-99.) RDMAX = Float(-99.)
class RateVariables(RatesTemplate): RDRDV = Float(-99.) RDRSH = Float(-99.) RDR = Float(-99.) DLAI = Float(-99.) DM_W = Float(-99.) DM_R = Float(-99.) DM = Float(-99.) PDM = Float(-99.) VDD = Float(-99.) FI = Float(-99.) ROOT = Float(-99.) STEMS = Float(-99.) LEAF = Float(-99.) WLEAF = Float(-99.) SEED = Float(-99.) PSEED = Float(-99.) TN = Float(-99.) WDLEAF = Float(-99.) DLEAF = Float(-99.) GLEAF = Float(-99.) TRANSL = Float(-99.) #root RD = Float(-99.) WD = Float(-99.)
class StateVariables(StatesTemplate): FR = Float(-99.) FL = Float(-99.) FS = Float(-99.) FO = Float(-99.) PF = Instance(PartioningFactors)
class RateVariables(RatesTemplate): GASS = Float(-99.) MRES = Float(-99.) ASRC = Float(-99.) DMI = Float(-99.) ADMI = Float(-99.)
class Parameters(ParamTemplate): Topt = Float() Tmin = Float() Tmax = Float()
class RateVariables(RatesTemplate): DTSUME = Float(-99.) # increase in temperature sum for emergence DVR = Float(-99.) # development rate DAYL = Float(-99) PHOTORF = Float(-99) TEMPRF = Float(-99)
class RateVariables(RatesTemplate): EVSMX = Float(None) EVS = Float(None) TRAMX = Float(None) TRA = Float(None) RFTRA = Float(None)
class Parameters(ParamTemplate): RDRT = AfgenTrait() RDRSHM = Float(-99.) LAIC = Float(-99.) DVV1 = Float(-99.) DVV2 = Float(-99.) DVV3 = Float(-99.) initLAI = Float(-99.) K = Float(-99.) Ppar = Float(-99.) WUE = Float(-99.) DSLA = Float(-99.) NTR = Float(-99.) LNTR = Float(-99.) FNTR = Float(-99.) HD = Float(-99.) GCC = Float(-99.) FTRANSL = Float(-99.) SLATB = AfgenTrait() RUE = Float(-99.) RDMAX = Float(-99.)