watertap-org / watertap

The WaterTAP development repository
https://watertap.readthedocs.io/en/latest
Other
60 stars 59 forks source link

Unable to run amo_1690_sweep.py through command line #952

Open MichaelPesce opened 1 year ago

MichaelPesce commented 1 year ago

Description

Running the amo_1690_sweep.py file through command line returns a "ValueError: 1 is not yet implemented", regardless of which case_num is entered.

Expected Behavior

When running amo_1690_sweep.py through command line, it expects anywhere from 1 to 3 arguments. The first argument is the case_num that determines which case should be run. However, case_num is expected to be an integer and the arguments are strings, so no case numbers can be recognized, which results in the ValueError.

Steps to Reproduce

  1. In an environment with Watertap version 0.8.dev0 installed
  2. Navigate to watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/amo_1690
  3. Run python amo_1690_sweep.py 1

Environment

Anything Else?

This issue is not limited to amo_1690. It appears to be an issue in all or most parameter_sweep files inside subdirectories of watertap/examples/flowsheets/case_studies/wastewater_resource_recovery.

ksbeattie commented 1 year ago

This should use argparse, simplifying main in each script and they should be added to the tests.

lbianchi-lbl commented 1 year ago

Just checked on Codecov and the argument-parsing part of the code is indeed currently untested:

image

adam-a-a commented 1 year ago

@dangunter you mentioned a solution which included argparse, but I wasn't sure about this... here's a snapshot of the code now: image

lbianchi-lbl commented 1 year ago

@adam-a-a The argparse tutorial from the Python docs could be a good starting point as the example they use looks fairly similar to that code.

adam-a-a commented 1 year ago

Thanks, @lbianchi-lbl - I probably won't be able to get to this for some time (as simple as it may be) but will add it to the list.