geocif 0.1.34__tar.gz → 0.1.35__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.34/geocif.egg-info → geocif-0.1.35}/PKG-INFO +1 -1
- {geocif-0.1.34 → geocif-0.1.35}/geocif/cei/indices.py +1 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/geocif.py +3 -4
- {geocif-0.1.34 → geocif-0.1.35}/geocif/indices_runner_v2.py +10 -11
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/correlations.py +32 -16
- {geocif-0.1.34 → geocif-0.1.35/geocif.egg-info}/PKG-INFO +1 -1
- {geocif-0.1.34 → geocif-0.1.35}/setup.py +1 -1
- {geocif-0.1.34 → geocif-0.1.35}/LICENSE +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/MANIFEST.in +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/README.md +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/__init__.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/agmet/__init__.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/agmet/geoagmet.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/agmet/plot.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/agmet/utils.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/analysis.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/backup/__init__.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/backup/constants.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/backup/features.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/backup/geo.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/backup/geocif.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/backup/metadata.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/backup/models.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/cei/__init__.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/cei/definitions.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/indices_runner.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/logger.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/__init__.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/correlations_backup.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/embedding.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/feature_engineering.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/feature_selection.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/outliers.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/outlook.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/output.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/spatial_autocorrelation.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/stages.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/stats.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/trainers.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/trend.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/ml/xai.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/playground/__init__.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/playground/automl.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/playground/misc.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/utils.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/viz/__init__.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif/viz/plot.py +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif.egg-info/SOURCES.txt +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif.egg-info/dependency_links.txt +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif.egg-info/not-zip-safe +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/geocif.egg-info/top_level.txt +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/requirements.txt +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/setup.cfg +0 -0
- {geocif-0.1.34 → geocif-0.1.35}/tests/test_geocif.py +0 -0
@@ -487,10 +487,9 @@ class Geocif:
|
|
487
487
|
"Harvest Year",
|
488
488
|
"Stage Name",
|
489
489
|
]
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
breakpoint()
|
490
|
+
df.index = df.apply(
|
491
|
+
lambda row: "_".join([str(row[col]) for col in index_columns]), axis=1
|
492
|
+
)
|
494
493
|
|
495
494
|
# name the index level
|
496
495
|
df.index.set_names(["Index"], inplace=True)
|
@@ -155,22 +155,21 @@ class cei_runner(base.BaseGeo):
|
|
155
155
|
"ndvi",
|
156
156
|
False, # redo
|
157
157
|
)
|
158
|
-
for year in range(
|
158
|
+
for year in range(2024, ar.utcnow().year + 1)
|
159
159
|
for status, path, filename, admin_zone, category in combinations
|
160
160
|
]
|
161
161
|
|
162
162
|
# Only keep those entries in combinations where the third elemt is
|
163
163
|
# mozambique, south_africa, angola or dem_people's_rep_of_korea
|
164
164
|
# This is done to test the code for these countries
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
num_cpu = int(cpu_count() * 0.8)
|
165
|
+
combinations = [
|
166
|
+
i
|
167
|
+
for i in combinations
|
168
|
+
if "malawi_maize_s1" in i[3]
|
169
|
+
]
|
170
|
+
|
171
|
+
if False:
|
172
|
+
num_cpu = int(cpu_count() * 0.3)
|
174
173
|
with Pool(num_cpu) as p:
|
175
174
|
for i, _ in enumerate(p.imap_unordered(indices.process, combinations)):
|
176
175
|
pass
|
@@ -198,7 +197,7 @@ def run(path_config_files=[]):
|
|
198
197
|
indices.validate_index_definitions()
|
199
198
|
|
200
199
|
for method in [
|
201
|
-
"
|
200
|
+
"biweekly_r", # "dekad_r" # "dekad_r"
|
202
201
|
]: # , "full_season", "phenological_stages", "fraction_season"]:
|
203
202
|
obj = cei_runner(path_config_files)
|
204
203
|
obj.main(method)
|
@@ -246,6 +246,7 @@ def all_correlated_feature_by_time(df, **kwargs):
|
|
246
246
|
Returns:
|
247
247
|
|
248
248
|
"""
|
249
|
+
THRESHOLD = 0.1
|
249
250
|
national_correlation = kwargs.get("national_correlation")
|
250
251
|
group_by = kwargs.get("groupby")
|
251
252
|
combined_dict = kwargs.get("combined_dict")
|
@@ -264,8 +265,16 @@ def all_correlated_feature_by_time(df, **kwargs):
|
|
264
265
|
df_corr = df_corr.dropna(thresh=len(df_corr) / 2, axis=1)
|
265
266
|
|
266
267
|
if not df_corr.empty:
|
267
|
-
df_tmp = df_corr[df_corr.columns[(df_corr.mean() >
|
268
|
-
dict_selected_features
|
268
|
+
df_tmp = df_corr[df_corr.columns[(abs(df_corr.mean()) > THRESHOLD)]]
|
269
|
+
# Add the columns to dict_selected_features along with the absolute mean value
|
270
|
+
absolute_medians = df_tmp.abs().median()
|
271
|
+
|
272
|
+
# Create a DataFrame to display the column names and their absolute median values
|
273
|
+
absolute_median_df = absolute_medians.reset_index()
|
274
|
+
absolute_median_df.columns = ['CEI', 'Median']
|
275
|
+
|
276
|
+
# Add the CEI and Median value to dict_selected_features
|
277
|
+
dict_selected_features[region_id] = absolute_median_df
|
269
278
|
|
270
279
|
df_tmp2 = (
|
271
280
|
df_tmp.median(axis=0)
|
@@ -293,24 +302,31 @@ def all_correlated_feature_by_time(df, **kwargs):
|
|
293
302
|
else:
|
294
303
|
# HACK
|
295
304
|
df_corr = _all_correlated_feature_by_time(df, **kwargs)
|
296
|
-
dict_selected_features[region_id] = df_corr.columns
|
297
|
-
dict_best_cei[region_id] = {}
|
298
305
|
|
299
|
-
|
300
|
-
#
|
301
|
-
|
302
|
-
|
303
|
-
#
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
#
|
308
|
-
|
306
|
+
df_tmp = df_corr[df_corr.columns[(abs(df_corr.mean()) > THRESHOLD)]]
|
307
|
+
# Add the columns to dict_selected_features along with the absolute mean value
|
308
|
+
absolute_medians = df_tmp.abs().median()
|
309
|
+
|
310
|
+
# Create a DataFrame to display the column names and their absolute median values
|
311
|
+
absolute_median_df = absolute_medians.reset_index()
|
312
|
+
absolute_median_df.columns = ['CEI', 'Median']
|
313
|
+
|
314
|
+
# Add the CEI and Median value to dict_selected_features
|
315
|
+
dict_selected_features[region_id] = absolute_median_df
|
316
|
+
dict_best_cei[region_id] = {}
|
309
317
|
else:
|
310
318
|
df_corr = _all_correlated_feature_by_time(df, **kwargs)
|
311
|
-
|
319
|
+
df_tmp = df_corr[df_corr.columns[(abs(df_corr.mean()) > THRESHOLD)]]
|
320
|
+
# Add the columns to dict_selected_features along with the absolute mean value
|
321
|
+
absolute_medians = df_tmp.abs().median()
|
322
|
+
|
323
|
+
# Create a DataFrame to display the column names and their absolute median values
|
324
|
+
absolute_median_df = absolute_medians.reset_index()
|
325
|
+
absolute_median_df.columns = ['CEI', 'Median']
|
326
|
+
|
327
|
+
# Add the CEI and Median value to dict_selected_features
|
328
|
+
dict_selected_features[0] = absolute_median_df
|
312
329
|
|
313
|
-
df_corr = df_corr[df_corr.columns[(df_corr.mean() > 0.1)]]
|
314
330
|
plot_feature_corr_by_time(df_corr, **kwargs)
|
315
331
|
|
316
332
|
return dict_selected_features, dict_best_cei
|
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
|
File without changes
|