hainegroup / oceanspy

A Python package to facilitate ocean model data analysis and visualization.
https://oceanspy.readthedocs.io
MIT License
96 stars 32 forks source link

pin intake < 2.0.0 ? #415

Closed Mikejmnez closed 4 months ago

Mikejmnez commented 4 months ago

see PR #413

Intake is experiencing major version upgrade, Intake Take2, which is breaking some old "deprecated" behavior. There is some description in their documentation here: https://intake.readthedocs.io/en/latest/index.html about how best migrate from v1 to v2. I will spend some time looking into this...

How is this affecting us.

For oceanspy, the following old behavior is no longer accepted.

example

Consider an yaml file with the following entries:

plugins:
  source:
    - module: intake_xarray
sources:

  UVEL_LLC:
    description: Test ECCO data
    driver: netcdf
    args:
      urlpath: 'oceanspy/tests/Data/ECCO_v4/UVEL/UVEL_1992_01.nc'
      xarray_kwargs:
        engine: netcdf4
        drop_variables: ['time_bnds']
    metadata:
      swap_dims:
        k: Z
      rename:
        i_g: Xp1
        j: Y
        tile: face
        UVEL: U
      model: MITGCM

  VVEL_LLC:
    description: Test ECCO data
    driver: netcdf
    args:
      urlpath: 'oceanspy/tests/Data/ECCO_v4/VVEL/VVEL_1992_01.nc'
      xarray_kwargs:
        engine: netcdf4
        drop_variables: ['time_bnds']
    metadata:
      swap_dims:
        k: Z
      rename:
        i: X
        j_g: Yp1
        tile: face
        VVEL: V

with with intake version < 2.0.0:

from oceanspy.open_oceandataset import _find_entries
cat, entries, url, intake_switch = _find_entries("LLC", ECCO_url)  # calls intake inside here

works, with len(entries)==2.0.0.

Now with intake version >= 2.0.0

ValueError: [LLC] is not in the catalog.

This is what is causing CI failure in #413 .

I will spend some time looking into this new behavior. It shouldn't require much rework. If for any reason it does require some involved work, then the easiest thing for now will be to pin intake < 2.0.0.

Mikejmnez commented 4 months ago

I had some time now to look into this. Looks like a really easy fix. For more context, the exact line that is causing issue in the yaml. file is the top (see also example above):

plugins:
  source:
    - module: intake_xarray

After commenting/removing the snippet above the issue goes away and the expected behavior occurs. This is with intake.__version__ >= 2. Removing the same snippet with an older version of intake DID NOT cause any issues.

take home message

Commenting the plugin/module definition above allows us to safely remove the pin on intake.

Mikejmnez commented 4 months ago

closed by #423