Skip to content

Warn for missing parameters when converting from EPA to MVS format#656

Merged
Bachibouzouk merged 10 commits intodevfrom
feature/warn-missing-parameters
Nov 13, 2020
Merged

Warn for missing parameters when converting from EPA to MVS format#656
Bachibouzouk merged 10 commits intodevfrom
feature/warn-missing-parameters

Conversation

@Bachibouzouk
Copy link
Copy Markdown
Collaborator

@Bachibouzouk Bachibouzouk commented Nov 12, 2020

Changes proposed in this pull request:

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)

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

DATA,
)

from multi_vector_simulator.A1_csv_to_json import MissingParameterError
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

should we define those in utils rather than in multi_vector_simulator.A1_csv_to_json @smartie2076, @SabineHaas ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You mean the different error types? Would probably be good to define all of them at one place, to also have similar error types and not create a lot of them...?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

They are defined in A1_csv_to_json for the moment, I think it is the only place where they are defined

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nope, I also defined personalized error types. Not sure where though..

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok, then utils would be a good place to define them I think

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this for a later PR? Then, do you want to create an issue for it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This PR is small enough to add it here

Bachibouzouk added 3 commits November 13, 2020 01:53
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.

You are right about the fixcost not being included, but I will actually remove them when solving #655. We should communicate with ICOM that this will change.


### Added
-
- Warning for missing parameter when parsing inputs from epa to mvs (#656)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- Warning for missing parameter when parsing inputs from epa to mvs (#656)
- Warning for missing parameter when parsing inputs from EPA to MVS (#656)

myfile.write(json_data)
myfile.close()
logging.info(
"Converted and stored processed simulation data to json: %s", file_path
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"Converted and stored processed simulation data to json: %s", file_path
f"Converted and stored processed simulation data to json: {file_path}"

Comment on lines +113 to +120
if isinstance(folder_path, dict):
# the folder_path argument is already a dict
main_parameters = folder_path
else:
# load the mvs input json file into a dict
json_file_path = os.path.join(folder_path, JSON_FNAME)
with open(json_file_path) as fp:
main_parameters = json.load(fp)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does this mean that we now can give the parsed json file directly as an argument for the MVS? In that case, what happens if -ext csv or -ext json is given as an argument as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No, this means that you can provide the parse json to the function compare_input_parameters_with_reference

You can already give the parsed json file direcly as an argument of the MVS if you use the server.run_simulation instead of cli.main (this is what gets executed when running mvs_tool). I was not planning to allow already parsed json to command line.

DATA,
)

from multi_vector_simulator.A1_csv_to_json import MissingParameterError
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this for a later PR? Then, do you want to create an issue for it?

@Bachibouzouk Bachibouzouk merged commit 0d322f4 into dev Nov 13, 2020
@Bachibouzouk Bachibouzouk deleted the feature/warn-missing-parameters branch November 13, 2020 18:26
@SabineHaas SabineHaas mentioned this pull request Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants