obspy.core.util.base.createEmptyDataChunk

createEmptyDataChunk(delta, dtype, fill_value=None)[source]

Creates an NumPy array depending on the given data type and fill value.

If no fill_value is given a masked array will be returned.

Parameters:
  • delta Number of samples for data chunk
  • dtype NumPy dtype for returned data chunk
  • fill_value If None, masked array is returned, else the array is filled with the corresponding value

Example

>>> createEmptyDataChunk(3, 'int', 10)
array([10, 10, 10])
>>> createEmptyDataChunk(6, np.complex128, 0)
array([ 0.+0.j,  0.+0.j,  0.+0.j,  0.+0.j,  0.+0.j,  0.+0.j])
>>> createEmptyDataChunk(3, 'f') 
masked_array(data = [-- -- --],
             mask = ...,
             ...)