10
10
from primary .services .vds_access .request_types import VdsCoordinates , VdsCoordinateSystem
11
11
from primary .services .vds_access .response_types import VdsMetadata
12
12
from primary .services .vds_access .vds_access import VdsAccess
13
-
14
13
from . import schemas
14
+ from . import converters
15
15
16
16
LOGGER = logging .getLogger (__name__ )
17
17
@@ -32,11 +32,128 @@ async def get_seismic_cube_meta_list(
32
32
)
33
33
seismic_cube_meta_list = await access .get_seismic_cube_meta_list_async ()
34
34
try :
35
- return [schemas . SeismicCubeMeta ( ** meta . __dict__ ) for meta in seismic_cube_meta_list ]
35
+ return [converters . to_api_vds_cube_meta ( meta ) for meta in seismic_cube_meta_list ]
36
36
except ValueError as exc :
37
37
raise HTTPException (status_code = 400 , detail = str (exc )) from exc
38
38
39
39
40
+ @router .get ("/get_inline_slice/" )
41
+ async def get_inline_slice (
42
+ authenticated_user : AuthenticatedUser = Depends (AuthHelper .get_authenticated_user ),
43
+ case_uuid : str = Query (description = "Sumo case uuid" ),
44
+ ensemble_name : str = Query (description = "Ensemble name" ),
45
+ realization_num : int = Query (description = "Realization number" ),
46
+ seismic_attribute : str = Query (description = "Seismic cube attribute" ),
47
+ time_or_interval_str : str = Query (description = "Timestamp or timestep" ),
48
+ observed : bool = Query (description = "Observed or simulated" ),
49
+ inline_no : int = Query (description = "Inline number" ),
50
+ ) -> schemas .SeismicSliceData :
51
+ """Get a seismic inline from a seismic cube."""
52
+ seismic_access = await SeismicAccess .from_case_uuid_async (
53
+ authenticated_user .get_sumo_access_token (), case_uuid , ensemble_name
54
+ )
55
+
56
+ vds_handle : Optional [VdsHandle ] = None
57
+ try :
58
+ vds_handle = await seismic_access .get_vds_handle_async (
59
+ realization = realization_num ,
60
+ seismic_attribute = seismic_attribute ,
61
+ time_or_interval_str = time_or_interval_str ,
62
+ observed = observed ,
63
+ )
64
+ except ValueError as err :
65
+ raise HTTPException (status_code = 404 , detail = str (err )) from err
66
+
67
+ if vds_handle is None :
68
+ raise HTTPException (status_code = 404 , detail = "Vds handle not found" )
69
+
70
+ vds_access = VdsAccess (sas_token = vds_handle .sas_token , vds_url = vds_handle .vds_url )
71
+
72
+ flattened_slice_traces_array , metadata = await vds_access .get_inline_slice (line_no = inline_no )
73
+
74
+ return converters .to_api_vds_slice_data (
75
+ flattened_slice_traces_array = flattened_slice_traces_array , metadata = metadata
76
+ )
77
+
78
+
79
+ @router .get ("/get_crossline_slice/" )
80
+ async def get_crossline_slice (
81
+ authenticated_user : AuthenticatedUser = Depends (AuthHelper .get_authenticated_user ),
82
+ case_uuid : str = Query (description = "Sumo case uuid" ),
83
+ ensemble_name : str = Query (description = "Ensemble name" ),
84
+ realization_num : int = Query (description = "Realization number" ),
85
+ seismic_attribute : str = Query (description = "Seismic cube attribute" ),
86
+ time_or_interval_str : str = Query (description = "Timestamp or timestep" ),
87
+ observed : bool = Query (description = "Observed or simulated" ),
88
+ crossline_no : int = Query (description = "Crossline number" ),
89
+ ) -> schemas .SeismicSliceData :
90
+ """Get a seismic crossline from a seismic cube."""
91
+ seismic_access = await SeismicAccess .from_case_uuid_async (
92
+ authenticated_user .get_sumo_access_token (), case_uuid , ensemble_name
93
+ )
94
+
95
+ vds_handle : Optional [VdsHandle ] = None
96
+ try :
97
+ vds_handle = await seismic_access .get_vds_handle_async (
98
+ realization = realization_num ,
99
+ seismic_attribute = seismic_attribute ,
100
+ time_or_interval_str = time_or_interval_str ,
101
+ observed = observed ,
102
+ )
103
+ except ValueError as err :
104
+ raise HTTPException (status_code = 404 , detail = str (err )) from err
105
+
106
+ if vds_handle is None :
107
+ raise HTTPException (status_code = 404 , detail = "Vds handle not found" )
108
+
109
+ vds_access = VdsAccess (sas_token = vds_handle .sas_token , vds_url = vds_handle .vds_url )
110
+
111
+ flattened_slice_traces_array , metadata = await vds_access .get_crossline_slice (line_no = crossline_no )
112
+
113
+ return converters .to_api_vds_slice_data (
114
+ flattened_slice_traces_array = flattened_slice_traces_array , metadata = metadata
115
+ )
116
+
117
+
118
+ @router .get ("/get_depth_slice/" )
119
+ async def get_depth_slice (
120
+ authenticated_user : AuthenticatedUser = Depends (AuthHelper .get_authenticated_user ),
121
+ case_uuid : str = Query (description = "Sumo case uuid" ),
122
+ ensemble_name : str = Query (description = "Ensemble name" ),
123
+ realization_num : int = Query (description = "Realization number" ),
124
+ seismic_attribute : str = Query (description = "Seismic cube attribute" ),
125
+ time_or_interval_str : str = Query (description = "Timestamp or timestep" ),
126
+ observed : bool = Query (description = "Observed or simulated" ),
127
+ depth : int = Query (description = "depth" ),
128
+ ) -> schemas .SeismicSliceData :
129
+ """Get a seismic depth slice from a seismic cube."""
130
+ seismic_access = await SeismicAccess .from_case_uuid_async (
131
+ authenticated_user .get_sumo_access_token (), case_uuid , ensemble_name
132
+ )
133
+
134
+ vds_handle : Optional [VdsHandle ] = None
135
+ try :
136
+ vds_handle = await seismic_access .get_vds_handle_async (
137
+ realization = realization_num ,
138
+ seismic_attribute = seismic_attribute ,
139
+ time_or_interval_str = time_or_interval_str ,
140
+ observed = observed ,
141
+ )
142
+ except ValueError as err :
143
+ raise HTTPException (status_code = 404 , detail = str (err )) from err
144
+
145
+ if vds_handle is None :
146
+ raise HTTPException (status_code = 404 , detail = "Vds handle not found" )
147
+
148
+ vds_access = VdsAccess (sas_token = vds_handle .sas_token , vds_url = vds_handle .vds_url )
149
+
150
+ flattened_slice_traces_array , metadata = await vds_access .get_depth_slice (depth = depth )
151
+
152
+ return converters .to_api_vds_slice_data (
153
+ flattened_slice_traces_array = flattened_slice_traces_array , metadata = metadata
154
+ )
155
+
156
+
40
157
@router .post ("/get_seismic_fence/" )
41
158
async def post_get_seismic_fence (
42
159
authenticated_user : AuthenticatedUser = Depends (AuthHelper .get_authenticated_user ),
@@ -86,8 +203,8 @@ async def post_get_seismic_fence(
86
203
coordinates = VdsCoordinates (polyline .x_points , polyline .y_points ),
87
204
coordinate_system = VdsCoordinateSystem .CDP ,
88
205
)
89
-
90
206
meta : VdsMetadata = await vds_access .get_metadata_async ()
207
+
91
208
if len (meta .axis ) != 3 :
92
209
raise ValueError (f"Expected 3 axes, got { len (meta .axis )} " )
93
210
depth_axis_meta = meta .axis [2 ]
0 commit comments