Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds checks for input data and config file names #157

Merged
merged 5 commits into from
Apr 19, 2023

Conversation

trevorb1
Copy link
Member

In this PR, I have added logic to the base ReadStrategy class to check that input data names match the parameter and set names defined in the configuration file. If an inconsistency is found, an OtooleNameMismatchError or AmplyError is raised.

The table below highlights the implemented logic:

Read Format Type of Error Error Message
datafile Name in config file but not in input data No error raised
datafile Name in input data but not in config file AmplyError: Param AccumulatedAnnualDemand not previously defined
csv Name in config file but not in input data OtooleNameMismatchError: AccumulatedAnnualDemand -> Name not consistent between data and config file
csv Name in input data but not in config file OtooleNameMismatchError: AccumulatedAnnualDemand -> Name not consistent between data and config file
excel Name in config file but not in input data OtooleNameMismatchError: AccumulatedAnnualDemand -> Name not consistent between data and config file
excel Name in input data but not in config file OtooleNameMismatchError: AccumulatedAnnualDemand -> Name not consistent between data and config file

The exception here is when reading in a MathProg data file and there are extra definitions in the configuration file. Since the configuration file is used to define what sets/parameters to look for in the datafile (see code snippet below), Im not sure the best way around this? @willu47 do you have any immediate thoughts on how to get around this issue? No worries if not though, and I can see if I can come up with something!

Below shows the issue of how we use the config file to read in MathProg data, so we can't easily check if all values are captured :(

https://github.com/trevorb1/otoole/blob/3ff92fe3668c106f6822978b6aae94cfab05ed9c/src/otoole/read_strategies.py#L287-L324

Closes #151

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.

1 participant