|
| 1 | +"""Seismic3DObnReceiverGathersTemplate MDIO v1 dataset templates.""" |
| 2 | + |
| 3 | +from typing import Any |
| 4 | + |
| 5 | +from mdio.builder.schemas import compressors |
| 6 | +from mdio.builder.schemas.dtype import ScalarType |
| 7 | +from mdio.builder.schemas.v1.variable import CoordinateMetadata |
| 8 | +from mdio.builder.templates.base import AbstractDatasetTemplate |
| 9 | +from mdio.builder.templates.types import SeismicDataDomain |
| 10 | + |
| 11 | + |
| 12 | +class Seismic3DObnReceiverGathersTemplate(AbstractDatasetTemplate): |
| 13 | + """Seismic OBN/OBC receiver-domain pre-stack 3D Dataset template. |
| 14 | +
|
| 15 | + A template for Ocean Bottom Node (OBN) or Ocean Bottom Cable (OBC) surveys where |
| 16 | + receivers are deployed at fixed positions and shots are organized by shot lines. |
| 17 | + Data is indexed by receiver position, enabling efficient receiver-side processing. |
| 18 | +
|
| 19 | + Dimensions: |
| 20 | + - receiver: Index of the receiver node/station |
| 21 | + - shot_line: Shot line or swath identifier |
| 22 | + - shot_point: Shot point within the line |
| 23 | + - time/depth: Sample dimension |
| 24 | +
|
| 25 | + This organization is optimal for: |
| 26 | + - Receiver-side wavefield separation (up/down) |
| 27 | + - Receiver-consistent deconvolution |
| 28 | + - Multi-component processing |
| 29 | +
|
| 30 | + Args: |
| 31 | + data_domain: The domain of the dataset ('time' or 'depth'). |
| 32 | + """ |
| 33 | + |
| 34 | + def __init__(self, data_domain: SeismicDataDomain = "time"): |
| 35 | + super().__init__(data_domain=data_domain) |
| 36 | + |
| 37 | + self._dim_names = ("receiver", "shot_line", "shot_point", self._data_domain) |
| 38 | + self._physical_coord_names = ( |
| 39 | + "receiver_x", |
| 40 | + "receiver_y", |
| 41 | + "source_coord_x", |
| 42 | + "source_coord_y", |
| 43 | + ) |
| 44 | + self._logical_coord_names = ("receiver_depth",) |
| 45 | + self._var_chunk_shape = (1, 1, 512, 4096) |
| 46 | + |
| 47 | + @property |
| 48 | + def _name(self) -> str: |
| 49 | + return f"ObnReceiverGathers3D{self._data_domain.capitalize()}" |
| 50 | + |
| 51 | + def _load_dataset_attributes(self) -> dict[str, Any]: |
| 52 | + return {"surveyType": "3D", "gatherType": "common_receiver", "acquisitionType": "obn"} |
| 53 | + |
| 54 | + def _add_coordinates(self) -> None: |
| 55 | + # Add dimension coordinates |
| 56 | + self._builder.add_coordinate( |
| 57 | + "receiver", |
| 58 | + dimensions=("receiver",), |
| 59 | + data_type=ScalarType.UINT32, |
| 60 | + metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("receiver")), |
| 61 | + ) |
| 62 | + self._builder.add_coordinate( |
| 63 | + "shot_line", |
| 64 | + dimensions=("shot_line",), |
| 65 | + data_type=ScalarType.UINT32, |
| 66 | + metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("shot_line")), |
| 67 | + ) |
| 68 | + self._builder.add_coordinate( |
| 69 | + "shot_point", |
| 70 | + dimensions=("shot_point",), |
| 71 | + data_type=ScalarType.UINT32, |
| 72 | + metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("shot_point")), |
| 73 | + ) |
| 74 | + self._builder.add_coordinate( |
| 75 | + self.trace_domain, |
| 76 | + dimensions=(self.trace_domain,), |
| 77 | + data_type=ScalarType.INT32, |
| 78 | + metadata=CoordinateMetadata(units_v1=self.get_unit_by_key(self.trace_domain)), |
| 79 | + ) |
| 80 | + |
| 81 | + # Add non-dimension coordinates |
| 82 | + compressor = compressors.Blosc(cname=compressors.BloscCname.zstd) |
| 83 | + |
| 84 | + # Receiver coordinates (fixed per receiver) |
| 85 | + self._builder.add_coordinate( |
| 86 | + "receiver_x", |
| 87 | + dimensions=("receiver",), |
| 88 | + data_type=ScalarType.FLOAT64, |
| 89 | + compressor=compressor, |
| 90 | + metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("receiver_x")), |
| 91 | + ) |
| 92 | + self._builder.add_coordinate( |
| 93 | + "receiver_y", |
| 94 | + dimensions=("receiver",), |
| 95 | + data_type=ScalarType.FLOAT64, |
| 96 | + compressor=compressor, |
| 97 | + metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("receiver_y")), |
| 98 | + ) |
| 99 | + self._builder.add_coordinate( |
| 100 | + "receiver_depth", |
| 101 | + dimensions=("receiver",), |
| 102 | + data_type=ScalarType.FLOAT32, |
| 103 | + compressor=compressor, |
| 104 | + metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("receiver_depth")), |
| 105 | + ) |
| 106 | + |
| 107 | + # Source coordinates (vary by shot_line and shot_point) |
| 108 | + self._builder.add_coordinate( |
| 109 | + "source_coord_x", |
| 110 | + dimensions=("shot_line", "shot_point"), |
| 111 | + data_type=ScalarType.FLOAT64, |
| 112 | + compressor=compressor, |
| 113 | + metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("source_coord_x")), |
| 114 | + ) |
| 115 | + self._builder.add_coordinate( |
| 116 | + "source_coord_y", |
| 117 | + dimensions=("shot_line", "shot_point"), |
| 118 | + data_type=ScalarType.FLOAT64, |
| 119 | + compressor=compressor, |
| 120 | + metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("source_coord_y")), |
| 121 | + ) |
0 commit comments