SimPEG.utils.validate_ndarray_with_shape(property_name, var, shape=None, dtype=<class 'float'>)[source]#

Validate numerical array property


The name of the property being set


The input array

shapetuple of int, or list of tuple of int, default: None

The shape of the array; e.g. (3, ), (3, 3), (‘*’, 2). The ‘*’ indicates that an arbitrary number of elements is allowed along a particular dimension. If list then multiple shapes are accepted. By default, shape is a tuple of length ndim of ‘*’.

dtypeclass, or tuple of class, optional

The data type for the array. I.e. float, int, complex, bool, etc. Validated from left to right if a tuple.

numpy.ndarray of dtype

Returns the array in the specified data type once validated