r-barnes / richdem

High-performance Terrain and Hydrology Analysis
GNU General Public License v3.0
272 stars 70 forks source link

Suppressing log messages #39

Open dzanaga opened 4 years ago

dzanaga commented 4 years ago

Is there a way to suppress the log messages?

I am using richdem to perform calculations on a lot of small locations in a loop. As a result I get very verbose logs from richdem with a progress bar and the citation string. This is a bit annoying when I collect the logs and check them after large jobs on a cluster. Is there an option to turn of log messages from the C libs when using the python api? a sort of --verbose 0.

This is what I am using:

    rda = rd.rdarray(dem_arr, no_data=-9999)
    with HiddenPrints():
        attrs = [rd.TerrainAttribute(rda, attrib=attr) for attr in attributes]
    return attrs

HiddenPrints suppresses those from python already.

parbelet commented 3 years ago

That'd be great indeed!

giswqs commented 3 years ago

Try the ipywidgets Output widget to collect and hide logs

https://ipywidgets.readthedocs.io/en/latest/examples/Output%20Widget.html