Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silent=True not suppressing messages #55

Closed
helsharif opened this issue Jan 16, 2024 · 7 comments · Fixed by #63 or #71
Closed

silent=True not suppressing messages #55

helsharif opened this issue Jan 16, 2024 · 7 comments · Fixed by #63 or #71

Comments

@helsharif
Copy link

Hello,
In using pixel_overlaps and aggregate functions I include silent=True, but I still get the same messages printed to the screen whether I include that or not. I was expecting for there to be no output to screen.

@helsharif
Copy link
Author

Hello,
Below I'm adding a screenshot of the warning messages I get when running pixel_overlaps and aggregate even with silent=True

image

@ks905383
Copy link
Owner

ks905383 commented Jan 26, 2024

Yeah fair -

Looks like there are a few causes of that

  1. Use of .dims instead of .sizes (easy enough to fix)
  2. Not suppressing the print() calls
  3. That one xagg warning as well.

I'll see if I can fix that in the next version.

In the interim,

import warnings
with warnings.catch_warnings():
    warnings.filterwarnings('ignore')
    [xagg code here]

Should get rid of at least the warnings.

ks905383 added a commit that referenced this issue Feb 13, 2024
Closes #55 by making silent=True silence all std out
@ks905383
Copy link
Owner

#63 (comment)

One subfunction still doesn't have silent piped into it. This is through this line

ds = subset_find(ds,wm.source_grid)
, which should have silent=silent show up in the subset_find() call.

@helsharif can you confirm this is the only place where silent=True is still not producing the desired results?

@ks905383 ks905383 reopened this Feb 20, 2024
@helsharif
Copy link
Author

Hi, yes I confirm. It seems like the other warning messages have gone away with the latest version. The only messages I still see are:
"adjusting grid... (this may happen because only a subset of pixels were used for aggregation for efficiency - i.e. [subset_bbox=True] in xa.pixel_overlaps())"
and
"grid adjustment successful"

@ks905383
Copy link
Owner

ks905383 commented Jun 4, 2024

@helsharif sorry for the delay - I think it should now be fixed in v0.3.2.1. You can also now set silent=True as a global option with

xa.set_options(silent=True).

Let me know if it doesn't work!

@helsharif
Copy link
Author

Thanks! Yes it is working and the extra messages are suppressed. I just started a new project that involves a lot of use of xagg today, so this is a big help! Best regards. I think it is safe to close this thread.

@helsharif
Copy link
Author

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants