equinor / xtgeo

XTGeo Python class library for subsurface Surfaces, Cubes, Wells, Grids, Points, etc
https://xtgeo.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
109 stars 56 forks source link

Bug when input values to Cube() is masked numpy array #1166

Closed jcrivenaes closed 4 months ago

jcrivenaes commented 4 months ago

In principle initialization of Cube() shall accept values that are scalar or list-like. But if the input now is a masked numpy with correct number of values, we receive an AttributeError saying 'numpy.ndarrray' object has no attribute 'c_contiguous'.

By digging more into this, we also see that proper error checks on dimensions miss, e.g. the following will work (unintentionally):

c = Cube(ncol=4, nrow=2, nlay=3, xinc=1, yinc=1, zinc=1, values=np.ones((6,4)))

mferrera commented 4 months ago

Resolved by #1168