intake-xarray icon indicating copy to clipboard operation
intake-xarray copied to clipboard

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

Open wachsylon opened this issue 1 year ago • 2 comments

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.

wachsylon avatar Mar 01 '24 11:03 wachsylon

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.

garciampred avatar Apr 19 '24 07:04 garciampred

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).

martindurant avatar Apr 19 '24 20:04 martindurant