Skip to content

Create a new parameter for scenario description#722

Merged
mahendrark merged 9 commits intodevfrom
feature/scenario_desc
Jan 11, 2021
Merged

Create a new parameter for scenario description#722
mahendrark merged 9 commits intodevfrom
feature/scenario_desc

Conversation

@mahendrark
Copy link
Copy Markdown
Contributor

@mahendrark mahendrark commented Dec 16, 2020

Fix #184

Changes proposed in this pull request:

  • Add a new parameter scenario_description to the input files
  • Add this parameter to the sections in RTD discussing MVS parameters
  • Add a section in autoreport describing the current scenario being simulated

The following steps were realized, as well (if applies):

  • Use in-line comments to explain your code
  • Write docstrings to your code (example docstring)
  • For new functionalities: Explain in readthedocs
  • Write test(s) for your new patch of code (pytests, assertion debug messages)
  • Update the CHANGELOG.md
  • Apply black (black . --exclude docs/)
  • Check if benchmark tests pass locally (EXECUTE_TESTS_ON=master pytest)

Please mark above checkboxes as following:

  • Open
  • Done

❌ Check not applicable to this PR

For more information on how to contribute check the CONTRIBUTING.md.

@mahendrark mahendrark marked this pull request as draft December 16, 2020 11:54
@mahendrark mahendrark force-pushed the feature/scenario_desc branch 3 times, most recently from 495d7be to aa3216c Compare December 18, 2020 14:08
@mahendrark mahendrark marked this pull request as ready for review December 18, 2020 14:13
@mahendrark
Copy link
Copy Markdown
Contributor Author

@smartie2076

It works as intended. See the attached simulation report below. I added the scenario description to the report.

simulation_report.pdf

@mahendrark mahendrark added the enhancement New feature or request label Dec 18, 2020
@mahendrark mahendrark force-pushed the feature/scenario_desc branch from f55fdcd to 636d809 Compare December 18, 2020 14:17
@mahendrark mahendrark requested review from SabineHaas and removed request for smartie2076 December 18, 2020 14:24
@smartie2076
Copy link
Copy Markdown
Collaborator

@smartie2076

It works as intended. See the attached simulation report below. I added the scenario description to the report.

simulation_report.pdf

Oh neat! Great idea to add an additional header :)

I will not be able to review this today. @SabineHaas if you like the feature for pvcompare, you could consider this.

@SabineHaas
Copy link
Copy Markdown
Contributor

@smartie2076
It works as intended. See the attached simulation report below. I added the scenario description to the report.
simulation_report.pdf

Oh neat! Great idea to add an additional header :)

I will not be able to review this today. @SabineHaas if you like the feature for pvcompare, you could consider this.

sorry I haven't seen that before the release

@smartie2076
Copy link
Copy Markdown
Collaborator

I will not be able to review this today. @SabineHaas if you like the feature for pvcompare, you could consider this.

sorry I haven't seen that before the release

That's fine, did not expect you to include it anyway. Fyi: in the beginning of January we will fix a JSON input file for the EPA, so from there on out all new parameters must not require an API change anymore. Possible great news for @Piranias, especially if we don't implement this in the MVS-EPA parser but require this for the CSV files as well.

@mahendrark mahendrark force-pushed the feature/scenario_desc branch 2 times, most recently from a43f558 to 848005b Compare December 18, 2020 16:21
@mahendrark mahendrark force-pushed the feature/scenario_desc branch 2 times, most recently from 197b0a3 to 18615b0 Compare January 5, 2021 18:01
@mahendrark mahendrark removed the request for review from SabineHaas January 5, 2021 18:02
@mahendrark mahendrark force-pushed the feature/scenario_desc branch from 18615b0 to e6a261b Compare January 5, 2021 18:05
@mahendrark
Copy link
Copy Markdown
Contributor Author

@smartie2076

One of the tests is failing. I did not write any tests in this, nor did I touch any of those tests. Can you please take a look at it? Otherwise, the PR is done.

Copy link
Copy Markdown
Collaborator

@smartie2076 smartie2076 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mahendrark!

There should be many more files that need to be adapted - see folders input_template and tests/benchmark_test_inputs. Also, you should specifically search for .json input files - there, the default parameters are not added from EXTRA_CSV_PARAMETERS (this is only applied when reading csv, not json as an input file). This is the reason for one of the test failures:

