Skip to content

Commit f558661

Browse files
committed
Add template for efficient storage of pre-stack data.
1 parent 954661c commit f558661

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

docs/template_registry.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The `TemplateRegistry` implements the singleton pattern to ensure there's only o
1515
- **Default Templates**: The registry is instantiated with the default set of templates:
1616
- PostStack2DTime
1717
- PostStack3DTime
18+
- SeismicPreStack
1819
- PreStackCdpGathers3DTime
1920
- PreStackShotGathers3DTime
2021
- PostStack2DDepth
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
"""SeismicPreStackTemplate MDIO v1 dataset templates."""
2+
3+
from mdio.schemas.dtype import ScalarType
4+
from mdio.schemas.metadata import UserAttributes
5+
from mdio.schemas.v1.templates.abstract_dataset_template import AbstractDatasetTemplate
6+
7+
8+
class SeismicPreStackTemplate(AbstractDatasetTemplate):
9+
"""
10+
Seismic pre-stack time Dataset template.
11+
12+
This should be used for both 2D and 3D datasets. Common-shot or common-channel datasets
13+
14+
Args:
15+
domain: The domain of the dataset.
16+
17+
Raises:
18+
ValueError: If the domain is not 'time' or 'depth'.
19+
"""
20+
21+
def __init__(self, domain: str = "time"):
22+
super().__init__(domain=domain)
23+
24+
self._coord_dim_names = [
25+
"shot_line",
26+
"gun",
27+
"shot_point",
28+
"cable",
29+
"channel",
30+
] # Custom coordinates for shot gathers
31+
self._dim_names = [*self._coord_dim_names, self._trace_domain]
32+
self._coord_names = ["source_coord_x", "source_coord_y", "group_coord_x", "group_coord_y"]
33+
self._var_chunk_shape = [1, 1, 16, 1, 32, -1]
34+
35+
@property
36+
def _name(self) -> str:
37+
return f"PreStackGathers3D{self._trace_domain.capitalize()}"
38+
39+
def _load_dataset_attributes(self) -> UserAttributes:
40+
return UserAttributes(
41+
attributes={
42+
"surveyDimensionality": "3D",
43+
"ensembleType": "shot_point",
44+
"processingStage": "pre-stack",
45+
}
46+
)
47+
48+
def _add_coordinates(self) -> None:
49+
# Add dimension coordinates
50+
for name in self._dim_names:
51+
self._builder.add_coordinate(
52+
name,
53+
dimensions=[name],
54+
data_type=ScalarType.INT32,
55+
metadata_info=None,
56+
)
57+
58+
self._builder.add_coordinate(
59+
"source_coord_x",
60+
dimensions=["shot_line", "gun", "shot_point", "cable", "channel"],
61+
data_type=ScalarType.FLOAT64,
62+
metadata_info=[self._horizontal_coord_unit],
63+
)
64+
self._builder.add_coordinate(
65+
"source_coord_y",
66+
dimensions=["shot_line", "gun", "shot_point", "cable", "channel"],
67+
data_type=ScalarType.FLOAT64,
68+
metadata_info=[self._horizontal_coord_unit],
69+
)
70+
self._builder.add_coordinate(
71+
"group_coord_x",
72+
dimensions=["shot_line", "gun", "shot_point", "cable", "channel"],
73+
data_type=ScalarType.FLOAT64,
74+
metadata_info=[self._horizontal_coord_unit],
75+
)
76+
self._builder.add_coordinate(
77+
"group_coord_y",
78+
dimensions=["shot_line", "gun", "shot_point", "cable", "channel"],
79+
data_type=ScalarType.FLOAT64,
80+
metadata_info=[self._horizontal_coord_unit],
81+
)

0 commit comments

Comments
 (0)