openforis-whisp 2.0.0b3__py3-none-any.whl → 3.0.0a1__py3-none-any.whl
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.
- openforis_whisp/__init__.py +35 -4
- openforis_whisp/advanced_stats.py +2070 -0
- openforis_whisp/data_checks.py +642 -0
- openforis_whisp/data_conversion.py +86 -44
- openforis_whisp/datasets.py +124 -36
- openforis_whisp/logger.py +26 -0
- openforis_whisp/parameters/__init__.py +0 -0
- openforis_whisp/parameters/lookup_gaul1_admin.py +18663 -0
- openforis_whisp/reformat.py +198 -2
- openforis_whisp/stats.py +314 -52
- {openforis_whisp-2.0.0b3.dist-info → openforis_whisp-3.0.0a1.dist-info}/METADATA +1 -1
- openforis_whisp-3.0.0a1.dist-info/RECORD +20 -0
- openforis_whisp-2.0.0b3.dist-info/RECORD +0 -16
- {openforis_whisp-2.0.0b3.dist-info → openforis_whisp-3.0.0a1.dist-info}/LICENSE +0 -0
- {openforis_whisp-2.0.0b3.dist-info → openforis_whisp-3.0.0a1.dist-info}/WHEEL +0 -0
openforis_whisp/__init__.py
CHANGED
|
@@ -2,8 +2,11 @@ import ee
|
|
|
2
2
|
from google.oauth2 import service_account
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
def initialize_ee(credentials_path=None):
|
|
6
|
-
"""Initializes Google Earth Engine using the provided path or defaults to normal if no path is given.
|
|
5
|
+
def initialize_ee(credentials_path=None, use_high_vol_endpoint=False):
|
|
6
|
+
"""Initializes Google Earth Engine using the provided path or defaults to normal if no path is given.
|
|
7
|
+
Args:
|
|
8
|
+
use_high_vol_endpoint: True/False to use high-volume endpoint via opt_url parameter (defaults to False).
|
|
9
|
+
"""
|
|
7
10
|
try:
|
|
8
11
|
if not ee.data._initialized:
|
|
9
12
|
print(credentials_path)
|
|
@@ -12,10 +15,21 @@ def initialize_ee(credentials_path=None):
|
|
|
12
15
|
credentials_path,
|
|
13
16
|
scopes=["https://www.googleapis.com/auth/earthengine"],
|
|
14
17
|
)
|
|
15
|
-
|
|
18
|
+
if use_high_vol_endpoint == False:
|
|
19
|
+
ee.Initialize(credentials)
|
|
20
|
+
else:
|
|
21
|
+
ee.Initialize(
|
|
22
|
+
credentials,
|
|
23
|
+
opt_url="https://earthengine-highvolume.googleapis.com",
|
|
24
|
+
)
|
|
16
25
|
print("EE initialized with credentials from:", credentials_path)
|
|
17
26
|
else:
|
|
18
|
-
|
|
27
|
+
if use_high_vol_endpoint == False:
|
|
28
|
+
ee.Initialize()
|
|
29
|
+
else:
|
|
30
|
+
ee.Initialize(
|
|
31
|
+
opt_url="https://earthengine-highvolume.googleapis.com"
|
|
32
|
+
)
|
|
19
33
|
print("EE initialized with default credentials.")
|
|
20
34
|
except Exception as e:
|
|
21
35
|
print("Error initializing EE:", e)
|
|
@@ -44,9 +58,18 @@ from openforis_whisp.stats import (
|
|
|
44
58
|
whisp_formatted_stats_geojson_to_df,
|
|
45
59
|
whisp_formatted_stats_geojson_to_geojson,
|
|
46
60
|
set_point_geometry_area_to_zero,
|
|
61
|
+
reformat_geometry_type,
|
|
47
62
|
convert_iso3_to_iso2,
|
|
48
63
|
)
|
|
49
64
|
|
|
65
|
+
from openforis_whisp.advanced_stats import (
|
|
66
|
+
whisp_stats_geojson_to_df_concurrent,
|
|
67
|
+
whisp_formatted_stats_geojson_to_df_concurrent,
|
|
68
|
+
whisp_stats_geojson_to_df_sequential,
|
|
69
|
+
whisp_formatted_stats_geojson_to_df_sequential,
|
|
70
|
+
whisp_formatted_stats_geojson_to_df_fast,
|
|
71
|
+
)
|
|
72
|
+
|
|
50
73
|
# temporary parameters to be removed once isio3 to iso2 conversion server side is implemented
|
|
51
74
|
from openforis_whisp.parameters.config_runtime import (
|
|
52
75
|
iso3_country_column,
|
|
@@ -59,6 +82,7 @@ from openforis_whisp.reformat import (
|
|
|
59
82
|
validate_dataframe,
|
|
60
83
|
create_schema_from_dataframe,
|
|
61
84
|
load_schema_if_any_file_changed,
|
|
85
|
+
format_stats_dataframe,
|
|
62
86
|
# log_missing_columns,
|
|
63
87
|
)
|
|
64
88
|
|
|
@@ -73,3 +97,10 @@ from openforis_whisp.data_conversion import (
|
|
|
73
97
|
from openforis_whisp.risk import whisp_risk, detect_unit_type
|
|
74
98
|
|
|
75
99
|
from openforis_whisp.utils import get_example_data_path, generate_test_polygons
|
|
100
|
+
|
|
101
|
+
from openforis_whisp.data_checks import (
|
|
102
|
+
analyze_geojson,
|
|
103
|
+
validate_geojson_constraints,
|
|
104
|
+
_check_metric_constraints,
|
|
105
|
+
suggest_method,
|
|
106
|
+
)
|