Criterion B Details

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

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 T5.2.2 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() = 47

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-ruritania-thomas/rle-ruritania-thomas/.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-ruritania-thomas/rle-ruritania-thomas/.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 8839.1 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-ruritania-thomas/rle-ruritania-thomas/.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 T5_2_2
0 POLYGON ((-72.22455 11.83865, -72.22455 11.931... -805 130 0.025347
1 POLYGON ((-72.13472 11.19293, -72.13472 11.285... -804 123 0.000324
2 POLYGON ((-72.13472 11.28509, -72.13472 11.377... -804 124 0.000272
3 POLYGON ((-72.13472 11.83865, -72.13472 11.931... -804 130 0.200753
4 POLYGON ((-72.13472 11.93102, -72.13472 12.023... -804 131 0.221869
5 POLYGON ((-72.13472 12.02342, -72.13472 12.115... -804 132 0.189220
6 POLYGON ((-72.13472 12.11584, -72.13472 12.208... -804 133 0.111997
7 POLYGON ((-72.13472 12.2083, -72.13472 12.3007... -804 134 0.108972
8 POLYGON ((-72.04489 11.83865, -72.04489 11.931... -803 130 0.043618
9 POLYGON ((-72.04489 12.02342, -72.04489 12.115... -803 132 0.072893
10 POLYGON ((-72.04489 12.11584, -72.04489 12.208... -803 133 0.841081
11 POLYGON ((-72.04489 12.2083, -72.04489 12.3007... -803 134 0.294374
12 POLYGON ((-71.95505 12.02342, -71.95505 12.115... -802 132 0.044158
13 POLYGON ((-71.95505 12.11584, -71.95505 12.208... -802 133 0.672293
14 POLYGON ((-71.95505 12.2083, -71.95505 12.3007... -802 134 0.358193
15 POLYGON ((-71.86522 12.02342, -71.86522 12.115... -801 132 0.380588
16 POLYGON ((-71.86522 12.11584, -71.86522 12.208... -801 133 0.512544
17 POLYGON ((-71.86522 12.2083, -71.86522 12.3007... -801 134 0.230348
18 POLYGON ((-71.86522 12.30079, -71.86522 12.393... -801 135 0.156713
19 POLYGON ((-71.77539 11.65401, -71.77539 11.746... -800 128 0.000786
20 POLYGON ((-71.77539 12.02342, -71.77539 12.115... -800 132 0.177099
21 POLYGON ((-71.77539 12.11584, -71.77539 12.208... -800 133 0.305242
22 POLYGON ((-71.77539 12.2083, -71.77539 12.3007... -800 134 0.903159
23 POLYGON ((-71.77539 12.30079, -71.77539 12.393... -800 135 0.348547
24 POLYGON ((-71.68556 11.65401, -71.68556 11.746... -799 128 0.000049
25 POLYGON ((-71.68556 11.74632, -71.68556 11.838... -799 129 0.000009
26 POLYGON ((-71.68556 11.83865, -71.68556 11.931... -799 130 0.026525
27 POLYGON ((-71.68556 11.93102, -71.68556 12.023... -799 131 0.214035
28 POLYGON ((-71.68556 12.11584, -71.68556 12.208... -799 133 0.115390
29 POLYGON ((-71.68556 12.2083, -71.68556 12.3007... -799 134 0.400309
30 POLYGON ((-71.68556 12.30079, -71.68556 12.393... -799 135 0.652381
31 POLYGON ((-71.68556 12.39331, -71.68556 12.485... -799 136 0.107051
32 POLYGON ((-71.59573 11.83865, -71.59573 11.931... -798 130 0.198667
33 POLYGON ((-71.59573 11.93102, -71.59573 12.023... -798 131 0.450032
34 POLYGON ((-71.59573 12.2083, -71.59573 12.3007... -798 134 0.258278
35 POLYGON ((-71.59573 12.30079, -71.59573 12.393... -798 135 0.932666
36 POLYGON ((-71.59573 12.39331, -71.59573 12.485... -798 136 0.430782
37 POLYGON ((-71.5059 11.74632, -71.5059 11.83865... -797 129 0.020141
38 POLYGON ((-71.5059 11.83865, -71.5059 11.93102... -797 130 0.543172
39 POLYGON ((-71.5059 11.93102, -71.5059 12.02342... -797 131 0.308959
40 POLYGON ((-71.5059 12.2083, -71.5059 12.30079,... -797 134 0.193402
41 POLYGON ((-71.5059 12.30079, -71.5059 12.39331... -797 135 0.749183
42 POLYGON ((-71.5059 12.39331, -71.5059 12.48587... -797 136 0.358634
43 POLYGON ((-71.41607 11.74632, -71.41607 11.838... -796 129 0.026162
44 POLYGON ((-71.41607 11.83865, -71.41607 11.931... -796 130 0.414513
45 POLYGON ((-71.41607 11.93102, -71.41607 12.023... -796 131 0.571442
46 POLYGON ((-71.41607 12.30079, -71.41607 12.393... -796 135 0.124567
47 POLYGON ((-71.41607 12.39331, -71.41607 12.485... -796 136 0.027081
48 POLYGON ((-71.32623 11.74632, -71.32623 11.838... -795 129 0.013314
49 POLYGON ((-71.32623 11.83865, -71.32623 11.931... -795 130 0.819897
50 POLYGON ((-71.32623 11.93102, -71.32623 12.023... -795 131 0.274259
51 POLYGON ((-71.2364 11.83865, -71.2364 11.93102... -794 130 0.136918
52 POLYGON ((-71.2364 11.93102, -71.2364 12.02342... -794 131 0.469495

The column T5_2_2 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(15.037707238541868)

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 T5_2_2 cumulative_area
25 POLYGON ((-71.68556 11.74632, -71.68556 11.838... -799 129 0.000009 0.000009
24 POLYGON ((-71.68556 11.65401, -71.68556 11.746... -799 128 0.000049 0.000058
2 POLYGON ((-72.13472 11.28509, -72.13472 11.377... -804 124 0.000272 0.000330
1 POLYGON ((-72.13472 11.19293, -72.13472 11.285... -804 123 0.000324 0.000654
19 POLYGON ((-71.77539 11.65401, -71.77539 11.746... -800 128 0.000786 0.001441
48 POLYGON ((-71.32623 11.74632, -71.32623 11.838... -795 129 0.013314 0.014755
37 POLYGON ((-71.5059 11.74632, -71.5059 11.83865... -797 129 0.020141 0.034897
0 POLYGON ((-72.22455 11.83865, -72.22455 11.931... -805 130 0.025347 0.060244
43 POLYGON ((-71.41607 11.74632, -71.41607 11.838... -796 129 0.026162 0.086406
26 POLYGON ((-71.68556 11.83865, -71.68556 11.931... -799 130 0.026525 0.112931
47 POLYGON ((-71.41607 12.39331, -71.41607 12.485... -796 136 0.027081 0.140012
8 POLYGON ((-72.04489 11.83865, -72.04489 11.931... -803 130 0.043618 0.183630
12 POLYGON ((-71.95505 12.02342, -71.95505 12.115... -802 132 0.044158 0.227788
9 POLYGON ((-72.04489 12.02342, -72.04489 12.115... -803 132 0.072893 0.300680
31 POLYGON ((-71.68556 12.39331, -71.68556 12.485... -799 136 0.107051 0.407731
7 POLYGON ((-72.13472 12.2083, -72.13472 12.3007... -804 134 0.108972 0.516703
6 POLYGON ((-72.13472 12.11584, -72.13472 12.208... -804 133 0.111997 0.628700
28 POLYGON ((-71.68556 12.11584, -71.68556 12.208... -799 133 0.115390 0.744091
46 POLYGON ((-71.41607 12.30079, -71.41607 12.393... -796 135 0.124567 0.868658
51 POLYGON ((-71.2364 11.83865, -71.2364 11.93102... -794 130 0.136918 1.005576
18 POLYGON ((-71.86522 12.30079, -71.86522 12.393... -801 135 0.156713 1.162289
20 POLYGON ((-71.77539 12.02342, -71.77539 12.115... -800 132 0.177099 1.339388
5 POLYGON ((-72.13472 12.02342, -72.13472 12.115... -804 132 0.189220 1.528609
40 POLYGON ((-71.5059 12.2083, -71.5059 12.30079,... -797 134 0.193402 1.722011
32 POLYGON ((-71.59573 11.83865, -71.59573 11.931... -798 130 0.198667 1.920678
3 POLYGON ((-72.13472 11.83865, -72.13472 11.931... -804 130 0.200753 2.121431
27 POLYGON ((-71.68556 11.93102, -71.68556 12.023... -799 131 0.214035 2.335466
4 POLYGON ((-72.13472 11.93102, -72.13472 12.023... -804 131 0.221869 2.557336
17 POLYGON ((-71.86522 12.2083, -71.86522 12.3007... -801 134 0.230348 2.787684
34 POLYGON ((-71.59573 12.2083, -71.59573 12.3007... -798 134 0.258278 3.045962
50 POLYGON ((-71.32623 11.93102, -71.32623 12.023... -795 131 0.274259 3.320221
11 POLYGON ((-72.04489 12.2083, -72.04489 12.3007... -803 134 0.294374 3.614596
21 POLYGON ((-71.77539 12.11584, -71.77539 12.208... -800 133 0.305242 3.919837
39 POLYGON ((-71.5059 11.93102, -71.5059 12.02342... -797 131 0.308959 4.228797
23 POLYGON ((-71.77539 12.30079, -71.77539 12.393... -800 135 0.348547 4.577344
14 POLYGON ((-71.95505 12.2083, -71.95505 12.3007... -802 134 0.358193 4.935537
42 POLYGON ((-71.5059 12.39331, -71.5059 12.48587... -797 136 0.358634 5.294171
15 POLYGON ((-71.86522 12.02342, -71.86522 12.115... -801 132 0.380588 5.674759
29 POLYGON ((-71.68556 12.2083, -71.68556 12.3007... -799 134 0.400309 6.075068
44 POLYGON ((-71.41607 11.83865, -71.41607 11.931... -796 130 0.414513 6.489581
36 POLYGON ((-71.59573 12.39331, -71.59573 12.485... -798 136 0.430782 6.920363
33 POLYGON ((-71.59573 11.93102, -71.59573 12.023... -798 131 0.450032 7.370395
52 POLYGON ((-71.2364 11.93102, -71.2364 12.02342... -794 131 0.469495 7.839890
16 POLYGON ((-71.86522 12.11584, -71.86522 12.208... -801 133 0.512544 8.352434
38 POLYGON ((-71.5059 11.83865, -71.5059 11.93102... -797 130 0.543172 8.895606
45 POLYGON ((-71.41607 11.93102, -71.41607 12.023... -796 131 0.571442 9.467047
30 POLYGON ((-71.68556 12.30079, -71.68556 12.393... -799 135 0.652381 10.119428
13 POLYGON ((-71.95505 12.11584, -71.95505 12.208... -802 133 0.672293 10.791721
41 POLYGON ((-71.5059 12.30079, -71.5059 12.39331... -797 135 0.749183 11.540904
49 POLYGON ((-71.32623 11.83865, -71.32623 11.931... -795 130 0.819897 12.360802
10 POLYGON ((-72.04489 12.11584, -72.04489 12.208... -803 133 0.841081 13.201882
22 POLYGON ((-71.77539 12.2083, -71.77539 12.3007... -800 134 0.903159 14.105041
35 POLYGON ((-71.59573 12.30079, -71.59573 12.393... -798 135 0.932666 15.037707

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 T5_2_2 cumulative_area cumulative_proportion
25 POLYGON ((-71.68556 11.74632, -71.68556 11.838... -799 129 0.000009 0.000009 5.861806e-07
24 POLYGON ((-71.68556 11.65401, -71.68556 11.746... -799 128 0.000049 0.000058 3.848012e-06
2 POLYGON ((-72.13472 11.28509, -72.13472 11.377... -804 124 0.000272 0.000330 2.195608e-05
1 POLYGON ((-72.13472 11.19293, -72.13472 11.285... -804 123 0.000324 0.000654 4.351886e-05
19 POLYGON ((-71.77539 11.65401, -71.77539 11.746... -800 128 0.000786 0.001441 9.582029e-05
48 POLYGON ((-71.32623 11.74632, -71.32623 11.838... -795 129 0.013314 0.014755 9.812194e-04
37 POLYGON ((-71.5059 11.74632, -71.5059 11.83865... -797 129 0.020141 0.034897 2.320616e-03
0 POLYGON ((-72.22455 11.83865, -72.22455 11.931... -805 130 0.025347 0.060244 4.006171e-03
43 POLYGON ((-71.41607 11.74632, -71.41607 11.838... -796 129 0.026162 0.086406 5.745954e-03
26 POLYGON ((-71.68556 11.83865, -71.68556 11.931... -799 130 0.026525 0.112931 7.509842e-03
47 POLYGON ((-71.41607 12.39331, -71.41607 12.485... -796 136 0.027081 0.140012 9.310705e-03
8 POLYGON ((-72.04489 11.83865, -72.04489 11.931... -803 130 0.043618 0.183630 1.221127e-02
12 POLYGON ((-71.95505 12.02342, -71.95505 12.115... -802 132 0.044158 0.227788 1.514778e-02
9 POLYGON ((-72.04489 12.02342, -72.04489 12.115... -803 132 0.072893 0.300680 1.999509e-02
31 POLYGON ((-71.68556 12.39331, -71.68556 12.485... -799 136 0.107051 0.407731 2.711391e-02
7 POLYGON ((-72.13472 12.2083, -72.13472 12.3007... -804 134 0.108972 0.516703 3.436052e-02
6 POLYGON ((-72.13472 12.11584, -72.13472 12.208... -804 133 0.111997 0.628700 4.180825e-02
28 POLYGON ((-71.68556 12.11584, -71.68556 12.208... -799 133 0.115390 0.744091 4.948165e-02
46 POLYGON ((-71.41607 12.30079, -71.41607 12.393... -796 135 0.124567 0.868658 5.776531e-02
51 POLYGON ((-71.2364 11.83865, -71.2364 11.93102... -794 130 0.136918 1.005576 6.687030e-02
18 POLYGON ((-71.86522 12.30079, -71.86522 12.393... -801 135 0.156713 1.162289 7.729164e-02
20 POLYGON ((-71.77539 12.02342, -71.77539 12.115... -800 132 0.177099 1.339388 8.906865e-02
5 POLYGON ((-72.13472 12.02342, -72.13472 12.115... -804 132 0.189220 1.528609 1.016517e-01
40 POLYGON ((-71.5059 12.2083, -71.5059 12.30079,... -797 134 0.193402 1.722011 1.145129e-01
32 POLYGON ((-71.59573 11.83865, -71.59573 11.931... -798 130 0.198667 1.920678 1.277241e-01
3 POLYGON ((-72.13472 11.83865, -72.13472 11.931... -804 130 0.200753 2.121431 1.410741e-01
27 POLYGON ((-71.68556 11.93102, -71.68556 12.023... -799 131 0.214035 2.335466 1.553073e-01
4 POLYGON ((-72.13472 11.93102, -72.13472 12.023... -804 131 0.221869 2.557336 1.700615e-01
17 POLYGON ((-71.86522 12.2083, -71.86522 12.3007... -801 134 0.230348 2.787684 1.853796e-01
34 POLYGON ((-71.59573 12.2083, -71.59573 12.3007... -798 134 0.258278 3.045962 2.025549e-01
50 POLYGON ((-71.32623 11.93102, -71.32623 12.023... -795 131 0.274259 3.320221 2.207931e-01
11 POLYGON ((-72.04489 12.2083, -72.04489 12.3007... -803 134 0.294374 3.614596 2.403688e-01
21 POLYGON ((-71.77539 12.11584, -71.77539 12.208... -800 133 0.305242 3.919837 2.606672e-01
39 POLYGON ((-71.5059 11.93102, -71.5059 12.02342... -797 131 0.308959 4.228797 2.812129e-01
23 POLYGON ((-71.77539 12.30079, -71.77539 12.393... -800 135 0.348547 4.577344 3.043911e-01
14 POLYGON ((-71.95505 12.2083, -71.95505 12.3007... -802 134 0.358193 4.935537 3.282107e-01
42 POLYGON ((-71.5059 12.39331, -71.5059 12.48587... -797 136 0.358634 5.294171 3.520598e-01
15 POLYGON ((-71.86522 12.02342, -71.86522 12.115... -801 132 0.380588 5.674759 3.773686e-01
29 POLYGON ((-71.68556 12.2083, -71.68556 12.3007... -799 134 0.400309 6.075068 4.039890e-01
44 POLYGON ((-71.41607 11.83865, -71.41607 11.931... -796 130 0.414513 6.489581 4.315539e-01
36 POLYGON ((-71.59573 12.39331, -71.59573 12.485... -798 136 0.430782 6.920363 4.602007e-01
33 POLYGON ((-71.59573 11.93102, -71.59573 12.023... -798 131 0.450032 7.370395 4.901276e-01
52 POLYGON ((-71.2364 11.93102, -71.2364 12.02342... -794 131 0.469495 7.839890 5.213488e-01
16 POLYGON ((-71.86522 12.11584, -71.86522 12.208... -801 133 0.512544 8.352434 5.554327e-01
38 POLYGON ((-71.5059 11.83865, -71.5059 11.93102... -797 130 0.543172 8.895606 5.915533e-01
45 POLYGON ((-71.41607 11.93102, -71.41607 12.023... -796 131 0.571442 9.467047 6.295539e-01
30 POLYGON ((-71.68556 12.30079, -71.68556 12.393... -799 135 0.652381 10.119428 6.729369e-01
13 POLYGON ((-71.95505 12.11584, -71.95505 12.208... -802 133 0.672293 10.791721 7.176441e-01
41 POLYGON ((-71.5059 12.30079, -71.5059 12.39331... -797 135 0.749183 11.540904 7.674643e-01
49 POLYGON ((-71.32623 11.83865, -71.32623 11.931... -795 130 0.819897 12.360802 8.219871e-01
10 POLYGON ((-72.04489 12.11584, -72.04489 12.208... -803 133 0.841081 13.201882 8.779186e-01
22 POLYGON ((-71.77539 12.2083, -71.77539 12.3007... -800 134 0.903159 14.105041 9.379782e-01
35 POLYGON ((-71.59573 12.30079, -71.59573 12.393... -798 135 0.932666 15.037707 1.000000e+00

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 42 cells

AOO Calculation (direct call)

if has_data:
    aoo_count = ecosystem.aoo
    print(f'AOO: {aoo_count} grid cells')
AOO: 42 grid cells
if has_data:
    display(smart_map([aoo_grid_filtered, ecosystem]))
/home/runner/work/rle-ruritania-thomas/rle-ruritania-thomas/.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
T5.2.2 Guajira-Barranquilla xeric scrub 8839 km² 42 cells