{"id":192394,"name":"ALLFED Integrated Food System Model","description":"An integrated food supply model for resilient foods in nuclear winter.","url":"https://github.com/allfed/allfed-integrated-model","last_synced_at":"2026-04-07T17:00:38.865Z","repository":{"id":39855028,"uuid":"380878388","full_name":"allfed/allfed-integrated-model","owner":"allfed","description":"Integrated model to calculate the effects of resilient foods in catastrophic events","archived":false,"fork":false,"pushed_at":"2025-05-20T09:53:37.000Z","size":160006,"stargazers_count":11,"open_issues_count":49,"forks_count":11,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-03-29T13:57:51.718Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://allfed.github.io/allfed-integrated-model/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allfed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":".zenodo.json"}},"created_at":"2021-06-28T01:58:47.000Z","updated_at":"2025-05-20T09:53:41.000Z","dependencies_parsed_at":"2024-04-09T11:28:12.611Z","dependency_job_id":"24be1345-c788-489f-8c66-a2af0ef99e16","html_url":"https://github.com/allfed/allfed-integrated-model","commit_stats":{"total_commits":701,"total_committers":27,"mean_commits":"25.962962962962962","dds":0.5492154065620543,"last_synced_commit":"fffcbfe740d8c8688527563dc0fbef02d5fb2154"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/allfed/allfed-integrated-model","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allfed%2Fallfed-integrated-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allfed%2Fallfed-integrated-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allfed%2Fallfed-integrated-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allfed%2Fallfed-integrated-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allfed","download_url":"https://codeload.github.com/allfed/allfed-integrated-model/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allfed%2Fallfed-integrated-model/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31441057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T15:22:31.103Z","status":"ssl_error","status_checked_at":"2026-04-05T15:22:00.205Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"owner":{"login":"allfed","name":"ALLFED","uuid":"47238586","kind":"organization","description":"Feeding everyone, no matter what.","email":null,"website":"http://allfed.info/","location":null,"twitter":null,"company":null,"icon_url":"https://avatars.githubusercontent.com/u/47238586?v=4","repositories_count":11,"last_synced_at":"2023-03-03T17:45:24.561Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/allfed","funding_links":[],"total_stars":null,"followers":null,"following":null,"created_at":"2022-11-14T03:36:19.595Z","updated_at":"2023-03-03T17:45:24.740Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allfed","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allfed/repositories"},"packages":[],"commits":{"id":1548665,"full_name":"allfed/allfed-integrated-model","default_branch":"main","total_commits":710,"total_committers":23,"total_bot_commits":11,"total_bot_committers":11,"mean_commits":30.869565217391305,"dds":0.5098591549295775,"past_year_total_commits":1,"past_year_total_committers":1,"past_year_total_bot_commits":0,"past_year_total_bot_committers":0,"past_year_mean_commits":1.0,"past_year_dds":0.0,"last_synced_at":"2026-04-05T16:05:00.973Z","last_synced_commit":"1da0aacefce1d82043f60290228be6c5310edd78","created_at":"2024-05-08T00:05:56.595Z","updated_at":"2026-04-05T16:02:34.249Z","committers":[{"name":"Morgan Rivers","email":"danielmorganrivers@gmail.com","login":"morganrivers","count":348},{"name":"Florian Ulrich Jehn","email":"florianjehn@posteo.de","login":"florianjehn","count":135},{"name":"Morgan","email":"morgan@allfed.info","login":null,"count":56},{"name":"Kevin Rassool","email":"kevin.rassool@gmail.com","login":"k-r-a-s-s","count":51},{"name":"Simon Blouin","email":"simonblouin3@gmail.com","login":"simonblouin","count":47},{"name":"lukaszgajewski","email":"lukaszgajewski@tuta.io","login":"lukaszgajewski","count":26},{"name":"Lint Action","email":"lint-action@samuelmeuli.com","login":"lint-action","count":23},{"name":"lzhangUT","email":"39503235+lzhangUT","login":"lzhangUT","count":6},{"name":"Tim","email":"timothyfist@gmail.com","login":"strange-boop","count":3},{"name":"David Mears","email":"david.mears@usemast.com","login":"david-mears-2","count":2},{"name":"Jaz","email":"jaz.jlh@gmail.com","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az163-762.ksqkok1cighebdh5ckq0wc3qdf.dx.internal.cloudapp.net","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az202-927.ngw3kpfb2bguzbtcwuqjmbcvef.gx.internal.cloudapp.net","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az203-366.ild0l4k5vsluppoevu2oqvhmda.cx.internal.cloudapp.net","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az255-450.sbdzdnwsxtye1lzl1wgdhvzhwg.dx.internal.cloudapp.net","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az28-593.ycjfjujedjyu5lezsnvlijijec.cx.internal.cloudapp.net","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az315-533.dyy4d1nhibmuvepyfocjerynzc.cx.internal.cloudapp.net","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az339-682.coi3uxiffnlergb4vem53tdisf.gx.internal.cloudapp.net","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az349-19.3t0xkmjykhgubkuqaxvs1rllgg.bx.internal.cloudapp.net","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az360-336.h5lfckq5nikujmnflmxr2csa2b.bx.internal.cloudapp.net","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az449-310.jvjgdiodbn4ungrcbaap0pmvbb.dx.internal.cloudapp.net","login":null,"count":1},{"name":"github-actions[bot]","email":"runner@fv-az571-649.n1u3arpfo4le1efxmz3zz4qjhf.xx.internal.cloudapp.net","login":null,"count":1},{"name":"Jaz Harnal","email":"jlh2av@virginia.edu","login":"jaz-jlh","count":1}],"past_year_committers":[{"name":"Florian Ulrich Jehn","email":"florian.u.jehn@posteo.de","login":"florianjehn","count":1}],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories/allfed%2Fallfed-integrated-model/commits","host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-04-07T00:00:11.408Z","repositories_count":6211550,"commits_count":918089627,"contributors_count":35587537,"owners_count":1142705,"icon_url":"https://github.com/github.png","host_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories"}},"issues_stats":{"full_name":"allfed/allfed-integrated-model","html_url":"https://github.com/allfed/allfed-integrated-model","last_synced_at":"2025-09-01T06:33:29.091Z","status":"error","issues_count":126,"pull_requests_count":62,"avg_time_to_close_issue":12501096.73076923,"avg_time_to_close_pull_request":467796.88524590165,"issues_closed_count":78,"pull_requests_closed_count":61,"pull_request_authors_count":6,"issue_authors_count":7,"avg_comments_per_issue":1.3888888888888888,"avg_comments_per_pull_request":0.3548387096774194,"merged_pull_requests_count":54,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":36,"past_year_pull_requests_count":15,"past_year_avg_time_to_close_issue":410323.0,"past_year_avg_time_to_close_pull_request":157637.2142857143,"past_year_issues_closed_count":5,"past_year_pull_requests_closed_count":14,"past_year_pull_request_authors_count":2,"past_year_issue_authors_count":2,"past_year_avg_comments_per_issue":0.75,"past_year_avg_comments_per_pull_request":1.2666666666666666,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":12,"created_at":"2024-05-08T00:06:07.613Z","updated_at":"2025-09-02T19:00:12.896Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/allfed%2Fallfed-integrated-model","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/allfed%2Fallfed-integrated-model/issues","issue_labels_count":{"enhancement":51,"bug":38,"documentation":24,"invalid":11,"help wanted":5,"question":5,"wontfix":2},"pull_request_labels_count":{},"issue_author_associations_count":{"COLLABORATOR":120,"CONTRIBUTOR":4,"NONE":2},"pull_request_author_associations_count":{"COLLABORATOR":85,"CONTRIBUTOR":2,"NONE":1},"issue_authors":{"morganrivers":56,"florianjehn":30,"lukaszgajewski":25,"k-r-a-s-s":6,"david-mears-2":4,"jaz-jlh":3,"simonblouin":2},"pull_request_authors":{"morganrivers":41,"florianjehn":26,"lukaszgajewski":16,"david-mears-2":2,"jaz-jlh":2,"simonblouin":1},"host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-04-05T00:00:08.668Z","repositories_count":14089617,"issues_count":34439849,"pull_requests_count":112367015,"authors_count":11226217,"icon_url":"https://github.com/github.png","host_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories","owners_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/owners","authors_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors"},"past_year_issue_labels_count":{},"past_year_pull_request_labels_count":{},"past_year_issue_author_associations_count":{},"past_year_pull_request_author_associations_count":{},"past_year_issue_authors":{},"past_year_pull_request_authors":{},"maintainers":[{"login":"morganrivers","count":97,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/morganrivers"},{"login":"florianjehn","count":56,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/florianjehn"},{"login":"lukaszgajewski","count":38,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/lukaszgajewski"},{"login":"k-r-a-s-s","count":6,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/k-r-a-s-s"},{"login":"jaz-jlh","count":5,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/jaz-jlh"},{"login":"simonblouin","count":3,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/simonblouin"}],"active_maintainers":[]},"events":{"total":{"IssuesEvent":14,"IssueCommentEvent":1,"PushEvent":3,"PullRequestEvent":4,"ForkEvent":1},"last_year":{"PushEvent":1,"ForkEvent":1}},"keywords":[],"dependencies":[{"ecosystem":"actions","filepath":".github/workflows/docs.yml","sha":null,"kind":"manifest","created_at":"2023-01-27T20:01:08.189Z","updated_at":"2023-01-27T20:01:08.189Z","repository_link":"https://github.com/allfed/allfed-integrated-model/blob/main/.github/workflows/docs.yml","dependencies":[{"id":7193563426,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false},{"id":7193563427,"package_name":"actions/setup-python","ecosystem":"actions","requirements":"v4","direct":true,"kind":"composite","optional":false},{"id":7193563428,"package_name":"ad-m/github-push-action","ecosystem":"actions","requirements":"master","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/lint_action.yml","sha":null,"kind":"manifest","created_at":"2023-01-27T20:01:08.288Z","updated_at":"2023-01-27T20:01:08.288Z","repository_link":"https://github.com/allfed/allfed-integrated-model/blob/main/.github/workflows/lint_action.yml","dependencies":[{"id":7193563440,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":7193563441,"package_name":"actions/setup-python","ecosystem":"actions","requirements":"v1","direct":true,"kind":"composite","optional":false},{"id":7193563442,"package_name":"wearerequired/lint-action","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/testing.yml","sha":null,"kind":"manifest","created_at":"2023-01-27T20:01:08.334Z","updated_at":"2023-01-27T20:01:08.334Z","repository_link":"https://github.com/allfed/allfed-integrated-model/blob/main/.github/workflows/testing.yml","dependencies":[{"id":7193563446,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false},{"id":7193563447,"package_name":"actions/setup-python","ecosystem":"actions","requirements":"v4","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"pypi","filepath":"requirements.txt","sha":null,"kind":"manifest","created_at":"2023-01-27T20:01:08.623Z","updated_at":"2023-01-27T20:01:08.623Z","repository_link":"https://github.com/allfed/allfed-integrated-model/blob/main/requirements.txt","dependencies":[{"id":7193563684,"package_name":"pandas","ecosystem":"pypi","requirements":"\u003e=1.4.3","direct":true,"kind":"runtime","optional":false},{"id":7193563685,"package_name":"setuptools","ecosystem":"pypi","requirements":"\u003e=61.2.0","direct":true,"kind":"runtime","optional":false},{"id":7193563686,"package_name":"pytest","ecosystem":"pypi","requirements":"\u003e=7.1.2","direct":true,"kind":"runtime","optional":false},{"id":7193563687,"package_name":"numpy","ecosystem":"pypi","requirements":"\u003e=1.23.1","direct":true,"kind":"runtime","optional":false},{"id":7193563688,"package_name":"matplotlib","ecosystem":"pypi","requirements":"\u003e=3.5.1","direct":true,"kind":"runtime","optional":false},{"id":7193563689,"package_name":"scipy","ecosystem":"pypi","requirements":"\u003e=1.8.1","direct":true,"kind":"runtime","optional":false},{"id":7193563690,"package_name":"seaborn","ecosystem":"pypi","requirements":"\u003e=0.11.2","direct":true,"kind":"runtime","optional":false},{"id":7193563691,"package_name":"shapely","ecosystem":"pypi","requirements":"\u003e=1.8.2","direct":true,"kind":"runtime","optional":false},{"id":7193563692,"package_name":"geopandas","ecosystem":"pypi","requirements":"\u003e=0.11.0","direct":true,"kind":"runtime","optional":false},{"id":7193563693,"package_name":"openpyxl","ecosystem":"pypi","requirements":"\u003e=3.0.10","direct":true,"kind":"runtime","optional":false},{"id":7193563694,"package_name":"python-pptx","ecosystem":"pypi","requirements":"\u003e=0.6.21","direct":true,"kind":"runtime","optional":false},{"id":7193563695,"package_name":"pulp","ecosystem":"pypi","requirements":"\u003e=2.6.0","direct":true,"kind":"runtime","optional":false},{"id":7193563696,"package_name":"GitPython","ecosystem":"pypi","requirements":"*","direct":true,"kind":"runtime","optional":false}]},{"ecosystem":"pypi","filepath":"setup.py","sha":null,"kind":"manifest","created_at":"2024-01-04T16:27:36.953Z","updated_at":"2024-01-04T16:27:36.953Z","repository_link":"https://github.com/allfed/allfed-integrated-model/blob/main/setup.py","dependencies":[]},{"ecosystem":"conda","filepath":"environment.yml","sha":null,"kind":"manifest","created_at":"2024-04-09T11:28:11.243Z","updated_at":"2024-04-09T11:28:11.243Z","repository_link":"https://github.com/allfed/allfed-integrated-model/blob/main/environment.yml","dependencies":[{"id":17327442331,"package_name":"flake8","ecosystem":"conda","requirements":"","direct":true,"kind":"runtime","optional":false},{"id":17327442332,"package_name":"geopandas","ecosystem":"conda","requirements":"","direct":true,"kind":"runtime","optional":false},{"id":17327442333,"package_name":"ipykernel","ecosystem":"conda","requirements":"","direct":true,"kind":"runtime","optional":false},{"id":17327442334,"package_name":"openpyxl","ecosystem":"conda","requirements":"","direct":true,"kind":"runtime","optional":false},{"id":17327442335,"package_name":"plotly","ecosystem":"conda","requirements":"","direct":true,"kind":"runtime","optional":false},{"id":17327442336,"package_name":"pytest","ecosystem":"conda","requirements":"","direct":true,"kind":"runtime","optional":false},{"id":17327442337,"package_name":"python-pptx","ecosystem":"conda","requirements":"","direct":true,"kind":"runtime","optional":false},{"id":17327442341,"package_name":"pyyaml","ecosystem":"conda","requirements":"","direct":true,"kind":"runtime","optional":false},{"id":17327442342,"package_name":"seaborn","ecosystem":"conda","requirements":"","direct":true,"kind":"runtime","optional":false},{"id":17327442343,"package_name":"statsmodels","ecosystem":"conda","requirements":"","direct":true,"kind":"runtime","optional":false}]}],"score":7.22983877815125,"created_at":"2024-05-08T00:05:54.659Z","updated_at":"2026-04-07T17:00:38.867Z","avatar_url":"https://github.com/allfed.png","language":"Python","category":"Consumption","sub_category":"Agriculture and Nutrition","monthly_downloads":0,"total_dependent_repos":0,"total_dependent_packages":0,"readme":"# ALLFED Integrated Food System Model\n\n---\n![Testing](https://github.com/allfed/allfed-integrated-model/actions/workflows/testing.yml/badge.svg)\n[![DOI](https://zenodo.org/badge/380878388.svg)](https://zenodo.org/badge/latestdoi/380878388)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n---\nAn integrated food supply model for resilient foods in nuclear winter\n\n# Run the model\n\n* You can create a variety of different scenarios with this model. A collection of possible scenarios are already available in the scenarios folder (e.g. `run_model_with_resilient_foods.py`). Examples of usage can be found in the scripts folder. Resulting pptx can be found in results/large_reports/. If you don't wish to run these results yourself, you can find more pregenerated results in the Zenodo repository (https://zenodo.org/record/7039924).\n### Running on command line\n\n(See Dependencies section first)\n\nResults from the paper can be rerun using the following command:\n```bash\npython3 plot_manuscript_figures.py rerun all\n```\nYou can always just run \n```bash\npython3 plot_manuscript_figures.py\n```\nTo see how to run fewer plots, load plots you already ran, or show specific results from the paper.\n\nIndividual scenarios, or a series of scenarios of interest, can be specified in the scenarios/ folder.\n```bash\n./run_scenarios_from_yaml.sh True False True argentina.yaml\n```\nThis shows a series of stackplots of argentina with no food trade, including animal slaughter, feed, and food available to humans after waste each month. The scenarios shown are:\n\n1. Baseline net production (continued feed/biofuel, normal climate)\n2. Baseline gross production (shut off feed/biofuel, normal climate)\n3. Nuclear winter net production (continued feed/biofuel, 150 Tg nuclear winter)\n4. Nuclear winter with reduced feed/waste  (continued feed/biofuel, nuclear winter, reduced waste)\n5. Nuclear winter with resilient foods (continued feed/biofuel, nuclear winter, reduced waste, resilient foods)\n6. Nuclear winter with resilient foods \u0026 more area (continued feed/biofuel, nuclear winter, reduced waste, resilient foods, cropland expansion)\n\nThe first argument is whether to show plotted simulation results for the different rounds of optimization.\nThe second argument is whether to show a map of percent people fed for all countries, and shows at the end for each type of scenario specified in the yaml file.\nThe third argument should be set to False unless you are running the model from the [web interface](https://github.com/allfed/integrated-model-web).\n\nRounds of optimization: Round1 is zero feed/biofuel for ascertaining minimum human needs that can be satisfied, Round2 determines the amount of feed and biofuel that could be used to optimally produce feed and optionally biofuel, and the Round3 finally combines the appropriate amount of feed and biofuel used while still satisfying human minimum caloric needs. You can alter the plots shown by commenting out display code in scenarios/run_scenario.py display_results_of_optimizer_round function calls.\n\nTo run these scenarios for a specific country, you can create a new yaml file with a specific country specified in the yaml file. For example, to run Oman, you can add the following to the yaml:\n\n```\nsettings:\n  countries: \"OMN\"\n```\nWhere \"OMN\" is the 3 letter iso3 code for Oman.\n\nIf you name this new yaml file for the scenarios as: \"your_yaml_file_here.yaml\", then you would run:\n\n```bash\n./run_scenarios_from_yaml.sh True False your_yaml_file_here.yaml\n```\n\nTo see the results for Oman baseline, nuclear winter, and nuclear winter with resilient foods.\n\n\n# More Details\n\nSee the zenodo repository for more results and reports:\nhttps://zenodo.org/record/7039924\n\n# How the model works in general\n\n![Flow Chart](https://raw.githubusercontent.com/allfed/allfed-integrated-model/main/docs/overview.png)\n\n# more details\n![Flow Chart](https://raw.githubusercontent.com/allfed/allfed-integrated-model/main/outfile.png)\n![Flow Chart](https://raw.githubusercontent.com/allfed/allfed-integrated-model/main/docs/repository_flowchart/ModularArchitecture.drawio(2).svg)\n\n\n\n#### Dependency management with Anaconda\nThe integrated model is written in python 3, ensure you have some version of python3, although it has only been tested with python 3.9 or later. Then, install the required packages using conda or miniconda:\n\nYou'll also need to install conda or miniconda, micromamba, or similar.\n\nSee https://docs.anaconda.com/anaconda/install/index.html for installation instructions.\n\nOnce the program is installed on your device, set up a separate environment for the project\n(do not use your base environment). This step and the following can be done in two ways:\n- using the GUI or\n- using the Anaconda Prompt.\nFor people new to coding the GUI is more intuitive.\n\n##### GUI\n1. Open the Anaconda Navigator.\n2. Select the tap \"Environments\".\n3. Click \"Import\" and select the \"environment.yml\" file from the repository and name the new\n    environment. All dependencies will be installed automatically.\n\n##### Anaconda Prompt\n1. Open Anaconda Prompt.\n2. Type in the following line:\n```bash\nconda env create -f environment.yml\n```\nThe dependencies will be installed automatically and the environment will be name intmodel.\n\nIf you close out the terminal and open it later you will want to activate the environment again using\n\n```bash\nconda activate intmodel\n```\n\nFor both versions: Code from this project will only run smoothly when opened in the new\nenvironment and when the working directory is set to the path location of the repository on\nyour machine.\n\n# Regenerate documentation\n```bash\npython3 automate_mkdocs.py\ngendocs --config mkgendocs.yml\nmkdocs serve\n```\nThen navigate to `http://127.0.0.1:8000/` in your web browser.\n\n# Detailed Explanation of Files and Folders in this Repository\n\nBelow we explain all of the folders and files used for getting data, processing data, running simulations, then displaying and saving results of models.\n\nFiles purely for  mentation or creating the python environment are not included below.\n\nDirectory Structure\n------------\n\n    ├── data/\n    │\n    │   All the tabulated data used for the repository, as well as intermediary \n    │   processed results from import scripts. Also contains data explaining \n    │   assumptions of the model in the Supplemental_Data.xlsx file.    \n    │\n    ├── results/\n    │\n    │   Outputs of the model including figures and pptx generated reports. \n    │\n    ├── scripts/\n    │\n    │   Convenient scripts used to run sets of python scripts.\n    │\n    ├── src/\n    │                 \n    │   All of the code used to model the food system and to run simulations.\n    │                   \n\n## data/\n\nAll data for the use of generating scenarios is contained in this directory, with the exception that some aggregate global constants for the food system are stored in the **src/scenarios/scenarios.py** file.\n(Note: currently getting rid of \"magic numbers\" in other files, but it is a long process)\n\n\n**resilient_food_primary_results.npy**, **no_resilient_food_primary_results.npy**\n\nThese are used for plotting data from src/scenarios/plot_primary_food.py.\n\n\n**Supplemental_Data.xlsx**\n\nThis is part of the raw data imported in the case of Nutrition, or \nused directly for estimating the performance of crop relocation or expected \ndiet availability, as well as crop seasonality. \n\nThe spreadsheet contains the following tabs: \n\n* Summary of field margins\n* Cost modelling\n* Diet affordability\n* Crop years\n* Production \u0026 stocks seasonality\n* Crop Model Results\n* Crop Model ASRS Relocation Estimate\n* Crop Model No Relocation\n* Crop Model 2005\n* Production 2005\n* Production 2005 Raw\n* Nutrition\n\n\n## data/no_food_trade/\n\nContains data used to run the country-by-country no food trade model.\n\n**processed_data/** \n\nAll of the CSV files in this folder are generated by running the scripts/run_all_imports.sh file. They contain data in standard format for each country on values of interest for the food system models (for no food trade scenarios).\n\n**raw_data/** \n\nAll data files used for each country in the no food trade scenarios, directly from the data source (before processing to make standard format). Processing of these files happens using the import files in **/src/import_scripts_no_food_trade/** directory, which can in turn be called all at once using the **scripts/run_all_imports.sh** script.\n\n**computer_readable_combined.csv**\n    \nThe ultimate result from running all the import scripts in **src/import_scripts_no_food_trade**, (also accomplished using **scripts/run_all_scripts.py**). In particular, the **src/import_scripts_no_food_trade/import_food_data.py** file creates this by merging the csvs into a dataframe then exporting the result to this csv.\n\n## data/no_food_trade/raw_data/\n\nRaw data files for each country in the no food trade scenarios, directly from the data source (before processing to make standard format). Processing of these files happens using the import files in **/src/import_scripts_no_food_trade/** directory, which can in turn be called all at once using the **scripts/run_all_imports.sh** script.\n\n\n**FAOSTAT_*_.CSV**\n\nData files imported directly from FAOSTAT for the year in question.\n\n\n**Integrated Model With No Food Trade.xlsx**\n\nThe spreadsheet is used as a remaining set of data pertaining to no food trade\nscenarios, which is imported in addition to raw FAOSTAT data to create the \nfinal computer_readable_code.csv file.\n\nContains the following tabs:\n* Population\n* Food waste\n* Outdoor crop Production Seasonality\n* Outdoor Crop Production Baseline\n* Outdoor Crop Production NW\n* Food Stocks\n* Seafood - excluding seaweeds\n* Grazing\n* Seaweed\n* Cellulosic Sugar\n* Greenhouses\n* Methane SCP\n* Combined\n\n**rutgers_nw_production_raw.csv**\n\nRaw data provided by the Rutgers Toon group from Xia et al publication regarding grasses and staple crops (spring wheat, maize, soybean, rice) fractional crop yields to baseline in a 150 tg nuclear winter scenario.\n\n## results/\n\nOutputs of the model including figures and pptx generated reports. \n\n**large_reports/**\n\nReports generated with the **run_model_no_trade_baseline.py**, **run_model_no_trade_no_resilient_foods.py**, and **run_model_no_trade_with_resilient_foods.py** in **src/scenarios/**.\n\n\n**Figure_4/**\n\nDiagrammatic flow chart of the integrated model. \n\n**\\*.fig**\n\nFigures produced by running some **src/scenarios/** files. The last stage of figure generation (plotting itself) always occurs in the **src/utilities/plotter.py** file.\n\n\n## scripts/\n\nConvenient scripts used to run sets of python scripts.\n\n**create_all_no_trade_scenario_pptx.sh**\n\nGenerates a full set of results in **results/large_reports/** by running run_model_no_trade scripts in **src/scenarios/**, using both the \"single\" and \"multi\" arguments.\n\n**run_all_imports.sh**\n\nThis script creates all the imported .csv files in the **data/no_food_trade/processed_data** folder, by running all the **import_*_csv.py** scripts in **src/import_scripts_no_food_trade/**. It's required to run this for importing all the food system input data before running simulations if no_food_trade scenarios are being run.\n\n\n## src/\n\nAll of the code used to model the food system and to run simulations\n\n**food_system/**\n\nCalled by the compute_parameters function in **src/optimizer/parameters.py**, each function represents a different part of the food system. \n\n**import_scripts_no_food_trade/**\n\nThis is required to be run before other files in **src/** in order to import raw data into a usable format for other files in **src/**. It is a set of scripts that are run to import food system data, typically by the **scripts/run_all_imports.sh** file. These create the imported .csv files in the **data/no_food_trade/processed_data** folder. It's required to run this for importing all the food system input data before running simulations for no_food_trade scenarios.\n\n## src/optimizer/\n\nThe optimizer folder runs the following sequence in order for every scenario: compute_parameters, run_optimizer, extract_results, interpret_results, validate_results. The **parameters.py** file also imports all the **src/food_system** category-specific calculations. The results of **parameters.py** are sent to the **optimizer.py** through the constants_out variable.\n\nOptimization in optimizer uses the PuLP linear optimizer to optimally satisfy the series of constraints used in that model.\n\n## src/scenarios/\n\nRunning a script in scenarios is done after completing import of the scripts, if no_food_trade scenarios are being run. The scenarios are all either involving full food trade or no food trade between trading blocs, as determined by the trading bloc data in **no_food_trade/computer_readable_combined.csv** and globally-aggregated data stored in **scenarios.py**.\n\nUtility files used to specify the scenarios are: **scenarios.py**\n\nFinally the results are returned from run_scenario back up the call chain in reverse order.\n\n**utilities/**\n\nvarious useful utilities that are called elsewhere in the program, that do not serve any core function for the modelling. Notably, all the plotting code is located in the utilities directory.\n","funding_links":[],"readme_doi_urls":[],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":[],"project_url":"https://ost.ecosyste.ms/api/v1/projects/192394","html_url":"https://ost.ecosyste.ms/projects/192394"}