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 seismic geometry abstractions #112

Open
tasansal opened this issue Oct 17, 2022 · 0 comments
Open

Add seismic geometry abstractions #112

tasansal opened this issue Oct 17, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@tasansal
Copy link
Collaborator

tasansal commented Oct 17, 2022

It would be nice to have geometry abstractions for standard interface and custom / geometry specific exception handling.

This has the following pros:

  1. Common interface for coordinate conversions.
  2. Trace iterators based on the type of data.
  3. Enforce usage of methods for geometry instances that may be added later.
  4. Improve maintainability.
  5. Allow custom things to be added, i.e., for shots, we add the conversion from unwrapped channels to wrapped channels unwrap_channels, and we still have a base implementation that should follow the extensible interface.
  6. Encapsulate the logic for geometry specific chunk size and access pattern configurations

Long shot, but cython or numba jit versions may be even better. xarray can also be used to handle named dimensions etc.

Would inherit from a base class like

# mdio/segy/geometry.py

from abc import ABC


class SeismicGeometry(ABC):
    def __init__(self, args, kwargs):
        ...

    @abstractmethod
    def __iter__(self):
        ...

    @abstractmethod
    def __getitem__(self):
        ...

    @abstractmethod
    def xy_to_grid(self, x, y, method="nearest"):
        ...

    @property
    @abstractmethod
    def num_traces(self):
       ...

Then we would have 3D as something like

from mdio.segy.geometry import SeismicGeometry


class SeismicStack3d(SeismicGeometry):
    def __init__(self, inlines, crosslines, samples):
        # set attributes, initialize grid etc.

    def __iter__(self):
        # logic to iterate traces on spatial il/xl grid

    @abstractmethod
    def xy_to_grid(self, x, y, method="nearest"):
        # logic to convert CDP-X CDP-Y to inline and crossline

    @property
    def num_traces(self):
        return self.get_size("inline") * self.get_size("crossline")

Or 3D shots like

from mdio.segy.geometry import SeismicGeometry


class SeismicShot3d(SeismicGeometry):
    def __init__(self, shots, cables, channels, samples):
        # set attributes, initialize grid etc.

    def __iter__(self):
        # logic to iterate traces on shot grid

    @abstractmethod
    def xy_to_grid(self, x, y, method="nearest"):
        # logic to convert SHOT-X SHOT-Y to shot number

    @property
    def num_traces(self):
        return self.get_size("shot") * self.get_size("cable") * self.get_size("channel")

    @def unwrap_channels(self, channels_per_streamer: int):
        return self.channel % channels_per_streamer + 1

and so on.

@tasansal tasansal added the enhancement New feature or request label Oct 17, 2022
@tasansal tasansal added the good first issue Good for newcomers label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant