{"id":13719725,"url":"https://github.com/equinor/pyzgy","last_synced_at":"2025-07-24T20:40:24.554Z","repository":{"id":57458716,"uuid":"397960575","full_name":"equinor/pyzgy","owner":"equinor","description":"Read Schlumberger's ZGY format with syntax familiar to users of segyio","archived":false,"fork":false,"pushed_at":"2024-08-14T10:43:16.000Z","size":286,"stargazers_count":6,"open_issues_count":4,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-28T14:17:47.426Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/equinor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-19T13:53:54.000Z","updated_at":"2024-05-29T13:05:57.000Z","dependencies_parsed_at":"2024-05-29T13:23:00.163Z","dependency_job_id":"a79aaefe-0f5f-4a16-8eb9-d3379561f010","html_url":"https://github.com/equinor/pyzgy","commit_stats":{"total_commits":38,"total_committers":2,"mean_commits":19.0,"dds":0.4736842105263158,"last_synced_commit":"ed8ecc0c0777e2639aba4440317c0c72a4054b2e"},"previous_names":["equinor/zgyio"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equinor%2Fpyzgy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equinor%2Fpyzgy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equinor%2Fpyzgy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equinor%2Fpyzgy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/equinor","download_url":"https://codeload.github.com/equinor/pyzgy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224270291,"owners_count":17283649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-03T01:00:54.657Z","updated_at":"2025-05-01T17:32:36.273Z","avatar_url":"https://github.com/equinor.png","language":"Python","funding_links":[],"categories":["Software","Software and Tools"],"sub_categories":["Seismic and Seismology"],"readme":"# pyzgy\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Tests](https://github.com/equinor/pyzgy/actions/workflows/python-app.yml/badge.svg)](https://github.com/equinor/pyzgy/actions/workflows/python-app.yml)\n[![SCM Compliance](https://scm-compliance-api.radix.equinor.com/repos/equinor/pyzgy/badge)](https://scm-compliance-api.radix.equinor.com/repos/equinor/pyzgy/badge)\n[![PyPi Version](https://img.shields.io/pypi/v/pyzgy.svg)](https://pypi.org/project/pyzgy/)\n\nConvenience wrapper around Schlumberger's OpenZGY Python package which enables \nreading of ZGY files with a syntax familiar to users of segyio.\n\nThe package also includes native support for loading and writing of ZGY data using Xarray.\n---\n\n### Installation\n\nRequires [**openzgy** package from Schlumberger](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/open-zgy/-/tree/master/python), which is (for now) bundled here under Apache v2.0 license\n\n- Wheels from [PyPI](https://pypi.org/project/pyzgy/): `pip install pyzgy`\n- Source from [Github](https://github.com/equinor/pyzgy): `git clone https://github.com/equinor/pyzgy.git`\n\n---\n\n### Usage\n\n#### Use segyio-like interface to read ZGY files ####\n```python\nimport pyzgy\nwith pyzgy.open(\"in.zgy\")) as zgyfile:\n    il_slice = zgyfile.iline[zgyfile.ilines[LINE_IDX]]\n    xl_slice = zgyfile.xline[LINE_NUMBER]\n    zslice = zgyfile.depth_slice[SLICE_IDX]\n    trace = zgyfile.trace[TRACE_IDX]\n    trace_header = zgyfile.header[TRACE_IDX]\n    text_file_header = zgyfile.text[0]\n```\n\n#### Read a ZGY file with underlying functions ####\n```python\nfrom pyzgy.accessors import SeismicReader\nwith SeismicReader(\"in.zgy\") as reader:\n    inline_slice = reader.read_inline_number(LINE_NUMBER)\n    crossline_slice = reader.read_crossline(LINE_IDX)\n    z_slice = reader.read_zslice_coord(SLICE_COORD)\n    sub_vol = reader.read_subvolume(\n        min_il=min_il, max_il=max_il,\n        min_xl=min_xl, max_xl=max_xl,\n        min_z=min_z, max_z=max_z\n    )\n```\n\n#### Write a ZGY file with underlying function ####\n```python\nimport numpy as np\nfrom pyzgy.accessors import SeismicWriter\n\n# create a dummy 10x10x10 cube\ndata = np.zeros((10, 10, 10))\n\nwith SeismicWriter(\"out.zgy\"\n    data.shape,\n    0.0, # the first sample\n    4.0, # the sample increment\n    (100, 100), # the first iline and xline labels\n    (1, 2), # the iline and xline increments\n    ) as writer:\n        writer.write_volume(data)\n```\n\n#### Native access and writing with Xarray ####\nThe Xarray Backend engine provides lazy loading support for the volume only. Opening large datasets should be possible, with sub-volume browsing using the native `xarray.Dataset.sel` method.\n\n```python\nimport xarray as xr\n\n# read a zgy file\nzgy = xr.open_dataset(\"int.zgy\")\ninline_slice = zgy.sel(iline=LINE_NUMBER)\ncrossline_slice = zgy.sel(xline=XLINE_NUMBER)\nz_slice = zgy.sel(sample=SAMPLE_VALUE)\n\nsub_vol = zgy.sel(\n    iline=range(LINE_START,LINE_END),\n    xline=range(XLINE_START,XLINE_END),\n    sample=range(SAMPLE_START,SAMPLE_END)\n)\n\n# write out to zgy file\nzgy.pyzgy.to_zgy(\"out.zgy\")\n\n```\n\n## Contributing\nContributions welcomed, whether you are reporting or fixing a bug, implementing or requesting a feature. Either make a github issue or fork the project and make a pull request. Please extend the unit tests with relevant passing/failing tests, run these as: `python -m pytest`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fequinor%2Fpyzgy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fequinor%2Fpyzgy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fequinor%2Fpyzgy/lists"}