| import numpy as np
|
| from typing import TYPE_CHECKING
|
|
|
|
|
|
|
| if TYPE_CHECKING:
|
|
|
| from aquacrop.entities.soilProfile import SoilProfile
|
| from aquacrop.entities.initParamVariables import InitialCondition
|
|
|
|
|
| def germination(
|
| InitCond: "InitialCondition",
|
| Soil_zGerm: float,
|
| prof: "SoilProfile",
|
| Crop_GermThr: float,
|
| Crop_PlantMethod: bool,
|
| gdd: float,
|
| growing_season: bool,
|
| ) -> "InitialCondition":
|
| """
|
| Function to check if crop has germinated
|
|
|
|
|
| <a href="https://www.fao.org/3/BR248E/br248e.pdf#page=32" target="_blank">Reference Manual: germination condition</a> (pg. 23)
|
|
|
|
|
| Arguments:
|
|
|
|
|
| InitCond (InitialCondition): InitCond object containing model paramaters
|
|
|
| Soil_zGerm (float): Soil depth affecting germination
|
|
|
| prof (SoilProfile): Soil object containing soil paramaters
|
|
|
| Crop_GermThr (float): Crop germination threshold
|
|
|
| Crop_PlantMethod (bool): sown as seedling True or False
|
|
|
| gdd (float): Number of Growing Degree Days on current day
|
|
|
| growing_season (bool): is growing season (True or Flase)
|
|
|
|
|
| Returns:
|
|
|
|
|
| NewCond (InitialCondition): InitCond object containing updated model paramaters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| """
|
|
|
|
|
| NewCond = InitCond
|
|
|
|
|
| if growing_season == True:
|
|
|
| if (NewCond.germination == False):
|
|
|
| comp_sto = np.argwhere(prof.dzsum >= Soil_zGerm).flatten()[0]
|
|
|
| Wr = 0
|
| WrFC = 0
|
| WrWP = 0
|
| for ii in range(comp_sto + 1):
|
|
|
|
|
| if prof.dzsum[ii] > Soil_zGerm:
|
| factor = 1 - ((prof.dzsum[ii] - Soil_zGerm) / prof.dz[ii])
|
| else:
|
| factor = 1
|
|
|
|
|
| Wr = Wr + round(factor * 1000 * InitCond.th[ii] * prof.dz[ii], 3)
|
|
|
| WrFC = WrFC + round(factor * 1000 * prof.th_fc[ii] * prof.dz[ii], 3)
|
|
|
| WrWP = WrWP + round(factor * 1000 * prof.th_wp[ii] * prof.dz[ii], 3)
|
|
|
|
|
| if Wr < 0:
|
| Wr = 0
|
|
|
|
|
| WcProp = 1 - ((WrFC - Wr) / (WrFC - WrWP))
|
|
|
|
|
| if (WcProp >= Crop_GermThr):
|
|
|
| NewCond.germination = True
|
|
|
| if Crop_PlantMethod == True:
|
| NewCond.protected_seed = True
|
| else:
|
|
|
| NewCond.protected_seed = False
|
|
|
|
|
|
|
| else:
|
| NewCond.delayed_cds = InitCond.delayed_cds + 1
|
| NewCond.delayed_gdds = InitCond.delayed_gdds + gdd
|
| NewCond.protected_seed = False
|
|
|
| else:
|
|
|
| NewCond.germination = False
|
| NewCond.protected_seed = False
|
| NewCond.delayed_cds = 0
|
| NewCond.delayed_gdds = 0
|
|
|
| return NewCond
|
|
|
|
|