Repository navigation
chore: move STATISTICAL livestock production into attribute, anchor to FAOSTAT ids - #28
Merged
Merged
Conversation
… (like JD) Instead of production, pass heads from attribute to trace
…- but don't use it just yet
Use commodity taxonomies in trace Change trace's pkey from `commodity_name: str` to `commodity_id: int`
jeffseif
commented
Nov 6, 2026
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
This is mainly a refactor to get the
SandJDattributions lined up to a common approach before we implement trace forJDP. This was originally going to be one big 'ol branch but this preparation work became larger.The changes
Slivestock production from attribute to trace. The design was to have attribute only allocate emissions and for trace to join those onto productions and rollup over jurisdictions. When we implemented livestock, it was convenient to do all of livestock's production within attribute since that depended on both map data (GPW's head raster) and tabular data (FAOSTAT's livestock patterns). We wanted to avoid passing head counts over time as new columns in attribute, causingJDandSattribute schemas to drift apart ... but today we decided to swap that tradeoff.JD's mapping from USDA/NASS/CDL crops to FAOSTAT commodities, including three negative custom ones forDROPPED,UNATTRIBUTED, andPASTUREwhich understandably don't have items in FAOSTAT. So far this isn't usedS(including custom negative ids forOTHER_OILCROPSandOTHER_PULSES) and then plug the new taxonomy mappings into trace. This also changes the schema for trace so that the pkey switches fromcommodity_name: strtocommodity_id: int, causing the former to become a fact column with the FAOSTAT name. Also ensure the tools are brought alongManual testing
traceforHNDand verified its schema and new FAOSTAT values