Skip to content

GloCAB, ECAAS Kenya and Zambia; India, Rwanda and South Africa fixes - #351

Merged
m-mohr merged 6 commits into
mainfrom
issue-32-research-datasets
Nov 7, 2026
Merged

m-mohr merged 6 commits into
mainfrom
issue-32-research-datasets

Conversation

@hannah-rae

Copy link
Copy Markdown
Contributor

Converters for the research datasets of fieldsoftheworld/harmonized-field-data-catalog#32, and fixes to the existing ones that catalog will publish.

Depends on fiboa/fiboa.github.io#37. za_fusion, ke_ecaas and zm_ecaas read crop tables that PR adds. Merge it first.

New converters

glocab

The University of Maryland's 190,832 hand-digitised GloCAB boundaries, covering 22 regions in Brazil, Canada, Russia, Ukraine and the USA.

  • There is one edition per year of the readme's mapping dates (2016–2020). Every edition reads the same Zenodo archive.
  • Each field carries its region's mapping month as determination:datetime.
  • no_area marks polygons that enclose several fields too small to identify.
  • CropType is kept as predominant_crop. It is the region's predominant crop, the same for every field in a region, so it is not presented as crop:name.

ke_ecaas, zm_ecaas

Crop-cut farm polygons from Pula's Bird's-Eye project (ECAAS): 1,349 plots in Kenya and 2,711 in Zambia.

  • The source is Pula's own public Google Drive folder, linked from the project documentation. It downloads without a login.
  • Every attribute is kept: crop, planting and harvest dates, season, crop condition, intercropping and the intercrop, harvested weight (kg) and yield (t/ha).
  • The source's original crop names stay in crop:name next to HCAT. A downstream language model will be trained on them.
  • Kenya mixes ISO and month/day/year dates; both are parsed and tested.

Changes

  • za_fusion: maps its five classes to HCAT with a crop:code_list. Before this, its output did not validate (crop:code_list missing).
  • india_10k:
    • The determination date is now October 2020, the month of the SPOT images (Wang, Waldner & Lobell 2022). The old date was the Zenodo release date.
    • It reads the shapefile parts instead of the record archive. That archive endpoint failed, and it bundles 256 MB of model weights.
    • Its id is now india_10k, matching the module name (it was in_10k).
  • rw_rwanda: reads the openly published polygons on Source Cooperative instead of requiring -i.
  • ai4sf: determination:method is now manual; the paper says the fields were digitised by hand.
  • Licence test: compares SPDX ids case-insensitively, so GPL-2.0-or-later passes.

