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

Print Statement Suppression #77

Closed
jejjohnson opened this issue Nov 21, 2019 · 3 comments
Closed

Print Statement Suppression #77

jejjohnson opened this issue Nov 21, 2019 · 3 comments

Comments

@jejjohnson
Copy link

Hi,

First of all, I really like this package. Thank you for making it easier for beginners to use regrid functions without all of the boilerplate stuff that's needed. Super useful.

I was wondering if there was a way to suppress the print statements of the regridding method? Perhaps we can add a verbose argument if such a way doesn't already exists?

Example

** Code snippet to reproduce **

reference_ds = gpp_data_low
method = 'nearest_s2d'

# initialize regridder
regridder = xe.Regridder(
    gpp_data_hi,       # DataArray to be converted
    gpp_data_low,      # reference DataArray
    method=method,
)

# regrid new dataset
gpp_new = regridder(gpp_data_hi.compute())

** Output **

Overwrite existing file: nearest_s2d_432x936_144x312.nc 
 You can set reuse_weights=True to save computing time.

Expected Behavior

Nothing unless prompted.

System information

Please complete the following information:

  • xemsf Version 0.2.1
  • Python Version 3.7
  • Ubuntu 18.04.3 LTS
@JiaweiZhuang
Copy link
Owner

Glad that you find xesmf useful!

One possible fix is to change print to warnings.warn, which can be disabled by warnings.filters.

Such printing will no longer exist with the new regridder save-load API #75, so the current sub-optimal API is probably not worth fixing...

@jejjohnson
Copy link
Author

Thank you for the response! I agree; since the API will change then it's probably not worth fixing.

Thank you again!

@hdrake
Copy link

hdrake commented Mar 6, 2020

I found this as a neat temporary solution for suppressing print statements from regridder until the API changes go through.

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

No branches or pull requests

3 participants