<jupyter_start><jupyter_text>CALFEWS: California Food-Energy-Water System simulation modelThis notebook will rerun all simulations and recreate all figures from the following manuscript:<NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., and <NAME>. (2020). "California's Food-Energy-Water System: An Open Source Simulation Model of Adaptive Surface and Groundwater Management in the Central Valley." (In review, preprint available at https://engrxiv.org/sqr7e/).Prior to running this notebook, follow the instructions in "README.md" to download the model and data, and install all Python dependencies.  Run validation First, make sure you do not already have output stored at ``results/Historical_validation_1997-2016`` or ``results/Historical_reconstruction_1906-2016``. If so, it needs to be moved or deleted, or it will cause an error.Override parameter file with version in "runtime_params_validation.ini"<jupyter_code>! cp runtime_params_validation.ini runtime_params.ini<jupyter_output><empty_output><jupyter_text>Run validation mode (1997-2016). This will take ~7-10 minutes. Note: you may need to change ``python`` to ``python3`` depending on your system setup.<jupyter_code>results_validation = "results/Historical_validation_1997-2016"
! python -W ignore run_main_cy.py $results_validation 1 1<jupyter_output>#######################################################
Begin initialization...
Initialization complete,  0:00:26.571801
Begin simulation,  0:00:26.571888
results/Historical_validation_1997-2016
Year  1.0 ,  0:00:42.225521
Year  2.0 ,  0:00:57.695774
Year  3.0 ,  0:01:10.736299
Year  4.0 ,  0:01:23.913503
Year  5.0 ,  0:01:36.546530
Year  6.0 ,  0:01:48.588354
Year  7.0 ,  0:02:00.279946
Year  8.0 ,  0:02:12.176092
Year  9.0 ,  0:02:25.849324
Year  10.0 ,  0:02:40.742602
Year  11.0 ,  0:02:51.742830
Year  12.0 ,  0:03:02.705682
Year  13.0 ,  0:03:14.117306
Year  14.0 ,  0:03:27.066439
Year  15.0 ,  0:03:47.164894
Year  16.0 ,  0:04:01.233314
Year  17.0 ,  0:04:14.185930
Year  18.0 ,  0:04:25.037359
Year  19.0 ,  0:04:34.814480
Year  20.0 ,  0:04:46.104096
Simulation complete, 0:04:46.378450
Objective calculation complete, 0:04:46.383613
Data output complete, 0:04:51.696851<jupyter_text>Run simulation Now change to simulation mode (1906-2016) and rerun. This will take ~35-50 minutes.<jupyter_code>results_simulation = "results/Historical_reconstruction_1906-2016"
! sed -i 's:\"validation\":\"simulation\":' runtime_params.ini
! python -W ignore run_main_cy.py $results_simulation 1 1<jupyter_output><empty_output><jupyter_text>Post-processingRun post-processing to analyze and visualize results. This will take a few hours.<jupyter_code>results_figs = 'results/figs'
results_sankeys = 'results/sankeys'
! python -W ignore modeling_paper_postprocess.py $results_validation $results_simulation $results_figs $results_sankeys<jupyter_output>Finish set up,  0:00:21.617461
Finish Delta pumping/outflow figure,  0:02:50.287437
Finish district deliveries figure,  0:26:28.575748
Finish snowpack/flow relationship figure,  0:33:03.686595
Finish state response figure,  0:33:07.263782
Finish validation figures,  0:33:18.926046
Starting Sankey diagrams (this will take a while)
14600 September
14601 September
14602 September
14603 September
14604 September
14605 September
14606 September
14607 September
14608 September
14609 September
14610 October
14611 October
14612 October
14613 October
14614 October
14615 October
14616 October
14617 October
14618 October
14619 October
14620 October
14621 October
14622 October
14623 October
14624 October
14625 October
14626 October
14627 October
14628 October
14629 October
14630 October
14631 October
14632 October
14633 October
14634 October
14635 October
14636 October
14637 October
14638 October
14639 October
14640 October
14641 November
14642 November
14643 November
14644 November
14645 November[...]<jupyter_text>Show figures from postprocessing scripts. Note that if you rerun this, you may need to save your changes and then refresh the browser for the figures below to update to their newest versions.<jupyter_code>from IPython.display import HTML
HTML('<img src="' + results_figs + '/delta_pumping_extended_simulation.png">')
HTML('<img src="' + results_figs + '/district_water_use_annual_validation.png">')
HTML('<img src="' + results_figs + '/district_water_use_annual_simulation.png">')
HTML('<img src="' + results_figs + '/state_estimation_publication.png">')
HTML('<img src="' + results_figs + '/state_response_sanluisstate_wheeler.png">')
HTML('<img src="' + results_figs + '/model_validation_sierra.png">')
HTML('<img src="' + results_figs + '/model_validation_delta.png">')
HTML('<img src="' + results_figs + '/model_validation_sanluis.png">')
HTML('<img src="' + results_figs + '/model_validation_bank.png">')
HTML('<img src="' + results_sankeys + '/cali_sankey1946.gif">')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11536893599673868, 'fraction_numerical': 0.14247859763554832, 'mean_word_length': 5.853351955307263, 'pattern_counts': {'":': 2, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '533243', 'license': 'MIT', 'n_tokens_mistral': 2026, 'n_tokens_neox': 1616, 'n_words': 473, 'path': 'modeling_paper_notebook.ipynb', 'repo_name': 'ahamilton144/CALFEWS', 'size': '4951'}