I have the following code:
result = np.ma.dot( array1, masked_array2 )
Which gives something like this:
masked_array(data = 24.681441709536468,
mask = False,
fill_value = 1e+20)
result.data.shape gives:
()
I can access the value by converting it to a float, like
float(result.data)
Is this the correct way of accessing the data?
The result is a 0D tensor.
Typically numpy converts 0D tensor to native type
type(np.dot([1,2], [3,4])) # gives 'int'
However, when the result is masked array, due to the existence of mask, there's no way to convert it directly to a native type without losing information. Thus you get a "oddly shaped" 0D tensor as result.
Yes, you can access it by converting it to float.