Save 3D seismic data in .segy using Obspy

Hi! I’m with a doubt and I didn’t find anywhere (here or in the issues).

Is there some way to write a 3D seismic data using Obspy? I read a 3D seismic data (501 time sample x 345 inlines x 188 xlines, which means a total of 64860 traces), make some calculation and now I’d like to save in a segy. I’m facing the error ‘h’ format requires -32768 <= number <= 32767 which I thought was only related to the length of individual traces, but it also happens for the amount of traces.
Another problem I noticed is how to identify correctly each inline/xline in the header of the written file. I did a test with only 2 inlines, each one in a Stream and then I summed both. But the result when written is just a a Stream with the total size (I thought doing this would result in identifying number_of_data_traces_per_ensemble: as the number of traces in each Stream).

Thank you!

Victor Almeida.