title: Compress numpy arrays efficiently
body: <p>I tried various methods to do data compression when saving to disk some <code>numpy arrays</code>.</p>
  
  <p>These 1D arrays contain sampled data at a certain sampling rate (can be sound recorded with a microphone, or any other measurment with any sensor) : the data is essentially <em>continuous</em> (in a mathematical sense ; of course after sampling it is now discrete data).</p>
  
  <p>I tried with <code>HDF5</code> (h5py) :</p>
  
  <pre><code>f.create_dataset("myarray1", myarray, compression="gzip", compression_opts=9)
  </code></pre>
  
  <p>but this is quite slow, and the compression ratio is not the best we can expect.</p>
  
  <p>I also tried with </p>
  
  <pre><code>numpy.savez_compressed()
  </code></pre>
  
  <p>but once again it may not be the best compression algorithm for such data (described before).</p>
  
  <p><strong>What would you choose for better compression ratio on a <code>numpy array</code>, with such data ?</strong></p>
  
  <p>(I thought about things like lossless FLAC (initially designed for audio), but is there an easy way to apply such an algorithm on numpy data ?)</p>