Hello,

The Python code suggested by Khawer below seems to work.

Thank you all

Adnand

 

De : Khawar Qazi <smartkhawar@gmail.com>
Envoyé : vendredi 12 décembre 2025 13:28
À : Bitri Adnand <a.bitri@brgm.fr>
Objet : Re: [Seisunix] HDF5 to Segy conversion

 

HI, 

 

try code below: Technically this should work.

You should know little about how to handle with python and the code should work. Install segyio,  h5py and numpy.

 

Maybe numpy 1.26.4 works here and numpy 2 will not work correctly. But check at your end.

_________________________________________________________________________________

import h5py
import segyio
import numpy as np
 
# --- 1. Read HDF5 ---
with h5py.File('my_seismic_input.h5', 'r') as hf:
    # Assuming data is in '/traces' and headers in '/trace_headers'
    traces = hf['/traces'][:] # Read all traces into memory (adjust for large files)
    headers = hf['/trace_headers'][:] # Read headers (structured array)
    # Extract metadata as needed
 
# --- 2. Prepare for SEG-Y ---
num_traces, num_samples = traces.shape
# Create a blank SEG-Y file structure
with segyio.create('output.segy', (num_traces, num_samples)) as f:
    # --- 3. Write Headers (Simplified) ---
    f.text[0] = b'Converted from HDF5' # Example text header
    # Map headers to binary_header (complex mapping required)
    # f.binary_header.trace_count = num_traces
 
    # --- 4. Write Traces ---
    for i in range(num_traces):
        f.trace[i] = traces[i, :] # Write trace data
        # Map headers[i] to f.header[i] (requires careful field mapping)
        # e.g., f.header[i][segyio.TraceField.TRACENO] = i
 
__________________________________________________________________________________________________________

This should export your hdf5 file to segy.

 

Best regards

 

On Fri, 12 Dec 2025 at 13:19, Bitri Adnand <a.bitri@brgm.fr> wrote:

Hi Khawar,

I have DAS data in HDF5 format and I'm going to process it in SU.

This requires converting the data to SEGY (or SU). Can this conversion be done using Python?

Thanks

Adnand

 

De : Khawar Qazi <smartkhawar@gmail.com>
Envoyé : vendredi 12 décembre 2025 11:20
À : Bitri Adnand <a.bitri@brgm.fr>
Objet : Re: [Seisunix] HDF5 to Segy conversion

 

Cet expéditeur (smartkhawar@gmail.com) vous écrit pour la première fois.

Analysé par Mantra

HI, 

I think at the moment, the fastest way is to use the python tool. 

Below is a link which could help you. 

 

 

 

Check this and let me know if it still doesnät help your problem. 

 

Best regards

 

 

On Fri, 12 Dec 2025 at 10:33, Bitri Adnand <a.bitri@brgm.fr> wrote:

Hi, everyone!
I'm looking for a code that converts HDF5 data to SEGY.

Thanks for your help

Regards

Adnand 

_______________________________________________
Seisunix mailing list -- seisunix@mailman.seismic-unix.org
To unsubscribe send an email to seisunix-leave@mailman.seismic-unix.org


 

--

Dr. Khawar Ashfaq Ahmed


 

--

Dr. Khawar Ashfaq Ahmed