gaia / compute_yield.py
mohamed.tsouli
add data coef for colza orge and ble
ec9d9e0
raw
history blame
3.08 kB
import json
def calcul_metriques_sol(clay, silt, sand, soc):
"""
Calcule le point de flétrissement (WP), l'humidité actuelle du sol (SM) et la capacité au champ (FC).
:param clay: Pourcentage d'argil dans le sol (%)
:param silt: Pourcentage de silt dans le sol (%)
:param sand: Pourcentage de sand dans le sol (%)
:param soc: Carbone organique du sol (%)
:return: WP, SM et FC (%)
"""
# Calcul de la capacité au champ (FC)
FC = 0.2576 * silt + 0.2484 * clay + 0.3664 * soc + 20.83
# Calcul du point de flétrissement (WP)
WP = 0.026 * clay + 0.5 * soc + 3.0
# Calcul de l'humidité actuelle du sol (SM) comme 50% de la plage entre FC et WP
SM = WP + 0.5 * (FC - WP)
# Retourne les résultats sous forme de dictionnaire
return round(SM, 2), round(FC, 2), round(WP, 2)
def calculate_ETx(Kc, ETo):
"""
Calculate the maximum evapotranspiration (ETx) using the crop coefficient (Kc) and reference evapotranspiration (ETo).
Parameters:
Kc (float): Crop coefficient
ETo (float): Reference evapotranspiration (mm)
Returns:
float: Maximum evapotranspiration (ETx) in mm
"""
ETx = Kc * ETo
return ETx
def calculate_ETa(ETx, soil_moisture, field_capacity, wilting_point):
"""
Calculate the actual evapotranspiration (ETa) using the maximum evapotranspiration (ETx), soil moisture, field capacity, and wilting point.
Parameters:
ETx (float): Maximum evapotranspiration (mm)
soil_moisture (float): Current soil moisture content (%)
field_capacity (float): Field capacity of the soil (%)
wilting_point (float): Wilting point of the soil (%)
Returns:
float: Actual evapotranspiration (ETa) in mm
"""
if soil_moisture > field_capacity:
ETa = ETx
elif soil_moisture < wilting_point:
ETa = 0
else:
ETa = ETx * ((soil_moisture - wilting_point) / (field_capacity - wilting_point))
return ETa
def calculate_yield_projection(Yx, ETx, ETa, Ky):
"""
Calculate the agricultural yield projection using the FAO water production function.
Parameters:
Yx (float): Maximum yield (quintal/ha)
ETx (float): Maximum evapotranspiration (mm)
ETa (float): Actual evapotranspiration (mm)
Ky (float): Yield response factor
Returns:
float: Projected yield (quintal/ha)
"""
Ya = Yx * (1 - Ky * (1 - ETa / ETx))
return round(Ya, 2)
if __name__ =="__main__":
# Exemple d'utilisation
Yx = 10000 # Rendement maximum en quintal/ha
Kc = 1.2 # Coefficient de culture
Ky = 1.25 # Facteur de réponse du rendement pour le maïs
soil_moisture, field_capacity, wilting_point = calcul_metriques_sol(clay=20, silt=40, sand=40, soc=1.5)
ETo = 5.0 # Evapotranspiration de référence en mm/jour
ETx = calculate_ETx(Kc, ETo)
ETa = calculate_ETa(ETx, soil_moisture, field_capacity, wilting_point)
projected_yield = calculate_yield_projection(Yx, ETx, ETa, Ky)
print(f"Le rendement projeté est de {projected_yield} quintal/ha")