Hi, I shall forward to upstream. It does appear that setting engine=cfgrib should not be necessary if the file is a grib file (by extension) and cfgrib is present.
I Agree with your point on writable_stores / cfdisk. Best regards Alastair On 27/03/2020 12:44, Fabrice Meyer wrote: > Just adding a detail, to avoid messing with xarray code, you just need > to call to_netcdf with an engine define in your parameters. It is just > the default engine selection which appears to be broken on this version > of xarray (and also in stable). > > Regards > > > Le 26/03/2020 à 21:07, Fabrice Meyer a écrit : >> Package: python3-xarray >> Version: 0.15.0-3 >> Severity: important >> >> Dear Maintainer, >> >> I was trying to use to_netcdf() located in >> /usr/lib/python3/dist-packages/xarray/backends/api.py on a grib file without >> specifying the engine and it appears that the default engine selection end >> up on grib engine. >> >> So _get_default_engine calls _get_default_engine_grib as we have a grib file >> but this function always raise a ValueError even if cfgrib import succeed >> but anyway, there is a real issue with this function as it is returning >> nothing while _get_default_engine is expecting an engine. >> If we try to, somehow, makes _get_default_engine_grib return cfdisk as >> engine, it will still fail as cfgrib is absent of the WRITEABLE_STORES >> bellow but even if it would have been present, cfgrib does not implement a >> writeable store. >> >> WRITEABLE_STORES: Dict[str, Callable] = { >> "netcdf4": backends.NetCDF4DataStore.open, >> "scipy": backends.ScipyDataStore, >> "h5netcdf": backends.H5NetCDFStore.open, >> } >> >> I'm quite new dealing with xarray but I think grib engine seems to be on >> work in progress or something and doesn't look ready yet. >> >> In order to get the job done, I tryed to make _get_default_engine_grib >> returning "netcdf4" based on observation on an older implementation of >> xarray (0.10.2-1). This "hack" worked but it is really dirty. >> >> Could you please dig a bit more and fix this issue? >> >> Best regards, and thank you for all job done maintaining theses packages. >> >> >> -- System Information: >> Debian Release: bullseye/sid >> APT prefers stable-updates >> APT policy: (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), >> (500, 'stable') >> Architecture: amd64 (x86_64) >> >> Kernel: Linux 4.19.0-8-amd64 (SMP w/1 CPU core) >> Kernel taint flags: TAINT_CRAP >> Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), >> LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8) >> Shell: /bin/sh linked to /bin/dash >> Init: systemd (via /run/systemd/system) >> LSM: AppArmor: enabled >> >> Versions of packages python3-xarray depends on: >> ii python3 3.8.2-2 >> ii python3-numpy 1:1.17.4-5 >> ii python3-pandas 0.25.3+dfsg-7 >> >> Versions of packages python3-xarray recommends: >> ii python3-bottleneck 1.2.1+ds1-2+b1 >> ii python3-dask 2.11.0+dfsg-1 >> ii python3-h5netcdf 0.7.1-1 >> ii python3-netcdf4 1.5.3-1+b2 >> ii python3-zarr 2.4.0+ds-1 >> >> Versions of packages python3-xarray suggests: >> pn python-xarray-doc <none> >> pn python3-cartopy <none> >> ii python3-matplotlib 3.2.1-1 >> pn python3-pydap <none> >> pn python3-rasterio <none> >> ii python3-scipy 1.3.3-3 >> pn python3-seaborn <none> >> ii python3-toolz 0.9.0-1 >> >> -- no debconf information -- Alastair McKinstry, email: alast...@sceal.ie, matrix: @alastair:sceal.ie, phone: 087-6847928 Green Party Councillor, Galway County Council