I just miss type, I wanted to say cfgrib instead of cfdisk. The goal here was to try makes _get_default_engine_grib returning cfgrib to see what happen but it ended with a key error as cfgrib isn't in the writeable_store.
Best regards, Fabrice On Fri, 27 Mar 2020 13:13:32 +0000 Alastair McKinstry <alastair.mckins...@sceal.ie> wrote: > 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)