eii.client
Google Earth Engine interface for EII data access.
Data Retrieval
Core retrieval functions for EII data.
This module provides the main interface for extracting Ecosystem Integrity Index data from pre-computed GEE assets.
get_stats(geometry, aggregation_method='min_fuzzy_logic', include_components=True, scale=300, stats=None, percentiles=None, compute_mode='precomputed', npp_year_range=OBSERVED_NPP_YEAR_RANGE, include_seasonality=True, natural_npp_asset_path=NATURAL_NPP_ASSET_PATH, observed_npp_asset_path=OBSERVED_NPP_ASSET_PATH, structural_asset_path=None, bii_year=DEFAULT_BII_YEAR, absolute_diff_percentile='p95', output_format='dict')
Extract EII values or statistics for a given geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometry
|
Geometry
|
AOI geometry (ee.Geometry/Feature/FeatureCollection, GeoPandas, shapely, or bbox tuple). |
required |
aggregation_method
|
AggregationMethod
|
EII aggregation method. Defaults to "min_fuzzy_logic". |
'min_fuzzy_logic'
|
include_components
|
bool
|
If True, include statistics for functional, structural, and compositional integrity. Defaults to True. |
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]
|
Date range for observed NPP (on-the-fly mode). |
OBSERVED_NPP_YEAR_RANGE
|
include_seasonality
|
bool
|
Include seasonality in functional integrity. |
True
|
natural_npp_asset_path
|
str
|
Asset for pre-computed natural NPP. |
NATURAL_NPP_ASSET_PATH
|
observed_npp_asset_path
|
str
|
Asset for observed NPP annual tiles. |
OBSERVED_NPP_ASSET_PATH
|
structural_asset_path
|
str | None
|
Asset for structural integrity core area. |
None
|
bii_year
|
int
|
BII year to select for compositional integrity. |
DEFAULT_BII_YEAR
|
absolute_diff_percentile
|
str
|
Percentile key for NPP absolute difference penalty. |
'p95'
|
output_format
|
OutputFormat
|
"dict" (default) or "geodataframe". |
'dict'
|
Returns:
| Type | Description |
|---|---|
|
A structured dictionary or GeoDataFrame depending on output_format. |
|
|
Point geometries return single values; area geometries return summary |
|
|
statistics in nested format: {"eii": {"mean": ..., "min": ...}}. |
Example
import ee ee.Initialize() polygon = ee.Geometry.Rectangle([-60, -10, -55, -5]) stats = get_stats(polygon, stats=["mean", "min", "max"]) print(stats)
Source code in src/eii/client/retrieve.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | |
get_raster(geometry, aggregation_method='min_fuzzy_logic', include_components=True, scale=300, compute_mode='precomputed', npp_year_range=OBSERVED_NPP_YEAR_RANGE, include_seasonality=True, natural_npp_asset_path=NATURAL_NPP_ASSET_PATH, observed_npp_asset_path=OBSERVED_NPP_ASSET_PATH, structural_asset_path=None, bii_year=DEFAULT_BII_YEAR, absolute_diff_percentile='p95', max_area_sq_km=None, max_pixels=None, chunking='auto', tile_size_deg=1.0, tmp_dir=None, out_path=None, output_format='memory', compression=None, max_memory_fraction=0.25, dtype='float64', download_crs='EPSG:4326')
Download EII rasters for an AOI as an xarray Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometry
|
Geometry
|
AOI geometry (ee.Geometry/Feature/FeatureCollection, GeoPandas, shapely, or bbox tuple). |
required |
aggregation_method
|
AggregationMethod
|
EII aggregation method. |
'min_fuzzy_logic'
|
include_components
|
bool
|
If True, include component bands alongside EII. |
True
|
scale
|
int
|
Resolution in meters for export. Defaults to 300. |
300
|
compute_mode
|
ComputeMode
|
"precomputed" (default) or "on_the_fly". |
'precomputed'
|
npp_year_range
|
list[str]
|
Date range for observed NPP (on-the-fly mode). |
OBSERVED_NPP_YEAR_RANGE
|
include_seasonality
|
bool
|
Include seasonality in functional integrity. |
True
|
natural_npp_asset_path
|
str
|
Asset for pre-computed natural NPP. |
NATURAL_NPP_ASSET_PATH
|
observed_npp_asset_path
|
str
|
Asset for observed NPP annual tiles. |
OBSERVED_NPP_ASSET_PATH
|
structural_asset_path
|
str | None
|
Asset for structural integrity core area. |
None
|
bii_year
|
int
|
BII year to select for compositional integrity. |
DEFAULT_BII_YEAR
|
absolute_diff_percentile
|
str
|
Percentile key for NPP absolute difference penalty. |
'p95'
|
max_area_sq_km
|
float | None
|
Optional upper bound for AOI area before chunking. |
None
|
max_pixels
|
int | None
|
Optional upper bound for total pixels before chunking. |
None
|
chunking
|
Literal['auto', 'never', 'always']
|
"auto" (default), "never", or "always". |
'auto'
|
tile_size_deg
|
float
|
Tile size for chunked downloads in degrees. |
1.0
|
tmp_dir
|
str | None
|
Optional directory for intermediate downloads. |
None
|
out_path
|
str | None
|
Optional output path. For chunked downloads, use a directory (multiple files) or a file path for single GeoTIFF streaming output. |
None
|
output_format
|
Literal['memory', 'geotiff']
|
"memory" (default) or "geotiff". |
'memory'
|
compression
|
str | None
|
Compression codec for GeoTIFF (default ZSTD). |
None
|
max_memory_fraction
|
float
|
Fraction of available RAM used for auto chunking. |
0.25
|
dtype
|
Literal['float32', 'float64']
|
Output dtype for the xarray Dataset. |
'float64'
|
download_crs
|
str
|
CRS for downloads (default EPSG:4326). |
'EPSG:4326'
|
Band order
"eii", "functional_integrity", "structural_integrity", "compositional_integrity".
Returns:
| Type | Description |
|---|---|
|
xarray.Dataset when output_format="memory"; otherwise a Path (single download) |
|
|
or list[Path] (chunked downloads) to the written files. |
Source code in src/eii/client/retrieve.py
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | |
get_layers(layers='all', aggregation_method='min_fuzzy_logic', compute_mode='precomputed', geometry=None, npp_year_range=OBSERVED_NPP_YEAR_RANGE, include_seasonality=True, natural_npp_asset_path=NATURAL_NPP_ASSET_PATH, observed_npp_asset_path=OBSERVED_NPP_ASSET_PATH, structural_asset_path=None, bii_year=DEFAULT_BII_YEAR, absolute_diff_percentile='p95')
Get EII and/or component layers for a given geometry and computation mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layers
|
LayerSelection
|
Which layers to return: "eii", "components", or "all". |
'all'
|
aggregation_method
|
AggregationMethod
|
EII aggregation method. |
'min_fuzzy_logic'
|
compute_mode
|
ComputeMode
|
"precomputed" (default) or "on_the_fly". |
'precomputed'
|
geometry
|
Geometry | None
|
Optional geometry for on-the-fly component calculation. |
None
|
npp_year_range
|
list[str]
|
Date range for observed NPP (on-the-fly mode). |
OBSERVED_NPP_YEAR_RANGE
|
include_seasonality
|
bool
|
Include seasonality in functional integrity. |
True
|
natural_npp_asset_path
|
str
|
Asset for pre-computed natural NPP. |
NATURAL_NPP_ASSET_PATH
|
observed_npp_asset_path
|
str
|
Asset for observed NPP annual tiles. |
OBSERVED_NPP_ASSET_PATH
|
structural_asset_path
|
str | None
|
Asset for structural integrity core area. |
None
|
bii_year
|
int
|
BII year to select for compositional integrity. |
DEFAULT_BII_YEAR
|
absolute_diff_percentile
|
str
|
Percentile key for NPP absolute difference penalty. |
'p95'
|
Returns:
| Type | Description |
|---|---|
dict[str, Image]
|
Dictionary of Earth Engine images. Keys include "eii" and/or component |
dict[str, Image]
|
names ("functional", "structural", "compositional"). |
Example
layers = get_layers(layers="all") eii = layers["eii"].clip(my_polygon)
Source code in src/eii/client/retrieve.py
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 | |
Asset Management
Google Earth Engine asset paths and metadata for EII data products.
This module contains the paths to pre-computed EII data assets in Google Earth Engine.
get_asset_info(asset_name)
Get full metadata for an asset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset_name
|
str
|
Name of the asset |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary containing asset metadata (path, description, bands, etc.) |
get_asset_path(asset_name)
Get the Earth Engine asset path for a given asset name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset_name
|
str
|
Name of the asset (e.g., 'eii', 'components', 'npp_predictions') |
required |
Returns:
| Type | Description |
|---|---|
str
|
The full Earth Engine asset path. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the asset name is not found. |
Example
path = get_asset_path("eii") print(path) 'projects/landler-open-data/assets/eii/scores/eii'