geocif 0.1.40__tar.gz → 0.1.42__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {geocif-0.1.40/geocif.egg-info → geocif-0.1.42}/PKG-INFO +1 -1
- {geocif-0.1.40 → geocif-0.1.42}/geocif/experiments.py +20 -8
- {geocif-0.1.40 → geocif-0.1.42}/geocif/geocif.py +13 -5
- {geocif-0.1.40 → geocif-0.1.42}/geocif/indices_runner_v2.py +2 -2
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/feature_engineering.py +1 -1
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/output.py +2 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/utils.py +1 -1
- {geocif-0.1.40 → geocif-0.1.42/geocif.egg-info}/PKG-INFO +1 -1
- {geocif-0.1.40 → geocif-0.1.42}/setup.py +1 -1
- {geocif-0.1.40 → geocif-0.1.42}/LICENSE +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/MANIFEST.in +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/README.md +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/__init__.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/agmet/__init__.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/agmet/geoagmet.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/agmet/plot.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/agmet/utils.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/analysis.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/backup/__init__.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/backup/constants.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/backup/features.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/backup/geo.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/backup/geocif.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/backup/metadata.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/backup/models.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/cei/__init__.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/cei/definitions.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/cei/indices.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/indices_runner.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/logger.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/__init__.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/correlations.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/correlations_backup.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/embedding.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/feature_selection.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/outliers.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/outlook.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/spatial_autocorrelation.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/stages.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/stats.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/trainers.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/trend.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/ml/xai.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/playground/__init__.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/playground/automl.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/playground/misc.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/viz/__init__.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif/viz/plot.py +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif.egg-info/SOURCES.txt +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif.egg-info/dependency_links.txt +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif.egg-info/not-zip-safe +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/geocif.egg-info/top_level.txt +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/requirements.txt +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/setup.cfg +0 -0
- {geocif-0.1.40 → geocif-0.1.42}/tests/test_geocif.py +0 -0
@@ -53,13 +53,25 @@ def run(path_config_files=[Path("../config/geocif.txt")]):
|
|
53
53
|
logger.info("\tStarting GEOCIF Experiments")
|
54
54
|
logger.info("=============================")
|
55
55
|
|
56
|
-
# Experiment
|
56
|
+
# Experiment: Models
|
57
|
+
logger.info("Experiment 0: Models")
|
58
|
+
parser = main(
|
59
|
+
inputs,
|
60
|
+
logger,
|
61
|
+
parser,
|
62
|
+
"DEFAULT",
|
63
|
+
"model",
|
64
|
+
"str",
|
65
|
+
["catboost", "merf", "linear"],
|
66
|
+
)
|
67
|
+
|
68
|
+
# Experiment: include_lat_lon
|
57
69
|
logger.info("Experiment 1: include_lat_lon")
|
58
70
|
parser = main(
|
59
71
|
inputs, logger, parser, "ML", "include_lat_lon", "bool", [True, False]
|
60
72
|
)
|
61
73
|
|
62
|
-
# Experiment
|
74
|
+
# Experiment: feature_selection
|
63
75
|
logger.info("Experiment 2: feature_selection")
|
64
76
|
parser = main(
|
65
77
|
inputs,
|
@@ -71,13 +83,13 @@ def run(path_config_files=[Path("../config/geocif.txt")]):
|
|
71
83
|
["SelectKBest", "BorutaPy", "Leshy", "RFECV", "RFE"],
|
72
84
|
)
|
73
85
|
|
74
|
-
# Experiment
|
86
|
+
# Experiment: lag_years
|
75
87
|
logger.info("Experiment 3: lag_years")
|
76
88
|
parser = main(
|
77
89
|
inputs, logger, parser, "ML", "lag_years", "int", [1, 2, 3, 4, 5]
|
78
90
|
)
|
79
91
|
|
80
|
-
# Experiment
|
92
|
+
# Experiment: lag_yield_as_feature
|
81
93
|
logger.info("Experiment 4: lag_yield_as_feature")
|
82
94
|
parser = main(
|
83
95
|
inputs,
|
@@ -89,13 +101,13 @@ def run(path_config_files=[Path("../config/geocif.txt")]):
|
|
89
101
|
[True, False],
|
90
102
|
)
|
91
103
|
|
92
|
-
# Experiment
|
104
|
+
# Experiment: median_years
|
93
105
|
logger.info("Experiment 5: median_years")
|
94
106
|
parser = main(
|
95
107
|
inputs, logger, parser, "ML", "median_years", "int", [2, 3, 4, 5]
|
96
108
|
)
|
97
109
|
|
98
|
-
# Experiment
|
110
|
+
# Experiment: median_yield_as_feature
|
99
111
|
logger.info("Experiment 6: median_yield_as_feature")
|
100
112
|
parser = main(
|
101
113
|
inputs,
|
@@ -107,7 +119,7 @@ def run(path_config_files=[Path("../config/geocif.txt")]):
|
|
107
119
|
[True, False],
|
108
120
|
)
|
109
121
|
|
110
|
-
# Experiment
|
122
|
+
# Experiment: analogous_year_yield_as_feature
|
111
123
|
logger.info("Experiment 7: analogous_year_yield_as_feature")
|
112
124
|
parser = main(
|
113
125
|
inputs,
|
@@ -119,7 +131,7 @@ def run(path_config_files=[Path("../config/geocif.txt")]):
|
|
119
131
|
[True, False],
|
120
132
|
)
|
121
133
|
|
122
|
-
# Experiment
|
134
|
+
# Experiment: optimize
|
123
135
|
logger.info("Experiment 8: optimize")
|
124
136
|
parser = main(
|
125
137
|
inputs, logger, parser, "DEFAULT", "optimize", "bool", [True, False]
|
@@ -132,6 +132,9 @@ class Geocif:
|
|
132
132
|
self.median_yield_as_feature = self.parser.getboolean(
|
133
133
|
"ML", "median_yield_as_feature"
|
134
134
|
)
|
135
|
+
self.median_area_as_feature = self.parser.getboolean(
|
136
|
+
"ML", "median_area_as_feature"
|
137
|
+
)
|
135
138
|
self.number_lag_years = self.parser.getint("ML", "lag_years")
|
136
139
|
self.cluster_strategy = self.parser.get("ML", "cluster_strategy")
|
137
140
|
self.feature_selection = self.parser.get("ML", "feature_selection")
|
@@ -736,10 +739,15 @@ class Geocif:
|
|
736
739
|
df = fe.compute_last_year_yield(df)
|
737
740
|
|
738
741
|
if self.median_yield_as_feature:
|
739
|
-
df = fe.
|
742
|
+
df = fe.compute_median_statistics(
|
740
743
|
df, self.all_seasons_with_yield, self.number_median_years
|
741
744
|
)
|
742
745
|
|
746
|
+
if self.median_area_as_feature:
|
747
|
+
df = fe.compute_median_statistics(
|
748
|
+
df, self.all_seasons_with_area, self.number_median_years, "Area (ha)"
|
749
|
+
)
|
750
|
+
|
743
751
|
if self.lag_yield_as_feature:
|
744
752
|
df = fe.compute_lag_yield(
|
745
753
|
df, self.all_seasons_with_yield, self.number_lag_years
|
@@ -1107,6 +1115,10 @@ def loop_execute(inputs):
|
|
1107
1115
|
with PyCallGraph(output=graphviz, config=config):
|
1108
1116
|
country, crop, season, model, logger, parser = inputs
|
1109
1117
|
|
1118
|
+
logger.info("=====================================================")
|
1119
|
+
logger.info(f"\tStarting GEOCIF: {country} {crop} {season} {model}")
|
1120
|
+
logger.info("=====================================================")
|
1121
|
+
|
1110
1122
|
obj = Geocif(logger=logger, parser=parser)
|
1111
1123
|
obj.read_data(country, crop, season)
|
1112
1124
|
|
@@ -1178,10 +1190,6 @@ def main(logger, parser):
|
|
1178
1190
|
Returns:
|
1179
1191
|
|
1180
1192
|
"""
|
1181
|
-
logger.info("===========================")
|
1182
|
-
logger.info("\tStarting GEOCIF")
|
1183
|
-
logger.info("===========================")
|
1184
|
-
|
1185
1193
|
inputs = gather_inputs(parser)
|
1186
1194
|
execute_models(inputs, logger, parser)
|
1187
1195
|
|
@@ -47,7 +47,7 @@ class cei_runner(base.BaseGeo):
|
|
47
47
|
|
48
48
|
self.dir_input = Path(self.parser.get("PATHS", "dir_input"))
|
49
49
|
self.base_dir = Path(
|
50
|
-
r"
|
50
|
+
r"/gpfs/data1/cmongp1/GEOGLAM/Output/countries/malawi"
|
51
51
|
) # Path(self.parser.get("PATHS", "dir_crop_inputs"))
|
52
52
|
self.do_parallel = self.parser.getboolean("DEFAULT", "do_parallel")
|
53
53
|
|
@@ -157,7 +157,7 @@ class cei_runner(base.BaseGeo):
|
|
157
157
|
"ndvi",
|
158
158
|
False, # redo
|
159
159
|
)
|
160
|
-
for year in range(
|
160
|
+
for year in range(2001, ar.utcnow().year + 1)
|
161
161
|
for status, path, filename, admin_zone, category in combinations
|
162
162
|
]
|
163
163
|
|
@@ -62,7 +62,7 @@ def compute_closest_years(all_years, harvest_year, number_lag_years):
|
|
62
62
|
return closest_years.tolist()
|
63
63
|
|
64
64
|
|
65
|
-
def
|
65
|
+
def compute_median_statistics(
|
66
66
|
df, all_seasons_with_yield, number_median_years, target_col="Yield (tn per ha)"
|
67
67
|
):
|
68
68
|
"""
|
@@ -107,6 +107,7 @@ def store(db_path, experiment_id, df, model, model_name):
|
|
107
107
|
try:
|
108
108
|
utils.to_db(db_path, experiment_id, df)
|
109
109
|
except Exception as e:
|
110
|
+
breakpoint()
|
110
111
|
print(f"Error: {e}")
|
111
112
|
|
112
113
|
index_columns = ["Country", "Region", "Crop", "Harvest Year", "Stages"]
|
@@ -127,6 +128,7 @@ def store(db_path, experiment_id, df, model, model_name):
|
|
127
128
|
df_model.index.set_names(["Index"], inplace=True)
|
128
129
|
utils.to_db(db_path, "models", df_model)
|
129
130
|
except Exception as e:
|
131
|
+
breakpoint()
|
130
132
|
print(f"Error: {e}")
|
131
133
|
|
132
134
|
con.commit()
|
@@ -332,7 +332,7 @@ def create_output_directory(method, admin_zone, country, crop, path_output):
|
|
332
332
|
|
333
333
|
:return:
|
334
334
|
"""
|
335
|
-
dir_output = path_output / "
|
335
|
+
dir_output = path_output / "cei" / "indices" / method / admin_zone / country / crop
|
336
336
|
os.makedirs(dir_output, exist_ok=True)
|
337
337
|
|
338
338
|
return dir_output
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|