Skip to content

emit: Crop-Independent Emissions bands, on the undiscounted, assessment-year emit - #21

Closed
danohu wants to merge 0 commit into
cornerstone-data:mainfrom
AdAstraEco:emit-cie-upstream
Closed

danohu wants to merge 0 commit into
cornerstone-data:mainfrom
AdAstraEco:emit-cie-upstream

Conversation

@danohu

@danohu danohu commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Reworked onto current main and no longer stacked on #20. It is now one commit on main, building on #31 (undiscounted emit, discount moved into the allocation legs) and #32/#34 (assessment_year). The previous version of this PR, with its span-band derivation, is superseded.

Summary

emit now writes six cie- (Crop-Independent Emissions) bands beside its output. They describe the same conversions and carbon pools for the same assessment year, but stop before anything that depends on what the land became:

  • No destination gate. A pixel is charged once it loses a source class (forest, natural grassland, pasture) inside the lookback, whether or not a destination dataset claims it.
  • No destination-specific factor. Mineral soil is the full stock at risk, with no cropland loss fraction, and peat transformation is kept apart from it.
  • Peat occupation as a potential on all peat, whatever occupies it.

Like main's bands, they are undiscounted: each allocation leg discounts by conversion-year.

Relation to main

#31 already made emit undiscounted and moved the discount downstream, which was part of what CIE argued for. So CIE now builds on main's bands rather than duplicating them:

  • The cie- set carries only what main's bands don't. The year, the destination evidence and the pixel area are read from the existing conversion-year, destination-dataset and hectares-per-pixel (emit.SHARED_BANDS) instead of being copied.
  • The bands follow assessment_year exactly as main's do, through get_conversion_record (lookback window, conversion year, destination maps).
  • emit.derive_from_cie rebuilds conversion, vegetation-emissions, soil-emissions, both *-peatland-occupation bands and dropped-emissions from the cie- bands plus destination-dataset. Nothing is discounted in emit or in derive_from_cie.

Additive only. main's bands are unchanged, and so is every consumer.

Changes since the previous version

  • Six bands instead of nine: the plain copies cie-conversion-year, cie-destination-dataset and cie-hectares-per-pixel are dropped.
  • No span bands, span helpers or discounted total to rebuild.
  • The "assessment year fixed at 2020" caveat is gone.
  • The source comes from a new get_conversion_source, so ConversionRecord and main's emit tests are unchanged.
  • No longer stacked on export: write a step's per-tile output as a COG or a zarr #20.

Changes

  • jdluc/emit.py:
    • ConversionSource, get_conversion_source and get_crop_independent_emissions.
    • get_cropland_soil_loss_fraction and derive_from_cie.
    • workflow delegates to get_output_dset(assessment_year, dset), so the whole output can be tested on synthetic data.
    • CIE_BANDS and SHARED_BANDS.
    • Cache version 0 → 6: forks of this repo have already written 1–5.
  • docs/crop_independent_emissions.md: main's bands and CIE side by side, how each derives from CIE, the per-year discount and the assessment year.
  • docs/data.md: the cie- bands in the emit schema.
  • jdluc/__tests__/emit_test.py: test_cie_*, the source following the assessment year, and the derivation test for each assessment year.
  • tools/compare-emit-layers.py: checks the identities on a real tile (with --assessment-year), and totals carbon by source and by whether a conversion fired.

Cost

Each emit tile goes from 9 bands to 15.

Testing

  • uv run pytest: 1926 passed; main's emit tests unchanged.
  • uv run pre-commit run --all-files: passes.
  • On the synthetic every-case grid, every derived band matches emit to float32 rounding.
  • Pending: a real-tile run of tools/compare-emit-layers.py.

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.

1 participant