thouska / spotpy

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

Feature Request: Silent spotpy call #239

Open florianjehn opened 4 years ago

florianjehn commented 4 years ago

Spotpy prints out a lot of things each time you create a new sampler and run it. This is useful if you want to run one model several times, however it slows down things considerably when you want to run a lot of models after another. It would be useful if you could provide spotpy with keywords that silences this output.

MuellerSeb commented 4 years ago

A good idea would be to include a verbose keyword-argument here:

https://github.com/thouska/spotpy/blob/34d1ad306b6f2f8faa95f010e6c4db98be76efaa/spotpy/algorithms/_algorithm.py#L211

which is True by default, so everything will work as usual.

Then every print statement has to be hunt down and should be equipped with:

if self.verbose:
    print(statement)

My two cents. Cheers, Sebastian

philippkraft commented 4 years ago

Better solution in my opinion: Search for all print functions and exchange them with logging.info, logging.warning, logging.error and logging.debug, depending on the importance of the message. That is the way how libraries like spotpyshould communicate with the user. I wish we knew about this, when we started. The user can then change the logging level with logging.basicConfig. See: https://docs.python.org/3/library/logging.html

cpwnd commented 4 years ago

I opened a pull request #244 and hope it could help to solve this issue.