Checks

  • Every converter was run against its real source and validates.
  • The ML split counts match the published ftw/*-ml files: India 6,495/1,510/2,008 and Rwanda 1,223/309.
  • The full suite passes, 247 tests.
  • The code was reviewed independently.

🤖 Generated with Claude Code

@m-mohr
m-mohr requested review from ivorbosloper and m-mohr and a lite review from Copilot November 5, 2026 22:33
@m-mohr

m-mohr commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Woops, this was meant to approve fiboa/fiboa.github.io#37 - I haven't looked at this PR yet.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Changes are required because the conversion test omits several promised mapped fields, allowing schema or column regressions to pass undetected.

1 open issue
What changed in this PR

Adds new GloCAB and ECAAS research dataset converters while updating existing India, Rwanda, South Africa Fusion, and AI4SF converters for catalog publication and validation.

Changes:

  • Added GloCAB yearly variants and Kenya/Zambia ECAAS converters with source attributes, HCAT mappings, dates, and fixtures.
  • Updated India 10K source handling and metadata, Rwanda’s public source, AI4SF determination method, and South Africa Fusion HCAT support.
  • Expanded conversion tests, research-value checks, SPDX license validation, and changelog entries.
File Description
tests/​test_research_values.py Updated as part of this pull request.
tests/​test_converters.py Updated as part of this pull request.
tests/​test_convert.py Updated as part of this pull request.
tests/​data-files/​convert/​zm_ecaas/​ecaas_zambia_geojson.geojson Updated as part of this pull request.
tests/​data-files/​convert/​zm_ecaas/​crop.csv Updated as part of this pull request.
tests/​data-files/​convert/​za_fusion/​crop.csv Updated as part of this pull request.
tests/​data-files/​convert/​ke_ecaas/​ecaas_geojson_kenya.geojson Updated as part of this pull request.
tests/​data-files/​convert/​ke_ecaas/​crop.csv Updated as part of this pull request.
tests/​data-files/​convert/​india_10k/​india_10k_fields.prj Updated as part of this pull request.
tests/​data-files/​convert/​india_10k/​india_10k_fields.cpg Updated as part of this pull request.
fiboa_cli/​datasets/​zm_ecaas.py Updated as part of this pull request.
fiboa_cli/​datasets/​za_fusion.py Updated as part of this pull request.
fiboa_cli/​datasets/​rw_rwanda.py Updated as part of this pull request.
fiboa_cli/​datasets/​ke_ecaas.py Updated as part of this pull request.
fiboa_cli/​datasets/​india_10k.py Updated as part of this pull request.
fiboa_cli/​datasets/​glocab.py Updated as part of this pull request.
fiboa_cli/​datasets/​commons/​ecaas.py Updated as part of this pull request.
fiboa_cli/​datasets/​ai4sf.py Updated as part of this pull request.
CHANGELOG.md Updated as part of this pull request.

Review effort: Lite

Comment thread tests/test_convert.py Resolved

@ivorbosloper ivorbosloper left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very well, tested and with a fix

@m-mohr

m-mohr commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Thanks, looks good! Two of the overrides work around vecorel-cli gaps, which I've fixed in vecorel/cli#66:

  • GeoJSON features without a top-level id no longer crash, so ECAAS can map "Case_ID": "id" in columns and drop _normalize_geojson_properties.
  • Shapefile parts listed one by one in sources are read through their .shp, so the download_files override in india_10k can go.

I'm working to get vecorel-cli updated so that we can simplify this PR.

One question on GloCAB: it's one dataset, but the converter splits it into five yearly editions by mapping date. Since every field already carries its region's mapping month in determination:datetime, does the catalog need that split? Otherwise a single converter without variants would be simpler and give one complete file (the 2016 edition is just Ukraine_D).

Minor: Area_km2 could become metrics:area (after unit conversion).

@hannah-rae

Copy link
Copy Markdown
Contributor Author

Thanks @m-mohr!

  • Allow GeoJSON features without id and shapefile parts as sources vecorel/cli#66: great. If a release with it is only days away we can wait. Otherwise, could we merge this as is and drop _normalize_geojson_properties and the india_10k download_files override in a follow-up once the pin is bumped? Publishing these eight datasets in the harmonized catalog is waiting on this PR, and I'm happy to do the follow-up.
  • GloCAB: agreed. a1562d2 drops the yearly variants: one file with all 190,832 fields, each with its region's mapping month as determination:datetime, so a single year can still be selected by date.
  • Area_km2: I tried mapping it, but the source values are wrong in two regions. In USA_C every value is about 2.19× the polygon's equal-area size (it looks like a Web Mercator measurement), and 187 Ukraine_D values disagree with their polygons. Everywhere else it matches the geometry within 0.3%. So metrics:area stays measured from the geometry, and there's a comment in the converter saying why.

One vecorel-cli thing turned up while rebuilding: GeoParquet.write builds the column list with list(set(properties) & set(data.columns)), so each output's column order depends on Python's hash seed. One GloCAB build put the timestamp column first, and GDAL 3.13's Parquet reader then garbled a few features' strings (empty ids, invalid UTF-8) when we tiled the file. We worked around it in the catalog, but a stable order (for example, the order of the column mapping) would prevent it for everyone reading these files with GDAL. Should I open an issue or PR on vecorel/cli?

@m-mohr

m-mohr commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Thanks @hannah-rae! a1562d2 looks good, and keeping Area_km2 alone makes sense given those errors.

I'll release vecorel-cli in the next few days, with #66 and a stable column order (columns will keep the order of the column mapping; the same set-based pattern is also in merge and ops). Once it's out, let's bump the pin here, drop _normalize_geojson_properties and the india_10k download_files override, and then merge.

@m-mohr m-mohr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hannah-rae I noticed one more thing: Could we keep the India converter's id as in_10k? Converter ids concistently use the ISO country code as prefix, and the id becomes the collection id of already published data. What's the reason for renaming it?

hannah-rae and others added 4 commits November 7, 2026 02:19
…uth Africa converters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@m-mohr
m-mohr force-pushed the issue-32-research-datasets branch from a1562d2 to 7defa27 Compare November 7, 2026 01:32
@m-mohr

m-mohr commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

vecorel-cli 0.4.3 is released and fiboa-cli main uses it now. I rebased this branch onto main and pushed 7defa27, which drops the two workarounds: ECAAS maps "Case_ID": "id" instead of overriding _normalize_geojson_properties, and india_10k no longer needs its download_files override. Please reset your local branch before pushing again (git fetch && git reset --hard origin/issue-32-research-datasets).

The only open point is the India converter's id: could we keep it as in_10k? Then this is ready to merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hannah-rae

Copy link
Copy Markdown
Contributor Author

Agreed, reverted to in_10k in 0bf1cae.

@m-mohr
m-mohr merged commit 686c989 into main Nov 7, 2026
7 checks passed
@m-mohr
m-mohr deleted the issue-32-research-datasets branch November 7, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants