Hi @JuliaN,
This warning
FutureWarning: In a future version of xarray decode_timedelta will default to False rather than None. To silence this warning, set decode_timedelta to True, False, or a 'CFTimedeltaCoder' instance.
comes from xarray, and is basically due to them changing a default from None to False. You can silence it with
data = catalog[exp].search(
variable='tx_trans_int_z', frequency='1mon'
).to_dask(
xarray_open_kwargs = {"decode_timedelta" : False}
)
This won’t change any behaviour & will silence the warnings.
Some more bits & pieces of relevant info
You are (very nearly) correct - it needs fixing in intake-ESM - we’ve actually already merged the fix, but we haven’t updated the environment with the fix yet.
Regarding silencing warnings when we have threads on the go, I’m yet to find a good way to do this.
Setting
warnings.simplefilter("ignore")
os.environ["PYTHONWARNINGS"] = "ignore"
before you initialise any threads (ie. open a Dask Client) seems to work, but I think I’ve found it a little unreliable - it needs to go right at the start of the notebook. You can make it reliably crush the warnings by setting it in the environment variables section of an ARE Session:
However, I wouldn’t recommend doing this - it’ll turn off all warnings for the ARE Session, which might include important ones.
In general, warnings are important information that things aren’t behaving as they should (although not badly enough to warrant crashing the program), and turning them off leaves you open to subtle bugs.
EDIT:
I just reread this & I just want to be explicit: I’m not anti capturing warnings in specific instances, as suggested by @atteggiani (eg. with warnings.catch_warnings
).
However, disabling all warnings for the entire python session is a really bad idea, in my opinion. If it does come to disabling warnings like this, I’d suggest using PYTHONWARNINGS="once"
instead, which should suppress subsequent warnings of the same kind. This is a bit safer.