# Intake warning

**URL:** https://forum.access-hive.org.au/t/intake-warning/4376
**Category:** Technical
**Tags:** help, intake
**Created:** [2 April 2025 04:18 UTC](https://forum.access-hive.org.au/t/intake-warning/4376 "2025-04-02T04:18:39Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![JuliaN](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@JuliaN](https://forum.access-hive.org.au/u/JuliaN)
#### Post date: [2 April 2025 04:18 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/1 "2025-04-02T04:18:39Z")

</div>

I’m using the latest version of intake in `xp65` for the first time. Can someone help me silence this warning when using the `.search()` function?

```auto
/g/data/xp65/public/apps/med_conda/envs/analysis3-25.02/lib/python3.11/site-packages/intake_esm/source.py:82: 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.

```

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [2 April 2025 04:34 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/2 "2025-04-02T04:34:38Z")

</div>

Hi @JuliaN  
A simple way to filter that would be to add:

```py
import warnings
warnings.simplefilter('ignore', FutureWarning)

```

at the top of your script, or before you use the intake catalog command that spawns the warning.  
If you want to ignore that only for certain lines, you can instead do:

```py
with warnings.catch_warnings():
    warnings.simplefilter("ignore", FutureWarning)
    ... # Lines that would generate a FutureWarning

```

Cheers  
Davide

---

<div class="post-metadata">

### Author: ![JuliaN](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@JuliaN](https://forum.access-hive.org.au/u/JuliaN)
#### Post date: [2 April 2025 04:36 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/3 "2025-04-02T04:36:31Z")

</div>

> [@atteggiani](#):
>
> ```auto
> import warnings
> warnings.simplefilter('ignore', FutureWarning)
> 
> ```

Hi Davide! Yes, I already have the warnings filter in my script but it does nothing ☹

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [2 April 2025 04:54 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/4 "2025-04-02T04:54:10Z")

</div>

Hmm not sure why this is not working, there might be a few reasons though.

Can you please post the lines of code that you are running and that spawn the warning?

---

<div class="post-metadata">

### Author: ![JuliaN](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@JuliaN](https://forum.access-hive.org.au/u/JuliaN)
#### Post date: [2 April 2025 04:56 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/5 "2025-04-02T04:56:27Z")

</div>

Sure:

```auto
import intake
import xarray as xr

catalog = intake.cat.access_nri
exp = "01deg_jra55v140_iaf_cycle3"
data = catalog[exp].search(variable = 'tx_trans_int_z', frequency = '1mon').to_dask()

```

My ignorant 2 cents is that this has to be silenced/fixed in the intake source (?) code.

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [2 April 2025 05:24 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/6 "2025-04-02T05:24:49Z")

</div>

Which `xp65` environment are you using?  
Using `conda/analysis3-24.11` the code you referenced fails:

```auto
Failed to load dataset with key='ocean_2d_tx_trans_int_z_1_monthly_mean_ym_XXXX_XX.1mon'

```

---

<div class="post-metadata">

### Author: ![JuliaN](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@JuliaN](https://forum.access-hive.org.au/u/JuliaN)
#### Post date: [2 April 2025 05:29 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/7 "2025-04-02T05:29:25Z")

</div>

I am using 25.02 as per [21st Feb 2025 - Building and Using Intake Datastores](https://forum.access-hive.org.au/t/21st-feb-2025-building-and-using-intake-datastores/4185)

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [2 April 2025 05:45 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/8 "2025-04-02T05:45:52Z")

</div>

Hmm, I am sorry but also with `conda/analysis3-25.02` the code you referenced above is still failing for me:

```auto
File "/g/data/xp65/public/apps/med_conda/envs/analysis3-25.02/lib/python3.11/site-packages/intake_esm/source.py", line 292, in _open_dataset
    raise ESMDataSourceError(
intake_esm.source.ESMDataSourceError: Failed to load dataset with key='ocean_2d_tx_trans_int_z_1_monthly_mean_ym_XXXX_XX.1mon'
                 You can use `cat['ocean_2d_tx_trans_int_z_1_monthly_mean_ym_XXXX_XX.1mon'].df` to inspect the assets/files for this key.

```

I am not sure I will be able to help you if I cannot reproduce the warning, sorry.

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [2 April 2025 05:53 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/9 "2025-04-02T05:53:47Z")

</div>

It might be because I don’t have access to `cj50`.  
I requested it in case.

---

<div class="post-metadata">

### Author: ![JuliaN](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@JuliaN](https://forum.access-hive.org.au/u/JuliaN)
#### Post date: [2 April 2025 05:53 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/10 "2025-04-02T05:53:57Z")

</div>

ok, no worries! I wonder if maybe you are missing access to projects.

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [2 April 2025 05:55 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/11 "2025-04-02T05:55:10Z")

</div>

The error here is not of the most friendly!  
As soon as I’ll get approved I’ll try again 😃

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [2 April 2025 06:02 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/12 "2025-04-02T06:02:30Z")

</div>

Ok I got approved at a speedy time.

I can confirm the following:

```py
import intake
import xarray as xr
import warnings

catalog = intake.cat.access_nri
exp = "01deg_jra55v140_iaf_cycle3"
with warnings.catch_warnings():
    warnings.simplefilter("ignore", FutureWarning)
    data = catalog[exp].search(variable = 'tx_trans_int_z', frequency = '1mon').to_dask()

```

doesn’t spawn any warning for me.

---

<div class="post-metadata">

### Author: ![JuliaN](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@JuliaN](https://forum.access-hive.org.au/u/JuliaN)
#### Post date: [2 April 2025 06:05 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/13 "2025-04-02T06:05:54Z")

</div>

> [@atteggiani](#):
>
> ```auto
> with warnings.catch_warnings():
> warnings.simplefilter("ignore", FutureWarning)
> 
> ```

Wow, so strange!

 ![image](https://us1.discourse-cdn.com/flex020/uploads/access1/original/2X/c/ce279dc4065a605e734f2b295fe2ea3eafe08ef4.png)

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [2 April 2025 06:22 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/14 "2025-04-02T06:22:20Z")

</div>

This is so weird.  
I’m not using ARE, and from the terminal it works correctly (note the second time if I issue the command without warning filter it spawns the warnings)

 ![Screenshot 2025-04-02 at 5.21.11 pm](https://us1.discourse-cdn.com/flex020/uploads/access1/original/2X/c/c10dc938949efd3dfb457d45999a5aa9285ecea1.jpeg)

Not really sure what’s going on here, sorry

---

<div class="post-metadata">

### Author: ![JuliaN](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@JuliaN](https://forum.access-hive.org.au/u/JuliaN)
#### Post date: [2 April 2025 06:29 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/15 "2025-04-02T06:29:41Z")

</div>

> [@atteggiani](#):
>
> ```auto
> with warnings.catch_warnings():
> warnings.simplefilter("ignore", FutureWarning)
> 
> ```

Right, I think it is because I had a dask client open:

```auto
from dask.distributed import Client
client = Client(threads_per_worker=1)

```

without the client the warning suppression works! Although I would like to keep using dask..

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [2 April 2025 06:33 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/16 "2025-04-02T06:33:03Z")

</div>

Ah!  
Yes dask clients have their own way to manage warnings.  
You can see a related approach to remove warnings with the dask client enabled [here](https://forum.access-hive.org.au/t/xarray-warnings-while-loading-data-using-cosima-cookbook/2169/7). Maybe a related approach would work in your case too.

---

<div class="post-metadata">

### Author: ![JuliaN](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@JuliaN](https://forum.access-hive.org.au/u/JuliaN)
#### Post date: [2 April 2025 06:34 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/17 "2025-04-02T06:34:24Z")

</div>

Ok, awesome ! I’ll check it out tomorrow. Sorry for taking up your time 🙄 should have added the client at the beginning

---

<div class="post-metadata">

### Author: ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)
#### Post date: [2 April 2025 06:36 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/18 "2025-04-02T06:36:02Z")

</div>

It’s all good!  
This forum exists exactly for these issues 🙂

---

<div class="post-metadata">

### Author: ![JuliaN](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@JuliaN](https://forum.access-hive.org.au/u/JuliaN)
#### Post date: [2 April 2025 23:03 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/19 "2025-04-02T23:03:32Z")

</div>

Haha sorry, I’ve tried that solution and it didn’t work either ☹ This is the minimal working example:

```auto
import intake
import xarray as xr

import warnings # ignore these warnings
warnings.filterwarnings("ignore", category = FutureWarning)
warnings.filterwarnings("ignore", category = UserWarning)
warnings.filterwarnings("ignore", category = RuntimeWarning)

from dask.distributed.diagnostics.plugin import WorkerPlugin
class CaptureWarningsPlugin(WorkerPlugin):
    def setup(self,worker):
        logging.captureWarnings(True)
    def teardown(self,worker):
        logging.captureWarnings(False)
        
from dask.distributed import Client
client = Client(threads_per_worker=1)
client.register_worker_plugin(CaptureWarningsPlugin())

catalog = intake.cat.access_nri
exp = "01deg_jra55v140_iaf_cycle3"

data = catalog[exp].search(variable = 'tx_trans_int_z', frequency = '1mon').to_dask()
```

---

<div class="post-metadata">

### Author: ![CharlesTurner](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/charlesturner/32/2518_2.png) [@CharlesTurner](https://forum.access-hive.org.au/u/CharlesTurner)
#### Post date: [3 April 2025 01:52 UTC](https://forum.access-hive.org.au/t/intake-warning/4376/20 "2025-04-03T01:52:34Z")

</div>

Hi @JuliaN,

This warning

```python
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

```python
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

> [@JuliaN](#):
>
> My ignorant 2 cents is that this has to be silenced/fixed in the intake source (?) code.

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

```python
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:

 ![Screenshot 2025-04-03 at 9.45.28 am](https://us1.discourse-cdn.com/flex020/uploads/access1/original/2X/d/d3d10febf81b0f25308f396342643d82e3a0e7be.png)

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.

[Next page](https://forum.access-hive.org.au/t/intake-warning/4376.md?page=2)
