obspy.core.util.base.create_empty_data_chunk

create_empty_data_chunk(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

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