thouska / spotpy

A Statistical Parameter Optimization Tool
https://spotpy.readthedocs.io/en/latest/
MIT License
256 stars 152 forks source link

Unified command line interface #139

Open philippkraft opened 6 years ago

philippkraft commented 6 years ago

It would be nice to be able to set the sampler arguments with command line options. All we need is a module using the argparse module. Proposed usage in code:

if __name__ == '__main__':
    model = spot_setup()
    sampler = spotpy.cli(model)

Usage exampler from the command line

$ python tutorial_cmf_lumped.py --sampler lhs --runs 1000 --dbname lumped_output --dbformat csv --parallel seq
$ python tutorial_cmf_lumped.py lhs -n 1000 -o lumped_output -f csv -p seq

Even better if all options can also be set via environmental variables, eg. SPOTPY_SAMPLER, SPOTPY_RUNS

havanagrawal commented 6 years ago

I'd like to work on this please!

philippkraft commented 6 years ago

Would be super - I don't have the time for it. How about an early WIP pull request, for a joint discussion on the design and naming?

In fact, this idea was inspired by #120 and my clumsy pseudo interface in spot_setup_cmf_lumped.py (I made real argparseinterfaces in the past, they work well but not easy to make in a hurry).

A third configuration source could be a configuration file.

thouska commented 6 years ago

The Command Line Interface should be available now, general use can be found in #174. Whats still missing is a short explanation in the documentation, which is why I leave this issue open.