xdem icon indicating copy to clipboard operation
xdem copied to clipboard

Silent richdem's messages in xdem.terrain?

Open adehecq opened this issue 1 year ago • 2 comments

When calculating terrain attributes with richdem, the function prints the reference to Horn et al each time. Is there a way to silent it? I don't think it's straightforward as from what I remember it's a print statement from the C code underneath...

adehecq avatar May 03 '23 14:05 adehecq

Actually, here's a solution that I implemented in some personal code, using a piece of @rhugonnet's code here and then:

with stdout_redirected(), merged_stderr_stdout(): 
    slope, maxc = xdem.terrain.get_terrain_attribute(dem=refdem_proj, attribute=["slope", "maximum_curvature"], use_richdem=True) 

adehecq avatar May 31 '23 14:05 adehecq

In case the previous solution does not work, here is another one from the richdem issues: https://github.com/r-barnes/richdem/issues/57

adehecq avatar Dec 18 '23 09:12 adehecq