intake / intake-xarray

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

AttributeError: 'NetCDFSource' object has no attribute 'pattern' #142

Open wachsylon opened 6 months ago

wachsylon commented 6 months ago

I think self.pattern needs to be changed into self.path_as_pattern:

https://github.com/intake/intake-xarray/blob/d0418f787181d638629b76c2982a9a215a3697be/intake_xarray/netcdf.py#L73

I run into the issue with a simple

sources:
  2D_const_0.25deg:
    description: 2D constant variables from IFS-AMIP
    driver: netcdf
    args:
      urlpath: "/work/bk1377/b382473/IFS_AMIP/prepIFS/OSTIA/gribscan/2D_const_0.25deg/*.grib"
      xarray_kwargs:
        engine: cfgrib

catalog.

garciampred commented 4 months ago

I think this pattern property used to be defined in the PatternMixin (https://github.com/intake/intake/blob/12ce9abc1611b8612b4a741fc1e0f106058ebbaa/intake/source/base.py), but this mixin seems to be empty in the last versions.

martindurant commented 4 months ago

Correct, Intake 2 readers are by design much simpler than the previous iteration, to encourage the creation of many many readers. In so doing, some complex functionality has been lost. Of course, there's nothing to stop you using intake<2, and the same effect can still be achieved in V2 too (see e.g., DaskCSVPattern for csvs).