Skip to content

segmentation fault with open_mfdataset #444

@razcore-rad

Description

@razcore-rad

This is super strange. Does anyone have any idea why a segmentation fault might be happening here?

Python 3.4.3 (default, Jun 26 2015, 00:02:21) 
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xray
>>> xray.open_mfdataset('2*.nc', concat_dim='time')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/ichec/home/users/razvan/.local/lib/python3.4/site-packages/xray/backends/api.py", line 205, in open_mfdataset
Segmentation fault (core dumped)

I stay it's strange because I ended up tracking down the bug to xray.core.ops.array_equiv. I have no idea what's going on, but by mistake I found out that if I introduce isnull(arr1 & arr2) just before the return statement then I don't get the error any more... So my xray.core.ops.array_equiv is now:

def array_equiv(arr1, arr2):
    """Like np.array_equal, but also allows values to be NaN in both arrays
    """
    arr1, arr2 = as_like_arrays(arr1, arr2)
    if arr1.shape != arr2.shape:
        return False
    # segmentation fault if we don't call this here...
    isnull(arr1 & arr2)
    return bool(((arr1 == arr2) | (isnull(arr1) & isnull(arr2))).all())

Thanks...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions