intake / intake-xarray

Intake plugin for xarray
https://intake-xarray.readthedocs.io/
BSD 2-Clause "Simplified" License
74 stars 36 forks source link

Module not found error for intake=2.0.1 #141

Open roxyboy opened 6 months ago

roxyboy commented 6 months ago

Hi intake_xarray developers,

I've encountered an error when the version of intake is 2.0.1 where intake_xarray doesn't seem to recognize intake. When I reverted to intake=0.6.8, everything seemed to work fine again.

martindurant commented 6 months ago

Intake >2 is a major rewrite of intake, so you are welcome to pin to an earlier version. However, we still aim for backward compatibility, so if you could please specify in what manner intake is not recognised. Do you have an exception/stack-trace?

johnkit commented 6 months ago

Here is an example that works with intake 0.7 but not 2.0. Is it possible there's an issue with the yaml file itself?

Source:

import intake
print(f'intake version: {intake.__version__}')
import intake_xarray
print(f'intake_xarray version: {intake_xarray.__version__}')
cat_url = 'https://raw.githubusercontent.com/pangeo-data/pangeo-datastore/master/intake-catalogs/ocean.yaml'
cat = intake.open_catalog(cat_url)

Output:

intake version: 2.0.3
intake_xarray version: 0.7.0
Traceback (most recent call last):
  File "/home/local/KHQ/john.tourtellott/projects/pan3d/git/pan3d/example.py", line 7, in <module>
    cat = intake.open_catalog(cat_url)
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/__init__.py", line 184, in open_catalog
    return registry[driver](uri, **kwargs)
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/catalog/local.py", line 613, in __init__
    super(YAMLFileCatalog, self).__init__(**kwargs)
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/catalog/base.py", line 128, in __init__
    self.force_reload()
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/catalog/base.py", line 186, in force_reload
    self._load()
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/catalog/local.py", line 648, in _load
    self.parse(text)
  File "/home/local/KHQ/john.tourtellott/.py3-venv/pan3d/lib/python3.9/site-packages/intake/catalog/local.py", line 728, in parse
    raise exceptions.ValidationError(
intake.catalog.exceptions.ValidationError: Catalog 'https://raw.githubusercontent.com/pangeo-data/pangeo-datastore/master/intake-catalogs/ocean.yaml' has validation errors:

("missing 'module'", {'module': 'intake_xarray'})
martindurant commented 6 months ago

This should be fixed on intake master, if you wouldn't mind checking

johnkit commented 6 months ago

Yes - I confirmed that intake:master can now read that catalog. Many thanks.

So after loading that catalog, I was expecting to find attributes cat.data, cat.entries, cat.aliases, cat.user_parameters, but they aren't there. I am new to intake so perhaps I misunderstand the user docs?

martindurant commented 6 months ago

This is a V1 catalog, and we don't yet have a conversion utility. However the entries are function I think:

list(cat)  # names of datasets
cat.sea_surface_height.to_dask()  # open one of them
johnkit commented 6 months ago

Oh, right. I was applying v2 docs to V1 catalog. Thanks again. I really appreciate your quick response on this.