Criterion B Details

# Default ecosystem code for template development.
# This line is replaced by build_ecosystem_pages.py for each ecosystem.
ecosystem_code = 'F2.2.1'

Import Python modules.

import os
import yaml
from pathlib import Path
from lonboard import Map
from rle_python_gee.ecosystems import Ecosystems
from rle_python_gee.eoo import make_eoo
from rle_python_gee.aoo import make_aoo_grid

Load the country config file.

project_root = os.environ.get('PIXI_PROJECT_ROOT', str(Path('..').resolve()))
config_path = Path(project_root) / 'config' / 'country_config.yaml'
with open(config_path) as f:
    config = yaml.safe_load(f)

Load & Filter Ecosystem Data

Load data for all the ecosystems.

source = config['ecosystem_source']
ecosystems = Ecosystems.from_file(
    source['data'],
    ecosystem_column=source['ecosystem_code_column'],
    ecosystem_name_column=source['ecosystem_name_column'],
    functional_group_column=source['functional_group_column']
)

Filter by the F2.2.1 and check the number of features.

ecosystem = ecosystems.filter(ecosystem_code)
has_data = ecosystem.size() > 0
print(f'{ecosystem.size() = }')
if not has_data:
    from IPython.display import Markdown, display
    display(Markdown(
        f'**No spatial data found for {ecosystem_code}.** '
        f'Criterion B calculations are skipped.'
    ))
ecosystem.size() = 59

Extent of Occurrence (EOO) (subcriterion B1)

Extent of occurrence (EOO). The EOO of an ecosystem is the area (km2) of a minimum convex polygon – the smallest polygon in which no internal angle exceeds 180° that encompasses all known current spatial occurrences of the ecosystem type.

The minimum convex polygon (also known as a convex hull) must not exclude any areas, discontinuities or disjunctions, regardless of whether the ecosystem can occur in those areas or not. Regions such as oceans (for terrestrial ecosystems), land (for coastal or marine ecosystems), or areas outside the study area (such as in a different country) must remain included within the minimum convex polygon to ensure that this standardised method is comparable across ecosystem types. In addition, these features contribute to spreading risks across the distribution of the ecosystem by making different parts of its distribution more spatially independent.

Calculate EOO

Start by calculating the convex hull of the ecosystem’s distribution.

import geopandas as gpd

if has_data:
    ecosystem_geometry = ecosystem.geometry.union_all()
    gdf_ecosystem_polygons = gpd.GeoDataFrame(geometry=[ecosystem_geometry], crs=ecosystem.geometry.crs)
    hull = ecosystem_geometry.convex_hull
    gdf_hull = gpd.GeoDataFrame(geometry=[hull], crs=ecosystem.geometry.crs)

Display the ecosystem’s distribution and the convex hull.

from lonboard import Map, PolygonLayer
from rle_python_gee.viz import smart_map

if has_data:
    eoo_hull = make_eoo(ecosystem).compute()
    display(smart_map([eoo_hull, ecosystem]))