E           AssertionError: In path /home/runner/work/multi-vector-simulator/multi-vector-simulator/tests/benchmark_test_inputs/rerun/mvs_config.json, the following parameters are missing:{'project_data': ['scenario_description']}
E           assert 'missing_parameters' not in {'extra_parameters': {'economic_data': ['crf', 'annuity_factor'], 'paths_to_plots': [], 'project_data': ['sectors'], '...er', 'path_input_folder', 'end_date', 'time_index']}, 'missing_parameters': {'project_data': ['scenario_description']}}

Can you create an issue that mentions this? For that, please also try running /home/runner/work/multi-vector-simulator/multi-vector-simulator/tests/benchmark_test_inputs/rerun/mvs_config.json with the MVS (-ext json), and add the error message. Post the json file into the issue as well as you manually fixed version.

@smartie2076
Copy link
Copy Markdown
Collaborator

Regarding the other pytest error

FAILED tests/test_benchmark_KPI.py::Test_Economic_KPI::test_benchmark_Economic_KPI_C2_E2

I suspect that this might be an issue with the defined datatype/unit which should be string.

value = ''
asset_dict = {'country': 'A_country', 'latitude': '0', 'longitude': '0', 'project_id': '1', ...}
row = unit            scenario_description
project_data                        
Name: scenario_description, dtype: object
param = 'scenario_description', asset = 'project_data'
filename = 'project_data'
...
>                       value = int(value)
 E                       ValueError: invalid literal for int() with base 10: ''

It seems to think that the string of scenario_description is to be interpreted as a int. I do not know why this should only be the case for this specific benchmark test (did you try with the other benchmark tests locally?)...

@mahendrark mahendrark self-assigned this Jan 6, 2021
@mahendrark mahendrark requested a review from smartie2076 January 6, 2021 19:48
@mahendrark
Copy link
Copy Markdown
Contributor Author

@smartie2076 all problems are fixed now. Ready for review :)))

@mahendrark mahendrark force-pushed the feature/scenario_desc branch from 84c1dcc to a45dfed Compare January 7, 2021 08:17
@mahendrark
Copy link
Copy Markdown
Contributor Author

Commits are more meaningful now as well!

@Bachibouzouk Bachibouzouk mentioned this pull request Jan 8, 2021
5 tasks
Copy link
Copy Markdown
Collaborator

@Bachibouzouk Bachibouzouk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job @mahendrark

@smartie2076 would the change to docs/MVS_parameters_list.csv cause trouble in dev? This is the last thing we would prevent me from merging this one now ;)

@mahendrark
Copy link
Copy Markdown
Contributor Author

@Bachibouzouk

Something strange happened to this branch when I tried to pull your changes. I solved the merge conflicts and committed it and then now it says I have 19 commits. Can you please take a look and tell me how to fix this?

@Bachibouzouk Bachibouzouk force-pushed the feature/scenario_desc branch from dadcfae to d3fe7fd Compare January 11, 2021 09:27
@Bachibouzouk Bachibouzouk force-pushed the feature/scenario_desc branch from d3fe7fd to 98b38cc Compare January 11, 2021 09:31
@smartie2076
Copy link
Copy Markdown
Collaborator

@smartie2076 would the change to docs/MVS_parameters_list.csv cause trouble in dev? This is the last thing we would prevent me from merging this one now ;)

I think it would be better to delete the first numbered column of the file first in a new PR, merge that into dev and then merge into this one. We have had 4 or 5 PRs now that changed the file, and each may corrupt it or revert the previous changes :´(

Other problem: When you merge this, you need to include it in the parser of #675, as we do not add the default values for new parameters when reading from json (#750).

@Bachibouzouk Bachibouzouk mentioned this pull request Jan 11, 2021
11 tasks
@Bachibouzouk
Copy link
Copy Markdown
Collaborator

Other problem: When you merge this, you need to include it in the parser of #675, as we do not add the default values for new parameters when reading from json (#750).

It is already included :)

@Bachibouzouk
Copy link
Copy Markdown
Collaborator

After the tests pass @mahendrark you can merge this PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scenario description should be stored with inputs

4 participants