Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SeismicWriter and Xarray Support #8

Merged
merged 18 commits into from
May 29, 2024
Merged

Conversation

trhallam
Copy link
Contributor

@trhallam trhallam commented Apr 23, 2024

The package had no native SeismicWriter and would benefit from Xarray support.

I have added Lazy Xarray support for opening and writing ZGY files from SEGYSAK. I think it is better placed in this library.

Breaking Changes:
Requires Numpy>1.20

Code Changes:

  • Fix numpy.bool depreciation error in openzgy. Fixes np.bool depreceated #5
  • Refactor cdp calculations in SeismicLoader for easier reuse.
  • Changed test suite to use fixtures for some common files.
  • Updated setup.py to pyproject.toml.
  • Use README.md as long description for PyPi
  • Add Xarray to requirements

Features Added

  • SeismicWriter class for basic full/sub-volume writing of ZGY. This is a simple wrapper on OpenZGY.api.ZgyWriter but mimics SeismicLoader. The class also helps with managing the context when doing multiple sub-volume writes. Fixes extend to include Write capability #3
  • Added Xarray Backend Array, and EntryPoint for lazy loading of ZGY into an xarray.Dataset object.
  • Added PyZGY accessor to enable write to ZGY with ds.pyzgy.to_zgy(...).
  • Added Xarray details and SeismicWriter examples to README

Issues:

  • Some ZGY functionality (smaller dtypes, units, and scalars are ommited for the time being).
  • Compression isn't current supported as an argument for ZGY output but could be added.

@da-wad
Copy link
Collaborator

da-wad commented Apr 25, 2024

Great to have some improvements coming into this library - thanks @trhallam !

I have run the tests and get the following errors:

MacOS 3.8
Version 3.8 was not found in the local cache Error: Version 3.8 with arch arm64 not found
(I guess this is won't fix)

Python <=3.9
ERROR tests/test_read.py - TypeError: unsupported operand type(s) for |: 'type' and 'ABCMeta' ERROR tests/test_segyio-emulator.py - TypeError: unsupported operand type(s) for |: 'type' and 'ABCMeta

All others
FAILED tests/test_xarray.py::test_preferred_chunks[32bit] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_xarray_corners[32bit] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_xarray_to_zgy[32bit] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_preferred_chunks[16bit] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_xarray_corners[16bit] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_xarray_to_zgy[16bit] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_preferred_chunks[8bit] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_xarray_corners[8bit] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_xarray_to_zgy[8bit] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_xarray_to_zgy_chunking[dims0-sm] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_xarray_to_zgy_chunking[dims1-med] - ValueError: unrecognized chunk manager dask - must be one of: [] FAILED tests/test_xarray.py::test_xarray_to_zgy_chunking[dims2-lrg] - ValueError: unrecognized chunk manager dask - must be one of: []

These will need addressing before the PR can be accepted.

@trhallam
Copy link
Contributor Author

trhallam commented Apr 25, 2024

Thanks @da-wad , Python 3.8 is basically at EOL from Q3 this year. Do you think it can be dropped from testing? Also Github runners don't have Python images on Arm64 for Python<=3.10.

@da-wad
Copy link
Collaborator

da-wad commented Apr 25, 2024

Quite happy for dropping Python 3.8 support for the new version.

Download stats indicate that since MacOS is not a priority, Arm64 can likely also be dropped pre Python 3.10:
image

…py-lt-3.10

Address testing pipeline failures.
@trhallam
Copy link
Contributor Author

trhallam commented May 15, 2024

This should be all ready to go now @da-wad

@da-wad da-wad merged commit 6902751 into equinor:master May 29, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

np.bool depreceated extend to include Write capability
2 participants