Skip to content

Commit

Permalink
Merge pull request #1734 from emilyanndavis/614-decode-crop-names
Browse files Browse the repository at this point in the history
Crop Production: add/update human-readable/translatable crop names
  • Loading branch information
emlys authored Jan 22, 2025
2 parents 4af6cd2 + 31e8c2f commit 13638e1
Show file tree
Hide file tree
Showing 2 changed files with 191 additions and 51 deletions.
223 changes: 181 additions & 42 deletions src/natcap/invest/crop_production_percentile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,187 @@
LOGGER = logging.getLogger(__name__)

CROP_OPTIONS = {
# TODO: use human-readable translatable crop names (#614)
crop: {"description": crop} for crop in [
"abaca", "agave", "alfalfa", "almond", "aniseetc",
"apple", "apricot", "areca", "artichoke", "asparagus",
"avocado", "bambara", "banana", "barley", "bean",
"beetfor", "berrynes", "blueberry", "brazil",
"canaryseed", "carob", "carrot", "carrotfor", "cashew",
"broadbean", "buckwheat", "cabbage", "cabbagefor",
"cashewapple", "cassava", "castor", "cauliflower",
"cerealnes", "cherry", "chestnut", "chickpea",
"chicory", "chilleetc", "cinnamon", "citrusnes",
"clove", "clover", "cocoa", "coconut", "coffee",
"cotton", "cowpea", "cranberry", "cucumberetc",
"currant", "date", "eggplant", "fibrenes", "fig",
"flax", "fonio", "fornes", "fruitnes", "garlic",
"ginger", "gooseberry", "grape", "grapefruitetc",
"grassnes", "greenbean", "greenbroadbean", "greencorn",
"greenonion", "greenpea", "groundnut", "hazelnut",
"hemp", "hempseed", "hop", "jute", "jutelikefiber",
"kapokfiber", "kapokseed", "karite", "kiwi", "kolanut",
"legumenes", "lemonlime", "lentil", "lettuce",
"linseed", "lupin", "maize", "maizefor", "mango",
"mate", "melonetc", "melonseed", "millet",
"mixedgrain", "mixedgrass", "mushroom", "mustard",
"nutmeg", "nutnes", "oats", "oilpalm", "oilseedfor",
"oilseednes", "okra", "olive", "onion", "orange",
"papaya", "pea", "peachetc", "pear", "pepper",
"peppermint", "persimmon", "pigeonpea", "pimento",
"pineapple", "pistachio", "plantain", "plum", "poppy",
"potato", "pulsenes", "pumpkinetc", "pyrethrum",
"quince", "quinoa", "ramie", "rapeseed", "rasberry",
"rice", "rootnes", "rubber", "rye", "ryefor",
"safflower", "sesame", "sisal", "sorghum",
"sorghumfor", "sourcherry, soybean", "spicenes",
"spinach", "stonefruitnes", "strawberry", "stringbean",
"sugarbeet", "sugarcane", "sugarnes", "sunflower",
"swedefor", "sweetpotato", "tangetc", "taro", "tea",
"tobacco", "tomato", "triticale", "tropicalnes",
"tung", "turnipfor", "vanilla", "vegetablenes",
"vegfor", "vetch", "walnut", "watermelon", "wheat",
"yam", "yautia"
]
# Human-readable/translatable crop names come from three sources:
# (1) Monfreda et. al. Table 1
# (2) "EarthStat and FAO crop names and crop groups" table
# (3) FAO's _World Programme for the Census of Agriculture 2020_
# Where (1) and (2) differ, default to (1), except where (2) is
# more descriptive (i.e., include additional list items, alternate
# names, qualifiers, and other disambiguations).
# Where discrepancies remain, consult (3) for additional context.
# See #614 for more details and links to sources.
"abaca": {"description": gettext("Abaca (manila hemp)")},
"agave": {"description": gettext("Agave fibers, other")},
"alfalfa": {"description": gettext("Alfalfa")},
"almond": {"description": gettext("Almonds, with shell")},
"aniseetc": {"description": gettext("Anise, badian, fennel, coriander")},
"apple": {"description": gettext("Apples")},
"apricot": {"description": gettext("Apricots")},
"areca": {"description": gettext("Areca nuts (betel)")},
"artichoke": {"description": gettext("Artichokes")},
"asparagus": {"description": gettext("Asparagus")},
"avocado": {"description": gettext("Avocados")},
"bambara": {"description": gettext("Bambara beans")},
"banana": {"description": gettext("Bananas")},
"barley": {"description": gettext("Barley")},
"bean": {"description": gettext("Beans, dry")},
"beetfor": {"description": gettext("Beets for fodder")},
"berrynes": {"description": gettext("Berries, other")},
"blueberry": {"description": gettext("Blueberries")},
"brazil": {"description": gettext("Brazil nuts, with shell")},
"broadbean": {"description": gettext("Broad beans, horse beans, dry")},
"buckwheat": {"description": gettext("Buckwheat")},
"cabbage": {"description": gettext("Cabbages and other brassicas")},
"cabbagefor": {"description": gettext("Cabbage for fodder")},
"canaryseed": {"description": gettext("Canary seed")},
"carob": {"description": gettext("Carobs")},
"carrot": {"description": gettext("Carrots and turnips")},
"carrotfor": {"description": gettext("Carrots for fodder")},
"cashew": {"description": gettext("Cashew nuts, with shell")},
"cashewapple": {"description": gettext("Cashew apple")},
"cassava": {"description": gettext("Cassava")},
"castor": {"description": gettext("Castor beans")},
"cauliflower": {"description": gettext("Cauliflower and broccoli")},
"cerealnes": {"description": gettext("Cereals, other")},
"cherry": {"description": gettext("Cherries")},
"chestnut": {"description": gettext("Chestnuts")},
"chickpea": {"description": gettext("Chick peas")},
"chicory": {"description": gettext("Chicory roots")},
"chilleetc": {"description": gettext("Chilies and peppers, green")},
"cinnamon": {"description": gettext("Cinnamon (canella)")},
"citrusnes": {"description": gettext("Citrus fruit, other")},
"clove": {"description": gettext("Cloves")},
"clover": {"description": gettext("Clover")},
"cocoa": {"description": gettext("Cocoa beans")},
"coconut": {"description": gettext("Coconuts")},
"coffee": {"description": gettext("Coffee, green")},
"cotton": {"description": gettext("Cotton")},
"cowpea": {"description": gettext("Cow peas, dry")},
"cranberry": {"description": gettext("Cranberries")},
"cucumberetc": {"description": gettext("Cucumbers and gherkins")},
"currant": {"description": gettext("Currants")},
"date": {"description": gettext("Dates")},
"eggplant": {"description": gettext("Eggplants (aubergines)")},
"fibrenes": {"description": gettext("Fiber crops, other")},
"fig": {"description": gettext("Figs")},
"flax": {"description": gettext("Flax fiber and tow")},
"fonio": {"description": gettext("Fonio")},
"fornes": {"description": gettext("Forage products, other")},
"fruitnes": {"description": gettext("Fresh fruit, other")},
"garlic": {"description": gettext("Garlic")},
"ginger": {"description": gettext("Ginger")},
"gooseberry": {"description": gettext("Gooseberries")},
"grape": {"description": gettext("Grapes")},
"grapefruitetc": {"description": gettext("Grapefruit and pomelos")},
"grassnes": {"description": gettext("Grasses, other")},
"greenbean": {"description": gettext("Beans, green")},
"greenbroadbean": {"description": gettext("Broad beans, green")},
"greencorn": {"description": gettext("Green corn (maize)")},
"greenonion": {"description": gettext("Onions and shallots, green")},
"greenpea": {"description": gettext("Peas, green")},
"groundnut": {"description": gettext("Groundnuts, with shell")},
"hazelnut": {"description": gettext("Hazelnuts (filberts), with shell")},
"hemp": {"description": gettext("Hemp fiber and tow")},
"hempseed": {"description": gettext("Hempseed")},
"hop": {"description": gettext("Hops")},
"jute": {"description": gettext("Jute")},
"jutelikefiber": {"description": gettext("Jute-like fibers")},
"kapokfiber": {"description": gettext("Kapok fiber")},
"kapokseed": {"description": gettext("Kapok seed in shell")},
"karite": {"description": gettext("Karite nuts (shea nuts)")},
"kiwi": {"description": gettext("Kiwi fruit")},
"kolanut": {"description": gettext("Kola nuts")},
"legumenes": {"description": gettext("Legumes, other")},
"lemonlime": {"description": gettext("Lemons and limes")},
"lentil": {"description": gettext("Lentils")},
"lettuce": {"description": gettext("Lettuce and chicory")},
"linseed": {"description": gettext("Linseed")},
"lupin": {"description": gettext("Lupins")},
"maize": {"description": gettext("Maize")},
"maizefor": {"description": gettext("Maize for forage and silage")},
"mango": {"description": gettext("Mangoes, mangosteens, guavas")},
"mate": {"description": gettext("Mate")},
"melonetc": {"description": gettext("Cantaloupes and other melons")},
"melonseed": {"description": gettext("Melon seed")},
"millet": {"description": gettext("Millet")},
"mixedgrain": {"description": gettext("Mixed grain")},
"mixedgrass": {"description": gettext("Mixed grasses and legumes")},
"mushroom": {"description": gettext("Mushrooms and truffles")},
"mustard": {"description": gettext("Mustard seed")},
"nutmeg": {"description": gettext("Nutmeg, mace, and cardamoms")},
"nutnes": {"description": gettext("Nuts, other")},
"oats": {"description": gettext("Oats")},
"oilpalm": {"description": gettext("Oil palm fruit")},
"oilseedfor": {"description": gettext("Green oilseeds for fodder")},
"oilseednes": {"description": gettext("Oilseeds, other")},
"okra": {"description": gettext("Okra")},
"olive": {"description": gettext("Olives")},
"onion": {"description": gettext("Onions, dry")},
"orange": {"description": gettext("Oranges")},
"papaya": {"description": gettext("Papayas")},
"pea": {"description": gettext("Peas, dry")},
"peachetc": {"description": gettext("Peaches and nectarines")},
"pear": {"description": gettext("Pears")},
"pepper": {"description": gettext("Pepper (Piper spp.)")},
"peppermint": {"description": gettext("Peppermint")},
"persimmon": {"description": gettext("Persimmons")},
"pigeonpea": {"description": gettext("Pigeon peas")},
"pimento": {"description": gettext("Chilies and peppers, dry")},
"pineapple": {"description": gettext("Pineapples")},
"pistachio": {"description": gettext("Pistachios")},
"plantain": {"description": gettext("Plantains")},
"plum": {"description": gettext("Plums and sloes")},
"poppy": {"description": gettext("Poppy seed")},
"potato": {"description": gettext("Potatoes")},
"pulsenes": {"description": gettext("Pulses, other")},
"pumpkinetc": {"description": gettext("Pumpkins, squash, gourds")},
"pyrethrum": {"description": gettext("Pyrethrum, dried flowers")},
"quince": {"description": gettext("Quinces")},
"quinoa": {"description": gettext("Quinoa")},
"ramie": {"description": gettext("Ramie")},
"rapeseed": {"description": gettext("Rapeseed")},
"rasberry": {"description": gettext("Raspberries")},
"rice": {"description": gettext("Rice")},
"rootnes": {"description": gettext("Roots and tubers, other")},
"rubber": {"description": gettext("Natural rubber")},
"rye": {"description": gettext("Rye")},
"ryefor": {"description": gettext("Rye grass for forage and silage")},
"safflower": {"description": gettext("Safflower seed")},
"sesame": {"description": gettext("Sesame seed")},
"sisal": {"description": gettext("Sisal")},
"sorghum": {"description": gettext("Sorghum")},
"sorghumfor": {"description": gettext("Sorghum for forage and silage")},
"sourcherry": {"description": gettext("Sour cherries")},
"soybean": {"description": gettext("Soybeans")},
"spicenes": {"description": gettext("Spices, other")},
"spinach": {"description": gettext("Spinach")},
"stonefruitnes": {"description": gettext("Stone fruit, other")},
"strawberry": {"description": gettext("Strawberries")},
"stringbean": {"description": gettext("String beans")},
"sugarbeet": {"description": gettext("Sugar beets")},
"sugarcane": {"description": gettext("Sugar cane")},
"sugarnes": {"description": gettext("Sugar crops, other")},
"sunflower": {"description": gettext("Sunflower seed")},
"swedefor": {"description": gettext("Swedes for fodder")},
"sweetpotato": {"description": gettext("Sweet potatoes")},
"tangetc": {"description": gettext("Tangerines, mandarins, clementines")},
"taro": {"description": gettext("Taro")},
"tea": {"description": gettext("Tea")},
"tobacco": {"description": gettext("Tobacco leaves")},
"tomato": {"description": gettext("Tomatoes")},
"triticale": {"description": gettext("Triticale")},
"tropicalnes": {"description": gettext("Fresh tropical fruit, other")},
"tung": {"description": gettext("Tung nuts")},
"turnipfor": {"description": gettext("Turnips for fodder")},
"vanilla": {"description": gettext("Vanilla")},
"vegetablenes": {"description": gettext("Fresh vegetables, other")},
"vegfor": {"description": gettext("Vegetables and roots for fodder")},
"vetch": {"description": gettext("Vetches")},
"walnut": {"description": gettext("Walnuts, with shell")},
"watermelon": {"description": gettext("Watermelons")},
"wheat": {"description": gettext("Wheat")},
"yam": {"description": gettext("Yams")},
"yautia": {"description": gettext("Yautia")},
}

nutrient_units = {
Expand Down
19 changes: 10 additions & 9 deletions src/natcap/invest/crop_production_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
LOGGER = logging.getLogger(__name__)

CROPS = {
"barley": {"description": gettext("barley")},
"maize": {"description": gettext("maize")},
"oilpalm": {"description": gettext("oil palm")},
"potato": {"description": gettext("potato")},
"rice": {"description": gettext("rice")},
"soybean": {"description": gettext("soybean")},
"sugarbeet": {"description": gettext("sugar beet")},
"sugarcane": {"description": gettext("sugarcane")},
"wheat": {"description": gettext("wheat")}
"barley": {"description": gettext("Barley")},
"maize": {"description": gettext("Maize")},
"oilpalm": {"description": gettext("Oil palm fruit")},
"potato": {"description": gettext("Potatoes")},
"rice": {"description": gettext("Rice")},
"soybean": {"description": gettext("Soybeans")},
"sugarbeet": {"description": gettext("Sugar beets")},
"sugarcane": {"description": gettext("Sugar cane")},
"sunflower": {"description": gettext("Sunflower seed")},
"wheat": {"description": gettext("Wheat")}
}

NUTRIENTS = [
Expand Down

0 comments on commit 13638e1

Please sign in to comment.