How to convert segy to npz?

384 Views Asked by At

I'm new to programming.

I need to convert my seismic section (segy) to compressed array (npz) in order for me to load inside Jupyter to run some algorithms.

How do I convert segy to npz format? Is there anyway to do so?

1

There are 1 best solutions below

1
On

I'm not familiar with the segy module, but to save to an npz file format, you can use the scipy.parse package to convert a regular nupmy array to a sparse/compressed array.

import scipy.sparse as sp
import numpy as np
dense = np.array(*your np array here*)
sparse = sp.csr_martrix(dense)
sp.save_npz('name.npz', sparse, compressed=True)

This will convert the regular numpy array to be saved as the compressed matrix file in .npz. Therefore, the only problem left is to convert the segy to numpy, which I'm not familiar with.