eii.client.analysis
Analysis utilities for EII data.
Zonal Statistics
Analysis utilities for EII data.
Provides functions for zonal statistics and basic spatial analysis using pre-computed EII assets.
get_zonal_stats(features, aggregation_method='min_fuzzy_logic', include_components=True, scale=300, stats=None, percentiles=None, compute_mode='precomputed', npp_year_range=None, include_seasonality=True, bii_year=None, absolute_diff_percentile='p95', keep_columns=None)
Calculate EII zonal statistics for each feature in a collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
FeatureCollection
|
FeatureCollection or GeoPandas/shapely inputs containing zones. |
required |
aggregation_method
|
AggregationMethod
|
EII aggregation method. |
'min_fuzzy_logic'
|
include_components
|
bool
|
Include component statistics. |
True
|
scale
|
int
|
Resolution in meters for the reduction. Defaults to 300. |
300
|
stats
|
list[str] | None
|
Statistics to compute. Supported: "mean", "median", "min", "max", "std". Defaults to ["mean"]. |
None
|
percentiles
|
list[int] | None
|
Optional list of percentiles (0-100) to include. |
None
|
compute_mode
|
ComputeMode
|
"precomputed" (default) or "on_the_fly". |
'precomputed'
|
npp_year_range
|
list[str] | None
|
Date range for observed NPP (on-the-fly mode). |
None
|
include_seasonality
|
bool
|
Include seasonality in functional integrity. |
True
|
bii_year
|
int | None
|
BII year to select for compositional integrity. |
None
|
absolute_diff_percentile
|
str
|
Percentile key for NPP absolute difference penalty. |
'p95'
|
keep_columns
|
list[str] | None
|
Optional list of input feature properties to preserve. Extracted stats are always included. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
|
GeoDataFrame with EII statistics for each feature. Columns use MultiIndex |
||
format |
(metric, stat), e.g., (eii, mean), (functional_integrity, min). |
Example
import ee ee.Initialize() countries = ee.FeatureCollection("FAO/GAUL/2015/level0") gdf = get_zonal_stats(countries.limit(10), stats=["mean", "min", "max"])
Source code in src/eii/client/analysis.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
compare_methods(geometry, scale=300, compute_mode='precomputed', npp_year_range=None, include_seasonality=True, bii_year=None, absolute_diff_percentile='p95')
Compare EII values across different aggregation methods for a polygon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometry
|
Geometry
|
AOI geometry (ee.Geometry/Feature/FeatureCollection, GeoPandas, shapely, or bbox tuple). |
required |
scale
|
int
|
Resolution in meters. |
300
|
compute_mode
|
ComputeMode
|
"precomputed" (default) or "on_the_fly". |
'precomputed'
|
npp_year_range
|
list[str] | None
|
Date range for observed NPP (on-the-fly mode). |
None
|
include_seasonality
|
bool
|
Include seasonality in functional integrity. |
True
|
bii_year
|
int | None
|
BII year to select for compositional integrity. |
None
|
absolute_diff_percentile
|
str
|
Percentile key for NPP absolute difference penalty. |
'p95'
|
Returns:
| Type | Description |
|---|---|
Dictionary
|
Dictionary with mean EII for each aggregation method. |
Example
comparison = compare_methods(my_polygon) print(comparison.getInfo())