Compress numpy arrays efficiently

前端 未结 6 1033
名媛妹妹
名媛妹妹 2020-12-03 13:30

I tried various methods to do data compression when saving to disk some numpy arrays.

These 1D arrays contain sampled data at a certain sampling rate (c

6条回答
  •  没有蜡笔的小新
    2020-12-03 14:28

    What constitutes the best compression (if any) highly depends on the nature of the data. Many kinds of measurement data are virtually completely incompressible, if loss-free compression is indeed required.

    The pytables docs contains a lot of useful guidelines on data compression. It also details speed tradeoffs and so on; higher compression levels are usually a waste of time, as it turns out.

    http://pytables.github.io/usersguide/optimization.html

    Note that this is probably as good as it will get. For integer measurements, a combination of a shuffle filter with a simple zip-type compression usually works reasonably well. This filter very efficiently exploits the common situation where the highest-endian byte is usually 0, and only included to guard against overflow.

提交回复
热议问题