Detrend and STEIM Encoding

Hey Jonathan,

yes, you are right. Just 1 min after I hit send I realized that this is the issue. Of course the processing creates float data which is not suitable for STEIM ... I will find another way.


You can use a method of the numpy.ndarray to convert it back to int32 first:

for tr in st:
#convert from float32 to int32 =


Hey Florian,

one possibility is to multiply it with some large number and then convert it to 32bit integers. You might loose some accuracy though. Also be careful to not cause any overflows.



I think Lion’s suggestion is much better than casting it to int32 without doing the multiplication, as there’s a large potential loss of accuracy without it.


Yes, it depends on how big your floats are. My use case already had big numbers (raw counts out turned into floats by processing).

Yea its super tricky for several. In general its best to not convert floats back to integers.

@Florian: Can seisan read MiniSEED files with 32bit floating point numbers? If yes just use that - the loss in accuracy should not matter at all.

for tr in st:
��� = np.require(, dtype=np.float32)



Hi Florian,

I had the same problem with SEG-Y data converted to mseed with obspy. The best and quick solution is to multiply the data with a very large number. On the other hand you
can use the routines attached to this mail and recompile your Seisan distro. You must put the first one in the INC folder and the other two in LIB: These rutines were written and sent to me by Jens Havskov. It would be good if you write to Prof. Havskov reporting that error, may be in future Seisan releases he includes that fix.

Cheers. (17.8 KB)

wave.for (115 KB)

seismseed.c (59.1 KB)