Draft
Conversation
…s baked into the expanded area model
Contributor
Author
|
Ah, a slight oversight on my part -- the repo tests use Python 3.9 and I tested locally with 3.12, so for example the match statement is not available in 3.9. |
Collaborator
|
If don't have any problem with upgrading to 3.12. Also I think the environment.yml file should be more explicit about versions to avoid this kind of issue going forward. |
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.
TODO
Description
This PR implements expanded planted area as developed by Monteiro et al. (link pending)
It takes values calculated by Luisa – monthly increase in wheat yield – converts them to yearly values, and applies seasonality (per already existing data in the repository), and assigns zero to the first nine months.
Nine, because of the assumption in the paper: “that land cleared in a month is immediately cultivated, and wheat is harvested from that area 8 months after cultivation”.
We do not provide a parameter to control this because the 8 months is assumed throughout the model so we cannot just shift the zeroing out in the integrated model. In order for this to be customisable, we need a full extended planted area model implementation, and not just plugin the pre-computed results into the integrated model as this PR is doing.
These values are then added to the outdoor crop production values (OutdoorCrops.KCALS_GROWN and OutdoorCrops.NO_RELOCATION_KCALS_GROWN).
The addition is done after nuclear winter reduction since the values calculated by Luisa already include that reduction.
Note: as of right now we only have values for wheat.
Birds-eye view of the changes:
all_resilient_foods_and_more_areascenario (including a test intests/test_argentina_parameters.py).assign_increase_from_increased_cultivated_areafunction fromOutdoorCropsclass.expanded_area_and_relocated_outdoor_cropsfunction from theScenariosclass.get_all_resilient_foods_and_more_area_scenariofunction from theScenariosclass.scenarios/README.md.USA_expanded.yaml).assign_increase_from_expanded_planted_areafunction to theOutdoorCropsclass.data/no_food_trade/raw_data/luisa_expanded_planted_area.csv– data from Luisa Monteiro.src/import_scripts_no_food_trade/create_expanded_area_csv.pyscript that takes a spreadsheet from Luisa Monteiro as an input and creates a CSV file formatted analogously to other “processed” CSV files in the repository.data/no_food_trade/processed_data/expanded_area.csv.data/tests_data/outdoor_crops_constants_for_params_usa_extended_yaml.picklefor testing purposes.set_expanded_areato theScenariosclass.tests/test_expanded_area.pytests/test_expanded_area_global.pytests/test_food_system_outdoor_crops.pytests/test_scenario_loader.pysrc/import_scripts_no_food_trade/import_food_data.pyto include the expanded area csvdata/no_food_trade/computer_readable_combined.csv, as abovecalculate_monthly_productionfunction inOutdoorCropsclass to callassign_increase_from_expanded_planted_areainstead ofexpanded_area_and_relocated_outdoor_crops.set_depending_on_optioninScenarioRunner; it now has additional assertions enforcing proper data types and callsset_expanded_areafrom theScenariosclass.