{"id":38404277,"url":"https://github.com/jintaolee-roger/cigsegy","last_synced_at":"2026-01-17T04:00:04.262Z","repository":{"id":64382058,"uuid":"575222959","full_name":"JintaoLee-Roger/cigsegy","owner":"JintaoLee-Roger","description":"A tool for exchanging data between SEG-Y format and NumPy array inside Python environment","archived":false,"fork":false,"pushed_at":"2025-03-07T16:24:24.000Z","size":387,"stargazers_count":55,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-27T17:41:16.593Z","etag":null,"topics":["cpp","geophysics","python","segy","seismic-data"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JintaoLee-Roger.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-12-07T02:49:51.000Z","updated_at":"2025-11-06T19:38:05.000Z","dependencies_parsed_at":"2023-01-15T14:45:21.284Z","dependency_job_id":"773c3b8d-fdfd-4042-acda-d214f2cf8638","html_url":"https://github.com/JintaoLee-Roger/cigsegy","commit_stats":{"total_commits":5,"total_committers":2,"mean_commits":2.5,"dds":"0.19999999999999996","last_synced_commit":"b56e09c6d0540460d6676fdfdc7a4aa44c1cadc0"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/JintaoLee-Roger/cigsegy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JintaoLee-Roger%2Fcigsegy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JintaoLee-Roger%2Fcigsegy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JintaoLee-Roger%2Fcigsegy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JintaoLee-Roger%2Fcigsegy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JintaoLee-Roger","download_url":"https://codeload.github.com/JintaoLee-Roger/cigsegy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JintaoLee-Roger%2Fcigsegy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28494109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T02:39:23.645Z","status":"ssl_error","status_checked_at":"2026-01-17T02:34:19.649Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","geophysics","python","segy","seismic-data"],"created_at":"2026-01-17T04:00:04.076Z","updated_at":"2026-01-17T04:00:04.243Z","avatar_url":"https://github.com/JintaoLee-Roger.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. figure:: https://github.com/JintaoLee-Roger/images/raw/main/cigsegy/assets/logo.svg\n    :alt: logo\n\n\n**A SEG-Y tool developed by** `Computational Interpretation Group (CIG) \u003chttps://cig.ustc.edu.cn/main.htm\u003e`_\n\n**cigsegy** is a tool for exchanging data between **SEG-Y** format and \n**NumPy** array inside Python environment.\n\nIt can be used to read and convert a SEG-Y format data into a Numpy array, \neven if the SEG-Y format data is missing some traces or its inline/crossline \nstep is not equal to 1.\n\nIt can also be used to create a SEG-Y format data from a Numpy array. In this\nmode, users can use headers from a existed SEG-Y file or create new headers by \nsetting some parameters.\n\nTutorial and reference documentation is provided \nat `cigsegy.readthedocs.io \u003chttps://cigsegy.readthedocs.io/en/latest/\u003e`_.\nAnd the source code is always available at `github.com/JintaoLee-Roger/cigsegy \u003chttps://github.com/JintaoLee-Roger/cigsegy\u003e`_.\n\n\n\nCore Features\n=============\n\n- Fast (Implemented in c++)\n- python wraping and **numpy** array supports\n- dealing with normal and **irregular** SEG-Y volume [1]_.\n- creating a SEG-Y file using the **existed header** of a SEG-Y\n\n\nQuick Start\n===========\n\n1. Install cigsegy via PyPi\n\n.. code-block:: bash\n\n    pip install cigsegy\n\n\n2. Print the 3200 bytes textual header of a SEG-Y file\n\n.. code-block:: python\n\n    \u003e\u003e\u003e import cigsegy\n    \u003e\u003e\u003e cigsegy.textual_header('rogan.sgy')\n    # C01 CLIENT: STUART PETROLEUM LTD    AREA:COOPER BASIN   SOUTH AUSTRALIA\n    # ...\n    # C06 INLINE RANGE: 360 - 1684(2)  CROSSLINE RANGE 1764 - 2532(1)\n    # C07 -------------PROCESSING FLOW---------------\n    # ...\n    # C35  DESC                   BYTE LOCATION       FORMAT \n    # C36  3D INLINE NUMBER        9- 12             32 BIT INTEGER \n    # C37  3D CROSSLINE  NUMBER   21- 24             32 BIT INTEGER \n    # C38  CDP_X                  73- 76             32 BIT INTEGER \n    # C39  CDP_Y                  77- 80             32 BIT INTEGER \n    # C40  \n\nYou can get some key information to read the SEG-Y file, such as inline location \nis 9 (C36), crossline location is 21 (C37), X location is 73 (C38), Y location \nis 77 (C39), inline step is 2 (C06), crossline step is 1 (C06).\n\n3. Scan the SEG-Y file and get some meta information\n\n.. code-block:: python\n\n    \u003e\u003e\u003e cigsegy.metaInfo('rogan.sgy', iline=9, xline=21, istep=2, xstep=1, xloc=73, yloc=77)\n    # In python, the shape is (n-inline, n-crossline, n-time) = (663, 769, 1001).\n\n    # shape: (n-time, n-crossline, n-inline) = (1001, 769, 663)\n    # sample interval: 4000, data format code: 4-bytes IBM floating-point\n    # inline range: 360 - 1684, crossline range: 1764 - 2532\n    # interval of inline: 35.0, interval of crossline: 17.5, time start: 0\n    # inline field: 9, crossline field: 21\n    # inline step: 2, crossline step: 1\n    # Is regular file (no missing traces): false\n\nYou will get some information about this SEG-Y file, such as, the data shape, \nintervals, data format ...\n\n.. Note::\n\n    If you are unsure about the values of some parameters, \n    you can ignore them and cigsegy will try to guess them automatically.\n \n    .. code-block:: python\n\n        \u003e\u003e\u003e cigsegy.metaInfo('fx.segy', iline=9, xline=21) # ignore istep, xstep, ...\n\n\n4. Read the SEG-Y\n\nPlease note that the shape is like (n-inlines, n-crosslines, n-time_samples)\n\n.. code-block:: python\n\n    \u003e\u003e\u003e d = cigsegy.fromfile('rogan.sgy', iline=9, xline=21, istep=2, xstep=1)\n    \u003e\u003e\u003e d.shape\n    # (663, 769, 1001)\n\n\nIf you need a binary file without any headers, i.e., save the numpy array\n\n.. code-block:: python\n\n    \u003e\u003e\u003e cigsegy.tofile('rogan.sgy', 'out.dat', iline=9, xline=21, istep=2, xstep=1)\n\n.. Note::\n    When using ``cigsegy.tofile()``, you **don't** have to worry about \n    running out of memory. Therefore, this function is very useful when \n    dealing with **huge** files.\n\n\n5. Create a SEG-Y using a numpy array and headers from another SEG-Y file\n\nThere is often such a workflow:\n    a. Display SEG-Y format data ``orig.segy`` in specialized software, such as Petrel.\n    b. Use Python code to process this data and obtain new data ``afterprocess``, which is in NumPy array format\n    c. To display this processed data in specialized software, it needs to be converted back to SEG-Y format and use the headers from the original data, i.e., using the NumPy array ``afterprocess`` and the header of ``orig.segy`` to create a new SEG-Y file ``out.segy``.\n\n.. code-block:: python\n\n    # assume the iline/xline/istep/xstep of **orig.segy** are 9/21/1/1\n    \u003e\u003e\u003e cigsegy.create_by_sharing_header('out.segy', 'orig.segy', afterprocess, \\\n        keylocs=[9, 21])\n\n6. Create a SEG-Y using a numpy array and some parameters\n\n.. code-block:: python\n\n    # d is a numpy array, d.shape == (n-inlines, n-crosslines, n-time)\n    \u003e\u003e\u003e cigsegy.create('out.segy', d, format=5, start_time=0, iline_interval=15, ...)\n\n\n7. Access the SEG-Y file as a 3D numpy array, without reading the whole file into memory\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from cigsegy import SegyNP\n    \u003e\u003e\u003e d = SegyNP('rogan.sgy', keylocs=[9, 21])\n    \u003e\u003e\u003e d.shape # (ni, nx, nt), use as a numpy array, 3D geometry\n    \u003e\u003e\u003e sx = d[100] # the 100-th inline profile\n    \u003e\u003e\u003e sx = d[100:200] # return a 3D array with shape (100, nx, nt)\n    \u003e\u003e\u003e sx = d[:, 200, :] # the 200-th crossline profile\n    \u003e\u003e\u003e sx = d[:, :, 100] # the 100-th time slice, note, it may be slow if the file is large\n    \u003e\u003e\u003e sx.min(), sx.max() \n    # get the min and max value, but they are evaluated from a part of data, \n    # so they may not be the real min and max value\n    \u003e\u003e\u003e sx.ntrace # get the number of traces for the file\n\n\n\nLicense\n=======\n\ncigsegy is provided under a MIT license that can be found in the `LICENSE \u003chttps://github.com/JintaoLee-Roger/cigsegy/blob/main/LICENSE\u003e`_ file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.\n\n\nTODO\n====\n\n- Add convenient functions to support **unsorted** prestack gathers.\n\n\nCitations\n===========\nIf you find this work useful in your research and want to cite it, please consider use this:\n\nPlain Text\n\n.. code-block:: python\n\n    Li, Jintao. \"CIGSEGY: A tool for exchanging data between SEG-Y format and NumPy array inside Python environment\". URL: https://github.com/JintaoLee-Roger/cigsegy\n\n\nBibTex\n\n.. code-block:: latex\n    \n    @misc{cigsegy,\n    author = {Li, Jintao},\n    title = {{CIGSEGY}: A tool for exchanging data between SEG-Y format and NumPy array inside Python environment},\n    howpublished = {\\url{https://github.com/JintaoLee-Roger/cigsegy}},\n    }\n\n\n\n=========\n\n.. [1] Here **irregular** SEG-Y volume means the area covered by a SEG-Y file is not a rectangle but a polygon (meaning that some lines are missing some traces), or its inline/crossline intervals are not 1. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjintaolee-roger%2Fcigsegy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjintaolee-roger%2Fcigsegy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjintaolee-roger%2Fcigsegy/lists"}