Return an element of the data array as a standard Python scalar.
The first and last elements are always returned with f.datum(0) and f.datum(-1) respectively, even if the data array is a scalar array or has two or more dimensions.
Parameters: |
|
---|---|
Returns: |
|
Examples: |
>>> print f.array
2
>>> f.datum()
2
>>> 2 == f.datum(0) == f.datum(-1) == f.datum(())
True
>>> print f.array
[[2]]
>>> 2 == f.datum() == f.datum(0) == f.datum(-1)
True
>>> 2 == f.datum(0, 0) == f.datum((-1, -1)) == f.datum(-1, 0)
True
>>> print f.array
[[4 -- 6]
[1 2 3]]
>>> f.datum(0)
4
>>> f.datum(-1)
3
>>> f.datum(1)
masked
>>> f.datum(4)
2
>>> f.datum(-2)
2
>>> f.datum(0, 0)
4
>>> f.datum(-2, -1)
6
>>> f.datum(1, 2)
3
>>> f.datum((0, 2))
6