question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

If opening with xarray open_mfdataset and parallel=True it will fail unless you have previously opened it with parallel=False

See original GitHub issue

Minimal repro:

import xarray as xr
ds = xr.open_mfdataset('gfs.0p25.201511*00.f0*.grib2', engine='cfgrib', combine='nested', concat_dim=['step'], parallel=True, chunks=24, backend_kwargs={'filter_by_keys': {'typeOfLevel': 'surface'}, 'indexpath': ''})

Expected result: returns xarray Actual result:

ECCODES ERROR   :  grib_handle_create: cannot create handle, no definitions found
ecCodes assertion failed: `h' in /home/conda/feedstock_root/build_artifacts/eccodes_1570714279314/work/src/grib_query.c:529

Note if in the same session/kernel you have previously opened with parallel=False the above will pass. The repro needs to happen in a new session. This was executed on a local dask cluster.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:21 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
alexamicicommented, Nov 11, 2019

I confirm this bug report with a different dataset and different error messages.

With parallel=False open_mfdataset always work:

>>> import cfgrib
>>> import xarray as xr
>>> print(xr.__version__, cfgrib.__version__)
0.13.0 0.9.7.4.dev0
>>> ds = xr.open_mfdataset('step*.grib', engine='cfgrib', concat_dim=['step'], combine='nested', parallel=False)
>>> ds
<xarray.Dataset>
Dimensions:     (latitude: 1801, longitude: 3600, step: 3)
Coordinates:
    time        datetime64[ns] 2019-04-01
    number      int64 0
    surface     int64 0
  * latitude    (latitude) float64 90.0 89.9 89.8 89.7 ... -89.8 -89.9 -90.0
  * longitude   (longitude) float64 0.0 0.1 0.2 0.3 ... 359.6 359.7 359.8 359.9
  * step        (step) timedelta64[ns] 01:00:00 02:00:00 03:00:00
    valid_time  (step) datetime64[ns] 2019-04-01T01:00:00 ... 2019-04-01T03:00:00
Data variables:
    t2m         (step, latitude, longitude) float32 dask.array<chunksize=(1, 1801, 3600), meta=np.ndarray>
Attributes:
    GRIB_edition:            1
    GRIB_centre:             ecmf
    GRIB_centreDescription:  European Centre for Medium-Range Weather Forecasts
    GRIB_subCentre:          0
    Conventions:             CF-1.7
    institution:             European Centre for Medium-Range Weather Forecasts
    history:                 2019-11-11T19:19:05 GRIB to CDM+CF via cfgrib-0....

Restarting the kernel and running with parallel=True always crashes python inside ecCodes but it returns a few different error messages. I observed at leat:

ECCODES ERROR   :  Unable to find boot.def. Context path=/Users/amici/.conda/envs/ECM/share/eccodes/definitions

Possible causes:
- The software is not correctly installed
- The environment variable ECCODES_DEFINITION_PATH is defined but incorrect

ecCodes assertion failed: `0' in /usr/local/miniconda/conda-bld/eccodes_1566402639979/work/src/grib_context.c:205
ECCODES ERROR   :  grib_handle_create: cannot create handle, no definitions found
ecCodes assertion failed: `h' in /usr/local/miniconda/conda-bld/eccodes_1566402639979/work/src/grib_query.c:458
ECCODES ERROR   :  grib_parser: syntax error at line 34 of /Users/amici/.conda/envs/ECM/share/eccodes/definitions/boot.def
ECCODES ERROR   :  ecCodes Version: 2.13.1

and

ECCODES ERROR   :  ecCodes Version: 2.13.1
ecCodes Version:       2.13.1
Definition files path: /Users/amici/.conda/envs/ECM/share/eccodes/definitions
ECCODES ERROR   :  grib_parser_include: Could not resolve 'ECCODES_USE_' (included in /Users/amici/.conda/envs/ECM/share/eccodes/definitions/boot.def)
ecCodes assertion failed: `0' in /usr/local/miniconda/conda-bld/eccodes_1566402639979/work/src/grib_context.c:205

It looks like a locking/threading problem, @shahramn do you have any hint?

1reaction
iainrussellcommented, Oct 13, 2020

Hi @guidocioni , I’m not sure if you’re on macos or Linux, but we’ve managed to update the conda version. Could you do the following: conda search eccodes -c conda-forge and if you see a 2.18.0 version with _1 at the end, install that version please. It takes the conda servers a little while to update their indexes, but it’s appeared now at least on macos.

Read more comments on GitHub >

github_iconTop Results From Across the Web

xarray.open_mfdataset
Open multiple files as a single dataset. ... You only need to provide this argument if combine='nested' , and if any of the...
Read more >
open_mfdataset with xarray failing to find coordinates
These netcdf files have a coordinate t that is the time stamp that I'm trying to use as a joining but I'm getting...
Read more >
performance issues with open_mfdataset - Google Groups
The scenario is the following: I have a collection of large netCDF files on a ... I want to open the data as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found