Skip to content

feat: compute emissions factors for JD proxy allocation - #29

Merged
jeffseif merged 7 commits into
jeffseif/livestock-and-taxonomy-into-tracefrom
jeffseif/jdp-trace
Nov 6, 2026
Merged

jeffseif merged 7 commits into
jeffseif/livestock-and-taxonomy-into-tracefrom
jeffseif/jdp-trace

Conversation

@jeffseif

@jeffseif jeffseif commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Background

This stacks on #28

This implements trace for JDP, including pulling national crop production data from FAOSTAT, updating our FAOSTAT ingest to cover all crops instead of just the allowlist for MAPSPAM, populating the CROPGRIDS <-> FAOSTAT taxonomy crosswalk, and dropping a bunch of hardcoded mappings which we can now parse directly from FAOSTAT.

The changes

  1. 5f7d9d1 expand FAOSTAT crop production's ingest to cover all crops, allowing us to drop the allowlist from the faostat module
  2. e914a6c add the CROPGRIDS <-> FAOSTAT crosswork to taxonomy module covering names only for the items which don't appear in FAOSTAT
  3. 03e41e0 drop a bunch of redundant mappings of commodity name to id in favor of reading that from FOASTAT
  4. b5f877c compute livestock heads in JDP attribute, and crop+livestock production in JDP trace
  5. 557cff1, a94f621, and 0640cd3 docs and touchups

Notes

  1. We crosswalk CROPGRIDS/FAOSTAT differently than Orbae in some places. Those are highlighted in comments below.
  2. We average production over a three year window centered on the assessment year (Orbae uses four)
  3. national production is scaled to sub-national jurisdictions by production area

Manual testing

  • I reran trace for S and observed matching results (within floating epsilon)
  • I ran trace for JDP and verified that national productions matched with FAOSTAT
  • Comparing S and JDP numbers against each other, and it shows that allocation factors for the smaller-crop-area crops have much less emissions allocated to them. Definitely worth digging into once we have a global refresh

@jeffseif
jeffseif added this pull request to stack #30 November 6, 2026 19:26
Comment thread jdluc/taxonomy.py
Comment on lines +152 to +153
# The publisher's crop table (`CROPS_matching_v17.xlsx` in figshare's `CODES.zip`), through
# the authors' 2020 FAOSTAT extract. Both kapok crops are 310, kapok fruit

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

these are provided by the publisher

Comment thread jdluc/taxonomy.py
Comment on lines +306 to +309
# FAOSTAT's own items, where the publisher's table names none or a retired one
tang_cropgrids.Crop.FLAX.name: 771, # replaced 773, flax fibre and tow
tang_cropgrids.Crop.GREENBROADBEAN.name: 420,
tang_cropgrids.Crop.JUTELIKEFIBER.name: 782, # formerly jute-like fibres

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

these probably should have been provided by the publisher

Comment thread jdluc/taxonomy.py
Comment on lines +310 to +312
# Judgement: FAOSTAT's dry chillies and peppers names Pimenta, and popcorn is maize grain
tang_cropgrids.Crop.PIMENTO.name: 689,
tang_cropgrids.Crop.POPCORN.name: 56,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

these are judgement calls which are up for discussion!

Comment thread jdluc/taxonomy.py
Comment on lines +313 to +329
# Fodder, which FAOSTAT has no item for
tang_cropgrids.Crop.ALFALFA.name: InventedCommodityId.ALFALFA,
tang_cropgrids.Crop.BEETFOR.name: InventedCommodityId.BEETS_FOR_FODDER,
tang_cropgrids.Crop.CABBAGEFOR.name: InventedCommodityId.CABBAGE_FOR_FODDER,
tang_cropgrids.Crop.CARROTFOR.name: InventedCommodityId.CARROTS_FOR_FODDER,
tang_cropgrids.Crop.CLOVER.name: InventedCommodityId.CLOVER,
tang_cropgrids.Crop.FORNES.name: InventedCommodityId.FORAGE_PRODUCTS_OTHER,
tang_cropgrids.Crop.GRASSNES.name: InventedCommodityId.GRASSES_OTHER,
tang_cropgrids.Crop.LEGUMENES.name: InventedCommodityId.LEGUMES_OTHER,
tang_cropgrids.Crop.MAIZEFOR.name: InventedCommodityId.MAIZE_FOR_FORAGE_AND_SILAGE,
tang_cropgrids.Crop.MIXEDGRASS.name: InventedCommodityId.MIXED_GRASSES_AND_LEGUMES,
tang_cropgrids.Crop.OILSEEDFOR.name: InventedCommodityId.GREEN_OILSEEDS_FOR_FODDER,
tang_cropgrids.Crop.RYEFOR.name: InventedCommodityId.RYE_GRASS_FOR_FORAGE_AND_SILAGE,
tang_cropgrids.Crop.SORGHUMFOR.name: InventedCommodityId.SORGHUM_FOR_FORAGE_AND_SILAGE,
tang_cropgrids.Crop.SWEDEFOR.name: InventedCommodityId.SWEDES_FOR_FODDER,
tang_cropgrids.Crop.TURNIPFOR.name: InventedCommodityId.TURNIPS_FOR_FODDER,
tang_cropgrids.Crop.VEGETABLENES.name: InventedCommodityId.VEGETABLES_AND_ROOTS_FOR_FODDER,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we decided to leave all of the fodder crops separate, with their own invented FAOSTAT item codes (negative to not collide with real ones).

alternatively, these could be combined into a single fodder crop item or combined into their "for humans" crops.

@jeffseif jeffseif changed the title Jeffseif/jdp trace feat: compute emissions factors for JD proxy allocation Nov 6, 2026

@blallen blallen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

did a peer program, looks good

@jeffseif
jeffseif merged commit 0c50444 into main Nov 6, 2026
4 checks passed
@jeffseif
jeffseif deleted the jeffseif/jdp-trace branch November 6, 2026 22:09
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.

2 participants