Skip to content

Update livestock sector implementation to use headcounts dataset#183

Open
aethr wants to merge 13 commits into
mainfrom
182/livestock-headcounts
Open

Update livestock sector implementation to use headcounts dataset#183
aethr wants to merge 13 commits into
mainfrom
182/livestock-headcounts

Conversation

@aethr

@aethr aethr commented May 6, 2026

Copy link
Copy Markdown
Contributor

Description

Resolves #182.

Integrates the refreshed CSIRO livestock headcount dataset, and calculates CH4 emissions per animal based on static annual emission estimates. Previously this sector was only concerned with enteric fermentation, but since the two main sources of emissions from cattle and sheep are enteric fermentation and manure, this PR also moves manure management emissions into the livestock layer, and out of the agriculture layer, for cattle and sheep.

Checklist

Please confirm that this pull request has done the following:

  • Tests added
  • Documentation added (where applicable)
  • Changelog item added to changelog/

Notes

Even after introducing a completely new data source and methodology, the livestock emissions haven't significantly changed, as evidenced by the minimal changes to the livestock layer in test_om_prior.py. However, since we're now spatialising the inventory total directly, we're seeing 0.0% discrepancy in the livestock layer when running the prior over the full domain:

verification:PASSED - livestock emissions OK, discrepancy is 0.0% of total

Previously, this sector was failing with between 0.3 - 0.8% discrepancy depending on the period of interest.

It's worth noting, the livestock headcounts dataset includes beef and dairy cows and sheep, but does not include swine or other livestock. Based on this we've moved the UNFCCC categories for enteric fermentation from swine and other livestock into the agriculture sector, which is spatialised by land use. This causes a small increase in the agriculture emissions because their combined sector total will be increased by this inclusion.

ALUM codes

Now that the livestock layer accounts for all emissions from cattle and sheep, the ALUM categories included in the agriculture sector have been updated to remove:

  • 2.1.0 Grazing native vegetation
  • 3.2.0 Grazing modified pastures
  • 4.2.0 Grazing irrigated modified pastures
  • 5.2.1 Dairy sheds and yards
  • 5.2.2 Feedlots

The visibility of these sector/category relationships was previously hard to find (located in landuse-sector-map.csv data file), so ALUM codes for the agriculture sector have been moved into the sector implementation in sector.py. For consistency, the same change has been made to the LULUCF sector, and the landuse-sector-map.csv data source has been removed from the project.

@aethr aethr self-assigned this May 6, 2026
aethr added a commit that referenced this pull request May 6, 2026
@aethr aethr requested a review from prayner May 7, 2026 03:42
@aethr

aethr commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

Still need to update documentation once we have a bit more information about the new data source, but the implementation is ready to review.

aethr added a commit that referenced this pull request May 27, 2026
@aethr aethr force-pushed the 182/livestock-headcounts branch from 8734db3 to f2e84d6 Compare May 27, 2026 01:27
@aethr aethr changed the base branch from main to anga-unfccc-codes May 27, 2026 01:27
@aethr aethr force-pushed the anga-unfccc-codes branch 2 times, most recently from 00bddcd to c9203f5 Compare May 27, 2026 23:59
Base automatically changed from anga-unfccc-codes to main May 28, 2026 00:12
aethr added a commit that referenced this pull request May 28, 2026
@aethr aethr force-pushed the 182/livestock-headcounts branch from f2e84d6 to 0777108 Compare May 28, 2026 00:17
aethr added a commit that referenced this pull request May 28, 2026
@aethr aethr force-pushed the 182/livestock-headcounts branch from 0777108 to bf88760 Compare May 28, 2026 00:59
@aethr

aethr commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

A basic analysis on the agriculture layer shows that with the current list of ALUM codes, which includes grazing, dairy and feedlots, we are matching 61234374 pixels in the NLUM land use map. If we remove grazing, dairy and feedlots ALUM codes, we match 153560 pixels (0.25%). It does seem like this might be a worthwhile change if we decide to spatialise 3.B Manure Management along with Enteric Fermentation in the livestock layer.

aethr added 8 commits June 1, 2026 08:31
Iterating over rows in the livestock DataFrame isn't necessary once we've calculated the grid cell indexes. The emissions can be distributed to grid cells directly using `np.add.at((indices), values)`.
Since we have per-animal headcounts, and the enteric fermentation inventory sector can be broken down by animal, we can scale the emissions independently for each animal based on where the animals are.

It's worth noting, the livestock headcounts dataset includes beef and dairy cows and sheep, but does not include swine or other livestock. Based on this we've moved the UNFCCC categories for enteric fermentation from swine and other livestock into the agriculture sector, which is spatialised by land use. This causes a small increase in the agriculture emissions because their combined sector total will be increased by this inclusion.
@aethr aethr force-pushed the 182/livestock-headcounts branch from bf88760 to 4a55bd2 Compare May 31, 2026 22:31
aethr added 3 commits June 5, 2026 16:32
This removes the landuse-sector-map.csv file where prior sectors are associated with ALUM codes, which is how the NLUM Land Use GeoTIFF designates land use of each pixel. The landuse-sector-map.csv was already tightly coupled to the sector implementation, because one of the columns was the sector name.

With this change we lose the ability to update which ALUM codes fall into each sector without updating the implementation. However, like UNFCCC and ANZSIC codes, the sector implementation is intimately bound to the types of activities and emissions it represents. It doesn't make sense to change the ALUM mapping for a sector without changing the implementation.

This also makes the ALUM mapping more visible, so that if the implementation does change (for example, the recent change to include swine and other livestock in the agriculture sector), it forces the person making the change to evaluate whether the mapped ALUM codes are still accurate.
Emissions from manure management are likely to occur where livestock are, so spatialise manure management alongside enteric fermentation according to livestock headcount locations.
Emissions from manure management are likely to occur where livestock are, so spatialise manure management alongside enteric fermentation according to livestock headcount locations. This also means removing some ALUM codes from the agriculture layer which are primarily related to beef and sheep management.
@aethr aethr force-pushed the 182/livestock-headcounts branch from acbf74a to 0de8384 Compare June 8, 2026 23:21
@aethr aethr mentioned this pull request Jun 8, 2026
3 tasks
@prayner

prayner commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

livestock/sector.py:123: only a comment but you mean /m2 not /m3

@aethr

aethr commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

livestock/sector.py:123: only a comment but you mean /m2 not /m3

Good catch! Will fix.

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.

Update livestock layer based on refreshed cattle headcounts dataset

2 participants