mohamed.tsouli commited on
Commit
e8721da
·
1 Parent(s): 9c23216

data yield

Browse files
compute_yield.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+
4
+ def calcul_metriques_sol(clay, silt, sand, soc):
5
+ """
6
+ Calcule le point de flétrissement (WP), l'humidité actuelle du sol (SM) et la capacité au champ (FC).
7
+
8
+ :param clay: Pourcentage d'argil dans le sol (%)
9
+ :param silt: Pourcentage de silt dans le sol (%)
10
+ :param sand: Pourcentage de sand dans le sol (%)
11
+ :param soc: Carbone organique du sol (%)
12
+ :return: WP, SM et FC (%)
13
+ """
14
+ # Calcul de la capacité au champ (FC)
15
+ FC = 0.2576 * silt + 0.2484 * clay + 0.3664 * soc + 20.83
16
+
17
+ # Calcul du point de flétrissement (WP)
18
+ WP = 0.026 * clay + 0.5 * soc + 3.0
19
+
20
+ # Calcul de l'humidité actuelle du sol (SM) comme 50% de la plage entre FC et WP
21
+ SM = WP + 0.5 * (FC - WP)
22
+
23
+ # Retourne les résultats sous forme de dictionnaire
24
+ return round(SM, 2), round(FC, 2), round(WP, 2)
25
+
26
+
27
+ def calculate_ETx(Kc, ETo):
28
+ """
29
+ Calculate the maximum evapotranspiration (ETx) using the crop coefficient (Kc) and reference evapotranspiration (ETo).
30
+
31
+ Parameters:
32
+ Kc (float): Crop coefficient
33
+ ETo (float): Reference evapotranspiration (mm)
34
+
35
+ Returns:
36
+ float: Maximum evapotranspiration (ETx) in mm
37
+ """
38
+ ETx = Kc * ETo
39
+ return ETx
40
+
41
+ def calculate_ETa(ETx, soil_moisture, field_capacity, wilting_point):
42
+ """
43
+ Calculate the actual evapotranspiration (ETa) using the maximum evapotranspiration (ETx), soil moisture, field capacity, and wilting point.
44
+
45
+ Parameters:
46
+ ETx (float): Maximum evapotranspiration (mm)
47
+ soil_moisture (float): Current soil moisture content (%)
48
+ field_capacity (float): Field capacity of the soil (%)
49
+ wilting_point (float): Wilting point of the soil (%)
50
+
51
+ Returns:
52
+ float: Actual evapotranspiration (ETa) in mm
53
+ """
54
+ if soil_moisture > field_capacity:
55
+ ETa = ETx
56
+ elif soil_moisture < wilting_point:
57
+ ETa = 0
58
+ else:
59
+ ETa = ETx * ((soil_moisture - wilting_point) / (field_capacity - wilting_point))
60
+
61
+ return ETa
62
+
63
+
64
+ def calculate_yield_projection(Yx, ETx, ETa, Ky):
65
+ """
66
+ Calculate the agricultural yield projection using the FAO water production function.
67
+
68
+ Parameters:
69
+ Yx (float): Maximum yield (kg/ha)
70
+ ETx (float): Maximum evapotranspiration (mm)
71
+ ETa (float): Actual evapotranspiration (mm)
72
+ Ky (float): Yield response factor
73
+
74
+ Returns:
75
+ float: Projected yield (kg/ha)
76
+ """
77
+ Ya = Yx * (1 - Ky * (1 - ETa / ETx))
78
+ return round(Ya, 2)
79
+
80
+
81
+ if __name__ =="__main__":
82
+ # Exemple d'utilisation
83
+ Yx = 10000 # Rendement maximum en quintal/ha
84
+ Kc = 1.2 # Coefficient de culture
85
+ Ky = 1.25 # Facteur de réponse du rendement pour le maïs
86
+ soil_moisture, field_capacity, wilting_point = calcul_metriques_sol(clay=20, silt=40, sand=40, soc=1.5)
87
+ ETo = 5.0 # Evapotranspiration de référence en mm/jour
88
+ ETx = calculate_ETx(Kc, ETo)
89
+ ETa = calculate_ETa(ETx, soil_moisture, field_capacity, wilting_point)
90
+
91
+ projected_yield = calculate_yield_projection(Yx, ETx, ETa, Ky)
92
+ print(f"Le rendement projeté est de {projected_yield} quintal/ha")
data/data_yield/Coefs_yield_franche_comte.csv ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Mois;Région;Culture;Stade de développement;Kc;Ky
2
+ 1;Bourgogne-Franche-Comté;Tournesol;Pas de culture;0;0
3
+ 2;Bourgogne-Franche-Comté;Tournesol;Pas de culture;0;0
4
+ 3;Bourgogne-Franche-Comté;Tournesol;Pas de culture;0;0
5
+ 4;Bourgogne-Franche-Comté;Tournesol;Semis (stade 1);0.3;0.6
6
+ 5;Bourgogne-Franche-Comté;Tournesol;Levée et croissance (stade 2);0.6;1
7
+ 6;Bourgogne-Franche-Comté;Tournesol;Croissance active (stade 3);0.9;1.2
8
+ 7;Bourgogne-Franche-Comté;Tournesol;Floraison (stade 4);1.05;1.5
9
+ 8;Bourgogne-Franche-Comté;Tournesol;Maturation (stade 5);1.05;1.3
10
+ 9;Bourgogne-Franche-Comté;Tournesol;Maturation avancée (stade 6);0.7;1.1
11
+ 10;Bourgogne-Franche-Comté;Tournesol;Récolte (stade 7);0.4;0.8
12
+ 11;Bourgogne-Franche-Comté;Tournesol;Pas de culture;0;0
13
+ 12;Bourgogne-Franche-Comté;Tournesol;Pas de culture;0;0
data_rendement.csv → data/data_yield/data_rendement.csv RENAMED
File without changes