diff --git a/pysheds/sview.py b/pysheds/sview.py index 5f54f2b..a8e088d 100644 --- a/pysheds/sview.py +++ b/pysheds/sview.py @@ -82,7 +82,7 @@ def __new__(cls, input_array, viewfinder=None, metadata={}): except: raise TypeError('`object` and `flexible` dtypes not allowed.') try: - assert np.min_scalar_type(viewfinder.nodata) <= obj.dtype + assert np.can_cast(viewfinder.nodata, obj.dtype, casting='safe') except: raise TypeError('`nodata` value not representable in dtype of array.') # Don't allow original viewfinder and metadata to be modified @@ -288,7 +288,7 @@ def __new__(cls, input_array, viewfinder=None, metadata={}): except: raise TypeError('`object` and `flexible` dtypes not allowed.') try: - assert np.min_scalar_type(viewfinder.nodata) <= obj.dtype + assert np.can_cast(viewfinder.nodata, obj.dtype, casting='safe') except: raise TypeError('`nodata` value not representable in dtype of array.') # Don't allow original viewfinder and metadata to be modified