/home/runner/work/rle-tyler-20/rle-tyler-20/.pixi/envs/default/lib/python3.11/site-packages/lonboard/_geoarrow/ops/reproject.py:116: UserWarning: Input being reprojected to EPSG:4326 CRS.
Lonboard is only able to render data in EPSG:4326 projection.
  warnings.warn(
/home/runner/work/rle-tyler-20/rle-tyler-20/.pixi/envs/default/lib/python3.11/site-packages/lonboard/_geoarrow/ops/reproject.py:116: UserWarning: Input being reprojected to EPSG:4326 CRS.
Lonboard is only able to render data in EPSG:4326 projection.
  warnings.warn(
if has_data:
    hull_ea = gdf_hull.to_crs("ESRI:54034")
    eoo = hull_ea.geometry.iloc[0].area / 1e6
    print(f'EOO is {eoo:.1f} km2')
EOO is 271283.9 km2

Then calculate the area of the convex hull polygon.

Direct calculation of EOO

EOO can also be calculated directly using …

if has_data:
    ecosystem.eoo

Verify that the area returned by calling make_eoo(ecosystem).compute().area_km2 is the same as the area of the convex hull polygon.

if has_data:
    assert ecosystem.eoo == eoo

Area of Occupancy (AOO) (subcriterion B2)

The protocol for this adjustment includes the following steps:

  1. Intersect AOO grid with the ecosystem’s distribution map.
  2. Calculate extent of the ecosystem type in each grid cell (area) and sum these areas to obtain the total ecosystem area (total area).
  3. Arrange grid cells in ascending order based on their area (smaller first). Calculate accumulated sum of area per cell (cumulative area).
  4. Calculate cumulative proportion by dividing cumulative area by total area (cumulative proportion takes values between 0 and 1)
  5. Calculate AOO by counting the number of cells with a cumulative proportion greater than 0.01 (i.e. exclude cells that in combination account for up to 1% of the total mapped extent of the ecosystem type).

AOO Calculation Details

Intersect AOO grid and ecosystem map

  1. Intersect AOO grid with the ecosystem’s distribution map
from pathlib import Path
from rle_python_gee.aoo import make_aoo_grid_cached

if has_data:
    cache_path = Path(project_root) / '.cache' / 'aoo_grid.parquet'
    aoo_grid = make_aoo_grid_cached(ecosystems, cache_path=cache_path)
    aoo_grid_filtered = aoo_grid.filter_by_ecosystem(ecosystem_code)

Visualize variations in the AOO grid.

from matplotlib.colors import LinearSegmentedColormap
from lonboard.colormap import apply_continuous_cmap
from rle_python_gee.aoo import slugify_ecosystem_name

ecosystem_column = slugify_ecosystem_name(ecosystem_code)
if has_data:
    cmap = LinearSegmentedColormap.from_list("white_red", ["white", "red"])
    values = aoo_grid_filtered.grid_cells[ecosystem_column].values
    normalized = (values - values.min()) / (values.max() - values.min())
    colors = apply_continuous_cmap(normalized, cmap)
    display(smart_map([(aoo_grid_filtered, {"get_fill_color": colors}), ecosystem]))
/home/runner/work/rle-tyler-20/rle-tyler-20/.pixi/envs/default/lib/python3.11/site-packages/lonboard/_geoarrow/ops/reproject.py:116: UserWarning: Input being reprojected to EPSG:4326 CRS.
Lonboard is only able to render data in EPSG:4326 projection.
  warnings.warn(

Calculate grid cell area and total area

  1. Calculate extent of the ecosystem type in each grid cell (area) and sum these areas to obtain the total ecosystem area (total area).
if has_data:
    keep = ['geometry', 'grid_col', 'grid_row', ecosystem_column]
    gdf = aoo_grid_filtered.grid_cells[keep]
    display(gdf)
geometry grid_col grid_row F2_2_1
0 POLYGON ((-77.7941 0.90441, -77.7941 0.99486, ... -867 10 0.022356
1 POLYGON ((-77.70427 0.99486, -77.70427 1.08531... -866 11 0.000277
2 POLYGON ((-77.70427 1.08531, -77.70427 1.17576... -866 12 0.002733
3 POLYGON ((-77.34495 0.90441, -77.34495 0.99486... -862 10 0.004398
4 POLYGON ((-77.25511 0.90441, -77.25511 0.99486... -861 10 0.000303
5 POLYGON ((-77.25511 1.08531, -77.25511 1.17576... -861 12 0.022303
6 POLYGON ((-76.3568 2.17099, -76.3568 2.2615, -... -851 24 0.009011
7 POLYGON ((-76.0873 2.80464, -76.0873 2.89518, ... -848 31 0.002543
8 POLYGON ((-75.99747 2.98573, -75.99747 3.07629... -847 33 0.004201
9 POLYGON ((-75.99747 3.16686, -75.99747 3.25744... -847 35 0.004372
10 POLYGON ((-75.99747 3.25744, -75.99747 3.34802... -847 36 0.006535
11 POLYGON ((-75.99747 3.34802, -75.99747 3.43861... -847 37 0.001817
12 POLYGON ((-75.99747 3.43861, -75.99747 3.52921... -847 38 0.006115
13 POLYGON ((-75.90764 3.07629, -75.90764 3.16686... -846 34 0.002778
14 POLYGON ((-75.72798 3.80106, -75.72798 3.8917,... -844 42 0.002559
15 POLYGON ((-75.54832 6.34319, -75.54832 6.43418... -842 70 0.003259
16 POLYGON ((-75.45848 6.07032, -75.45848 6.16126... -841 67 0.013117
17 POLYGON ((-75.45848 7.80102, -75.45848 7.89229... -841 86 0.002663
18 POLYGON ((-75.45848 7.89229, -75.45848 7.98358... -841 87 0.003152
19 POLYGON ((-75.36865 4.70788, -75.36865 4.79862... -840 52 0.009642
20 POLYGON ((-75.36865 6.43418, -75.36865 6.52518... -840 71 0.003087
21 POLYGON ((-75.27882 4.79862, -75.27882 4.88937... -839 53 0.003138
22 POLYGON ((-75.09916 7.80102, -75.09916 7.89229... -837 86 0.003190
23 POLYGON ((-74.91949 7.80102, -74.91949 7.89229... -835 86 0.002768
24 POLYGON ((-74.29067 3.80106, -74.29067 3.8917,... -828 42 0.002587
25 POLYGON ((-74.11101 3.80106, -74.11101 3.8917,... -826 42 0.002704
26 POLYGON ((-74.11101 3.8917, -74.11101 3.98235,... -826 43 0.025977
27 POLYGON ((-74.11101 3.98235, -74.11101 4.073, ... -826 44 0.008753
28 POLYGON ((-74.02118 3.8917, -74.02118 3.98235,... -825 43 0.004828
29 POLYGON ((-73.84152 5.2525, -73.84152 5.34332,... -823 58 0.009867
30 POLYGON ((-73.75168 4.43572, -73.75168 4.52643... -822 49 0.000790
31 POLYGON ((-73.75168 4.52643, -73.75168 4.61715... -822 50 0.004186
32 POLYGON ((-73.75168 5.1617, -73.75168 5.2525, ... -822 57 0.023318
33 POLYGON ((-73.75168 5.2525, -73.75168 5.34332,... -822 58 0.010472
34 POLYGON ((-73.66185 4.43572, -73.66185 4.52643... -821 49 0.002854
35 POLYGON ((-73.66185 4.52643, -73.66185 4.61715... -821 50 0.002956
36 POLYGON ((-73.66185 10.73256, -73.66185 10.824... -821 118 0.028806
37 POLYGON ((-73.57202 10.73256, -73.57202 10.824... -820 118 0.000311
38 POLYGON ((-73.48219 5.34332, -73.48219 5.43414... -819 59 0.011485
39 POLYGON ((-73.48219 5.43414, -73.48219 5.52498... -819 60 0.010799
40 POLYGON ((-73.2127 5.52498, -73.2127 5.61584, ... -816 61 0.000151
41 POLYGON ((-73.12286 5.52498, -73.12286 5.61584... -815 61 0.042056
42 POLYGON ((-73.12286 5.61584, -73.12286 5.70671... -815 62 0.013316
43 POLYGON ((-73.12286 5.70671, -73.12286 5.79759... -815 63 0.007180
44 POLYGON ((-73.03303 5.70671, -73.03303 5.79759... -814 63 0.014981
45 POLYGON ((-72.9432 7.61854, -72.9432 7.70977, ... -813 84 0.003781
46 POLYGON ((-72.49404 5.9794, -72.49404 6.07032,... -808 66 0.002640
47 POLYGON ((-72.49404 6.79829, -72.49404 6.88936... -808 75 0.003251
48 POLYGON ((-72.49404 6.88936, -72.49404 6.98044... -808 76 0.005493
49 POLYGON ((-72.40421 6.16126, -72.40421 6.25222... -807 68 0.003398
50 POLYGON ((-72.31438 5.9794, -72.31438 6.07032,... -806 66 0.025541
51 POLYGON ((-72.31438 6.70724, -72.31438 6.79829... -806 74 0.003523
52 POLYGON ((-72.22455 6.34319, -72.22455 6.43418... -805 70 0.015377

The column F2_2_1 contains the (fractional) area of the ecosystem in each grid cell.

Sum up the areas of each grid cell to get the total area.

if has_data:
    total_area = gdf[ecosystem_column].sum()
    display(total_area)
np.float64(0.4277006275630835)

Calculate cumulative area

  1. Arrange grid cells in ascending order based on their area (smaller first). Calculate accumulated sum of area per cell (cumulative area).
if has_data:
    gdf = gdf.sort_values(by=ecosystem_column)
    gdf["cumulative_area"] = gdf[ecosystem_column].cumsum()
    display(gdf)
geometry grid_col grid_row F2_2_1 cumulative_area
40 POLYGON ((-73.2127 5.52498, -73.2127 5.61584, ... -816 61 0.000151 0.000151
1 POLYGON ((-77.70427 0.99486, -77.70427 1.08531... -866 11 0.000277 0.000428
4 POLYGON ((-77.25511 0.90441, -77.25511 0.99486... -861 10 0.000303 0.000731
37 POLYGON ((-73.57202 10.73256, -73.57202 10.824... -820 118 0.000311 0.001042
30 POLYGON ((-73.75168 4.43572, -73.75168 4.52643... -822 49 0.000790 0.001832
11 POLYGON ((-75.99747 3.34802, -75.99747 3.43861... -847 37 0.001817 0.003649
7 POLYGON ((-76.0873 2.80464, -76.0873 2.89518, ... -848 31 0.002543 0.006192
14 POLYGON ((-75.72798 3.80106, -75.72798 3.8917,... -844 42 0.002559 0.008751
24 POLYGON ((-74.29067 3.80106, -74.29067 3.8917,... -828 42 0.002587 0.011338
46 POLYGON ((-72.49404 5.9794, -72.49404 6.07032,... -808 66 0.002640 0.013978
17 POLYGON ((-75.45848 7.80102, -75.45848 7.89229... -841 86 0.002663 0.016641
25 POLYGON ((-74.11101 3.80106, -74.11101 3.8917,... -826 42 0.002704 0.019345
2 POLYGON ((-77.70427 1.08531, -77.70427 1.17576... -866 12 0.002733 0.022078
23 POLYGON ((-74.91949 7.80102, -74.91949 7.89229... -835 86 0.002768 0.024846
13 POLYGON ((-75.90764 3.07629, -75.90764 3.16686... -846 34 0.002778 0.027624
34 POLYGON ((-73.66185 4.43572, -73.66185 4.52643... -821 49 0.002854 0.030479
35 POLYGON ((-73.66185 4.52643, -73.66185 4.61715... -821 50 0.002956 0.033435
20 POLYGON ((-75.36865 6.43418, -75.36865 6.52518... -840 71 0.003087 0.036522
21 POLYGON ((-75.27882 4.79862, -75.27882 4.88937... -839 53 0.003138 0.039660
18 POLYGON ((-75.45848 7.89229, -75.45848 7.98358... -841 87 0.003152 0.042812
22 POLYGON ((-75.09916 7.80102, -75.09916 7.89229... -837 86 0.003190 0.046002
47 POLYGON ((-72.49404 6.79829, -72.49404 6.88936... -808 75 0.003251 0.049253
15 POLYGON ((-75.54832 6.34319, -75.54832 6.43418... -842 70 0.003259 0.052512
49 POLYGON ((-72.40421 6.16126, -72.40421 6.25222... -807 68 0.003398 0.055910
51 POLYGON ((-72.31438 6.70724, -72.31438 6.79829... -806 74 0.003523 0.059433
45 POLYGON ((-72.9432 7.61854, -72.9432 7.70977, ... -813 84 0.003781 0.063214
31 POLYGON ((-73.75168 4.52643, -73.75168 4.61715... -822 50 0.004186 0.067400
8 POLYGON ((-75.99747 2.98573, -75.99747 3.07629... -847 33 0.004201 0.071601
9 POLYGON ((-75.99747 3.16686, -75.99747 3.25744... -847 35 0.004372 0.075974
3 POLYGON ((-77.34495 0.90441, -77.34495 0.99486... -862 10 0.004398 0.080372
28 POLYGON ((-74.02118 3.8917, -74.02118 3.98235,... -825 43 0.004828 0.085200
48 POLYGON ((-72.49404 6.88936, -72.49404 6.98044... -808 76 0.005493 0.090693
12 POLYGON ((-75.99747 3.43861, -75.99747 3.52921... -847 38 0.006115 0.096808
10 POLYGON ((-75.99747 3.25744, -75.99747 3.34802... -847 36 0.006535 0.103343
43 POLYGON ((-73.12286 5.70671, -73.12286 5.79759... -815 63 0.007180 0.110523
27 POLYGON ((-74.11101 3.98235, -74.11101 4.073, ... -826 44 0.008753 0.119276
6 POLYGON ((-76.3568 2.17099, -76.3568 2.2615, -... -851 24 0.009011 0.128286
19 POLYGON ((-75.36865 4.70788, -75.36865 4.79862... -840 52 0.009642 0.137929
29 POLYGON ((-73.84152 5.2525, -73.84152 5.34332,... -823 58 0.009867 0.147796
33 POLYGON ((-73.75168 5.2525, -73.75168 5.34332,... -822 58 0.010472 0.158268
39 POLYGON ((-73.48219 5.43414, -73.48219 5.52498... -819 60 0.010799 0.169067
38 POLYGON ((-73.48219 5.34332, -73.48219 5.43414... -819 59 0.011485 0.180551
16 POLYGON ((-75.45848 6.07032, -75.45848 6.16126... -841 67 0.013117 0.193669
42 POLYGON ((-73.12286 5.61584, -73.12286 5.70671... -815 62 0.013316 0.206985
44 POLYGON ((-73.03303 5.70671, -73.03303 5.79759... -814 63 0.014981 0.221966
52 POLYGON ((-72.22455 6.34319, -72.22455 6.43418... -805 70 0.015377 0.237343
5 POLYGON ((-77.25511 1.08531, -77.25511 1.17576... -861 12 0.022303 0.259646
0 POLYGON ((-77.7941 0.90441, -77.7941 0.99486, ... -867 10 0.022356 0.282002
32 POLYGON ((-73.75168 5.1617, -73.75168 5.2525, ... -822 57 0.023318 0.305320
50 POLYGON ((-72.31438 5.9794, -72.31438 6.07032,... -806 66 0.025541 0.330861
26 POLYGON ((-74.11101 3.8917, -74.11101 3.98235,... -826 43 0.025977 0.356839
36 POLYGON ((-73.66185 10.73256, -73.66185 10.824... -821 118 0.028806 0.385644
41 POLYGON ((-73.12286 5.52498, -73.12286 5.61584... -815 61 0.042056 0.427701

Calculate cumulative proportion

  1. Calculate cumulative proportion by dividing cumulative area by total area (cumulative proportion takes values between 0 and 1)
if has_data:
    gdf["cumulative_proportion"] = gdf["cumulative_area"] / total_area
    display(gdf)
geometry grid_col grid_row F2_2_1 cumulative_area cumulative_proportion
40 POLYGON ((-73.2127 5.52498, -73.2127 5.61584, ... -816 61 0.000151 0.000151 0.000354
1 POLYGON ((-77.70427 0.99486, -77.70427 1.08531... -866 11 0.000277 0.000428 0.001002
4 POLYGON ((-77.25511 0.90441, -77.25511 0.99486... -861 10 0.000303 0.000731 0.001710
37 POLYGON ((-73.57202 10.73256, -73.57202 10.824... -820 118 0.000311 0.001042 0.002437
30 POLYGON ((-73.75168 4.43572, -73.75168 4.52643... -822 49 0.000790 0.001832 0.004284
11 POLYGON ((-75.99747 3.34802, -75.99747 3.43861... -847 37 0.001817 0.003649 0.008532
7 POLYGON ((-76.0873 2.80464, -76.0873 2.89518, ... -848 31 0.002543 0.006192 0.014479
14 POLYGON ((-75.72798 3.80106, -75.72798 3.8917,... -844 42 0.002559 0.008751 0.020461
24 POLYGON ((-74.29067 3.80106, -74.29067 3.8917,... -828 42 0.002587 0.011338 0.026509
46 POLYGON ((-72.49404 5.9794, -72.49404 6.07032,... -808 66 0.002640 0.013978 0.032682
17 POLYGON ((-75.45848 7.80102, -75.45848 7.89229... -841 86 0.002663 0.016641 0.038909
25 POLYGON ((-74.11101 3.80106, -74.11101 3.8917,... -826 42 0.002704 0.019345 0.045230
2 POLYGON ((-77.70427 1.08531, -77.70427 1.17576... -866 12 0.002733 0.022078 0.051620
23 POLYGON ((-74.91949 7.80102, -74.91949 7.89229... -835 86 0.002768 0.024846 0.058092
13 POLYGON ((-75.90764 3.07629, -75.90764 3.16686... -846 34 0.002778 0.027624 0.064588
34 POLYGON ((-73.66185 4.43572, -73.66185 4.52643... -821 49 0.002854 0.030479 0.071262
35 POLYGON ((-73.66185 4.52643, -73.66185 4.61715... -821 50 0.002956 0.033435 0.078173
20 POLYGON ((-75.36865 6.43418, -75.36865 6.52518... -840 71 0.003087 0.036522 0.085391
21 POLYGON ((-75.27882 4.79862, -75.27882 4.88937... -839 53 0.003138 0.039660 0.092728
18 POLYGON ((-75.45848 7.89229, -75.45848 7.98358... -841 87 0.003152 0.042812 0.100098
22 POLYGON ((-75.09916 7.80102, -75.09916 7.89229... -837 86 0.003190 0.046002 0.107557
47 POLYGON ((-72.49404 6.79829, -72.49404 6.88936... -808 75 0.003251 0.049253 0.115157
15 POLYGON ((-75.54832 6.34319, -75.54832 6.43418... -842 70 0.003259 0.052512 0.122777
49 POLYGON ((-72.40421 6.16126, -72.40421 6.25222... -807 68 0.003398 0.055910 0.130722
51 POLYGON ((-72.31438 6.70724, -72.31438 6.79829... -806 74 0.003523 0.059433 0.138959
45 POLYGON ((-72.9432 7.61854, -72.9432 7.70977, ... -813 84 0.003781 0.063214 0.147800
31 POLYGON ((-73.75168 4.52643, -73.75168 4.61715... -822 50 0.004186 0.067400 0.157587
8 POLYGON ((-75.99747 2.98573, -75.99747 3.07629... -847 33 0.004201 0.071601 0.167410
9 POLYGON ((-75.99747 3.16686, -75.99747 3.25744... -847 35 0.004372 0.075974 0.177632
3 POLYGON ((-77.34495 0.90441, -77.34495 0.99486... -862 10 0.004398 0.080372 0.187916
28 POLYGON ((-74.02118 3.8917, -74.02118 3.98235,... -825 43 0.004828 0.085200 0.199204
48 POLYGON ((-72.49404 6.88936, -72.49404 6.98044... -808 76 0.005493 0.090693 0.212047
12 POLYGON ((-75.99747 3.43861, -75.99747 3.52921... -847 38 0.006115 0.096808 0.226345
10 POLYGON ((-75.99747 3.25744, -75.99747 3.34802... -847 36 0.006535 0.103343 0.241625
43 POLYGON ((-73.12286 5.70671, -73.12286 5.79759... -815 63 0.007180 0.110523 0.258412
27 POLYGON ((-74.11101 3.98235, -74.11101 4.073, ... -826 44 0.008753 0.119276 0.278877
6 POLYGON ((-76.3568 2.17099, -76.3568 2.2615, -... -851 24 0.009011 0.128286 0.299944
19 POLYGON ((-75.36865 4.70788, -75.36865 4.79862... -840 52 0.009642 0.137929 0.322489
29 POLYGON ((-73.84152 5.2525, -73.84152 5.34332,... -823 58 0.009867 0.147796 0.345558
33 POLYGON ((-73.75168 5.2525, -73.75168 5.34332,... -822 58 0.010472 0.158268 0.370043
39 POLYGON ((-73.48219 5.43414, -73.48219 5.52498... -819 60 0.010799 0.169067 0.395292
38 POLYGON ((-73.48219 5.34332, -73.48219 5.43414... -819 59 0.011485 0.180551 0.422144
16 POLYGON ((-75.45848 6.07032, -75.45848 6.16126... -841 67 0.013117 0.193669 0.452814
42 POLYGON ((-73.12286 5.61584, -73.12286 5.70671... -815 62 0.013316 0.206985 0.483949
44 POLYGON ((-73.03303 5.70671, -73.03303 5.79759... -814 63 0.014981 0.221966 0.518976
52 POLYGON ((-72.22455 6.34319, -72.22455 6.43418... -805 70 0.015377 0.237343 0.554928
5 POLYGON ((-77.25511 1.08531, -77.25511 1.17576... -861 12 0.022303 0.259646 0.607075
0 POLYGON ((-77.7941 0.90441, -77.7941 0.99486, ... -867 10 0.022356 0.282002 0.659346
32 POLYGON ((-73.75168 5.1617, -73.75168 5.2525, ... -822 57 0.023318 0.305320 0.713865
50 POLYGON ((-72.31438 5.9794, -72.31438 6.07032,... -806 66 0.025541 0.330861 0.773581
26 POLYGON ((-74.11101 3.8917, -74.11101 3.98235,... -826 43 0.025977 0.356839 0.834319
36 POLYGON ((-73.66185 10.73256, -73.66185 10.824... -821 118 0.028806 0.385644 0.901669
41 POLYGON ((-73.12286 5.52498, -73.12286 5.61584... -815 61 0.042056 0.427701 1.000000

Count AOO cells

  1. Calculate AOO by counting the number of cells with a cumulative proportion greater than 0.01 (i.e. exclude cells that in combination account for up to 1% of the total mapped extent of the ecosystem type).
if has_data:
    aoo = len(gdf[gdf["cumulative_proportion"] > 0.01])
    print(f'AOO is {aoo} cells')
AOO is 47 cells

AOO Calculation (direct call)

if has_data:
    aoo_count = ecosystem.aoo
    print(f'AOO: {aoo_count} grid cells')
AOO: 47 grid cells
if has_data:
    display(smart_map([aoo_grid_filtered, ecosystem]))
/home/runner/work/rle-tyler-20/rle-tyler-20/.pixi/envs/default/lib/python3.11/site-packages/lonboard/_geoarrow/ops/reproject.py:116: UserWarning: Input being reprojected to EPSG:4326 CRS.
Lonboard is only able to render data in EPSG:4326 projection.
  warnings.warn(

Criterion B Summary

Ecosystem Code Ecosystem Name EOO AOO
F2.2.1 INDEF 271284 km² 47 cells