Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pygrib from conda-forge: segmentation fault #86

Open
MorningGlory747 opened this issue Aug 15, 2018 · 3 comments
Open

Pygrib from conda-forge: segmentation fault #86

MorningGlory747 opened this issue Aug 15, 2018 · 3 comments

Comments

@MorningGlory747
Copy link

Greetings,

I'm currently trying to open .grib2 files downloaded from Environment Canada which are publicly available meteorological data. I've downloaded pygrib from the anaconda cloud (see link: https://anaconda.org/conda-forge/pygrib). For this installation, all I've did was to type the conda forge download command inside the anaconda prompt and it said that the module was downloaded without error.

However, when trying to manipulate the grib file in pyhton, I will get segmentation faults when executing commands that seem to require a lot of effort. For example, I can do without error:
import pygrib
grbs = pygrib.open(filename)
grb = grbs.readline()
lats,lons = grb.latlons()

But it will crash for commands such as
data,lats,lons = grb.data(lat1=20,lat2=45,lon1=220,lon2=320)
and
maxt = grb.values

Would this be because I decided to use conda-forge to download pygrid instead of following the 'normal procedure' as instructed by what’s shown in here: https://github.com/jswhit/pygrib?

I'm using pygrib 2.0.2 on a python 3.6 which was loaded from anaconda 4.5.10 on a VM ubuntu.

Thank you!

@jswhit
Copy link
Owner

jswhit commented Aug 15, 2018

Can you post the grib file and the sample script somewhere so we can try to reproduce the error? (If the file is small enough you can upload it here in a tar file)

@weatherbell
Copy link

Hi all,

We encountered this same problem, albeit, this was not an issue with pygrib itself, but with ECCODES and/or a library on our system. The issue can be recreated with any hrdps file from Environment Canada on an intel-python3 docker image, with pygrib and eccodes installed via conda.

We discovered that while trying to read from the grib file, the stack filled up for the process and resulted in a segfault. Increasing the stack size ulimit solved our problem. We do NOT experience this issue with any other grib data, even data from the gem or rgem, it seems unique. Hopefully this helps!

@fmetdotmetoc
Copy link

The solution to the Environment Canada GRB2 files is to use something like wgrib2 to -set_grib_type to "simple" or "jpeg" rather than "complex1" "complex2" or "complex3".
Example: wgrib2 myfilewithsegfaulterror.grb2 -set_grib_type jpeg -grib_out mysuccess.grb2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants