feat: ingest gpw livestock dataset - #3
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
We now ingest
GPW_LIVESTOCKwhich is a ~100m raster for the head-per-area density of buffalo, cattle, goat, horse, and sheep globally.This is step one towards being able to attribute LUC emissions to livestock commodities, like beef. Step two will be extending the FAOSTAT production dataset to ingest livestock production (today it only covers crops). And step three will be bringing these into the statistical attribution model.
Unrelated commits
CC BY 4.0has been inconsistent -- so I adopted the version on their website.intthroughout.Notes
EPSG:4326during ingestion so that harmonize can remain a simple resample (not a reprojection)ESRI:54052at ~1km resolution, so in order for this data to land in a non-lossy way inEPSG:4326we had to add a new grid whose resolution is no coarser (at ~900m). We also took the opportunity to use a grid which tiles into MAPSPAM 10:1.nan's by default, we need to map them to0, filling the entire destination pixels with data. Otherwise the operation would be biased high within pixels which straddle data/nodata like the coast.head/km²tohead/hato align with the other intensive datasets we ingest.CATTLE/2020. Presumably this was an error aggregating over the source's nodata values of-32_000:int16. As a result, we clip the data withmin=0.Three non-physical pixels
gcloud storage ls gs://cornerstone-ingest-us-central1/raster/gpw/livestock/v0/ten-degree-tile/ | wc -l 280gdalinfo
Manual inspection
Here is the 2020 GPW grassland (
= 1; cultivated rangeland) mask and the GPW cattle density in Mato Grosso, Brazil (10S_060W):And here is a zoomed in view showing the different overlaps and resolutions:
(vibecoded) comparison with FAOSTAT national totals
Claude code wrote this script for me:
Spot check GPW vs FAOSTAT national totals
Output for ARG and BRA
CATTLEhas a >97% ratio;SHEEP>90%;GOAT>70%;HORSE~90% forARGbut 50-60% forBRA; andBUFFALOis absent fromARGentirely.