Skip to content

Commit f220049

Browse files
authored
Merge branch 'main' into 624_prestack_schema
2 parents 9d8e0c8 + d6b8fd2 commit f220049

29 files changed

+871
-688
lines changed

docs/tutorials/quickstart.ipynb

Lines changed: 58 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
]
4747
},
4848
{
49-
"metadata": {},
5049
"cell_type": "code",
51-
"outputs": [],
5250
"execution_count": null,
51+
"metadata": {},
52+
"outputs": [],
5353
"source": [
5454
"import os\n",
5555
"\n",
@@ -75,6 +75,8 @@
7575
"\n",
7676
"MDIO uses [TGSAI/segy][segy-github] to parse the SEG-Y; the field names conform to its canonical keys defined in [SEGY Binary Header Keys][segy-binary-keys] and [SEGY Trace Header Keys][segy-trace-keys]. Since MDIO v1 we also introduced templates for common seismic data types. For instance, we will be using the `PostStack3DTime` template [here][mdio-template-poststack3dtime], which expects the same canonical keys.\n",
7777
"\n",
78+
"We will also specify the units for the time domain. The spatial units will be automatically parsed from SEG-Y binary header. However, there may be a case where it is corrupt in the file, for that see the [Fixing X/Y Units Issues](https://mdio-python.readthedocs.io/en/stable/tutorials/corrupt_files.html#fixing-x-y-units-issues) section.\n",
79+
"\n",
7880
"In summary, we will use the byte locations as defined for ingestion.\n",
7981
"\n",
8082
"[segy-github]: https://github.com/TGSAI/segy\n",
@@ -85,17 +87,20 @@
8587
},
8688
{
8789
"cell_type": "code",
90+
"execution_count": null,
8891
"metadata": {
8992
"pycharm": {
9093
"name": "#%%\n"
9194
}
9295
},
96+
"outputs": [],
9397
"source": [
9498
"import matplotlib.pyplot as plt\n",
9599
"from segy.schema import HeaderField\n",
96100
"from segy.standards import get_segy_standard\n",
97101
"\n",
98102
"from mdio import segy_to_mdio\n",
103+
"from mdio.builder.schemas.v1.units import TimeUnitModel\n",
99104
"from mdio.builder.template_registry import get_template\n",
100105
"\n",
101106
"teapot_trace_headers = [\n",
@@ -109,16 +114,17 @@
109114
"teapot_segy_spec = rev0_segy_spec.customize(trace_header_fields=teapot_trace_headers)\n",
110115
"\n",
111116
"mdio_template = get_template(\"PostStack3DTime\")\n",
117+
"unit_ms = TimeUnitModel(time=\"ms\")\n",
118+
"mdio_template.add_units({\"time\": unit_ms})\n",
119+
"\n",
112120
"segy_to_mdio(\n",
113121
" input_path=input_url,\n",
114122
" output_path=\"filt_mig.mdio\",\n",
115123
" segy_spec=teapot_segy_spec,\n",
116124
" mdio_template=mdio_template,\n",
117125
" overwrite=True,\n",
118126
")"
119-
],
120-
"outputs": [],
121-
"execution_count": null
127+
]
122128
},
123129
{
124130
"cell_type": "markdown",
@@ -141,19 +147,19 @@
141147
},
142148
{
143149
"cell_type": "code",
150+
"execution_count": null,
144151
"metadata": {
145152
"pycharm": {
146153
"name": "#%%\n"
147154
}
148155
},
156+
"outputs": [],
149157
"source": [
150158
"from mdio import open_mdio\n",
151159
"\n",
152160
"dataset = open_mdio(\"filt_mig.mdio\")\n",
153161
"dataset"
154-
],
155-
"outputs": [],
156-
"execution_count": null
162+
]
157163
},
158164
{
159165
"cell_type": "markdown",
@@ -170,16 +176,16 @@
170176
},
171177
{
172178
"cell_type": "code",
179+
"execution_count": null,
173180
"metadata": {
174181
"pycharm": {
175182
"name": "#%%\n"
176183
}
177184
},
185+
"outputs": [],
178186
"source": [
179187
"print(dataset[\"segy_file_header\"].attrs[\"textHeader\"])"
180-
],
181-
"outputs": [],
182-
"execution_count": null
188+
]
183189
},
184190
{
185191
"cell_type": "markdown",
@@ -194,16 +200,16 @@
194200
},
195201
{
196202
"cell_type": "code",
203+
"execution_count": null,
197204
"metadata": {
198205
"pycharm": {
199206
"name": "#%%\n"
200207
}
201208
},
209+
"outputs": [],
202210
"source": [
203211
"dataset[\"segy_file_header\"].attrs[\"binaryHeader\"]"
204-
],
205-
"outputs": [],
206-
"execution_count": null
212+
]
207213
},
208214
{
209215
"cell_type": "markdown",
@@ -221,42 +227,42 @@
221227
},
222228
{
223229
"cell_type": "code",
230+
"execution_count": null,
224231
"metadata": {
225232
"pycharm": {
226233
"name": "#%%\n"
227234
}
228235
},
236+
"outputs": [],
229237
"source": [
230238
"dataset.sizes"
231-
],
232-
"outputs": [],
233-
"execution_count": null
239+
]
234240
},
235241
{
236242
"cell_type": "code",
243+
"execution_count": null,
237244
"metadata": {
238245
"pycharm": {
239246
"name": "#%%\n"
240247
}
241248
},
249+
"outputs": [],
242250
"source": [
243251
"dataset.inline"
244-
],
245-
"outputs": [],
246-
"execution_count": null
252+
]
247253
},
248254
{
249255
"cell_type": "code",
256+
"execution_count": null,
250257
"metadata": {
251258
"pycharm": {
252259
"name": "#%%\n"
253260
}
254261
},
262+
"outputs": [],
255263
"source": [
256264
"dataset.crossline"
257-
],
258-
"outputs": [],
259-
"execution_count": null
265+
]
260266
},
261267
{
262268
"cell_type": "markdown",
@@ -278,11 +284,13 @@
278284
},
279285
{
280286
"cell_type": "code",
287+
"execution_count": null,
281288
"metadata": {
282289
"pycharm": {
283290
"name": "#%%\n"
284291
}
285292
},
293+
"outputs": [],
286294
"source": [
287295
"from mdio.builder.schemas.v1.stats import SummaryStatistics\n",
288296
"\n",
@@ -292,9 +300,7 @@
292300
"il_dataset = dataset.sel(inline=278)\n",
293301
"il_amp = il_dataset[\"amplitude\"].T\n",
294302
"il_amp.plot(vmin=-2 * std, vmax=2 * std, cmap=\"gray_r\", yincrease=False);"
295-
],
296-
"outputs": [],
297-
"execution_count": null
303+
]
298304
},
299305
{
300306
"cell_type": "markdown",
@@ -313,13 +319,13 @@
313319
},
314320
{
315321
"cell_type": "code",
322+
"execution_count": null,
316323
"metadata": {},
324+
"outputs": [],
317325
"source": [
318326
"twt_data = dataset[\"amplitude\"].sel(time=1000)\n",
319327
"twt_data.plot(vmin=-2 * std, vmax=2 * std, cmap=\"gray_r\", x=\"cdp_x\", y=\"cdp_y\");"
320-
],
321-
"outputs": [],
322-
"execution_count": null
328+
]
323329
},
324330
{
325331
"cell_type": "markdown",
@@ -336,19 +342,19 @@
336342
},
337343
{
338344
"cell_type": "code",
345+
"execution_count": null,
339346
"metadata": {
340347
"pycharm": {
341348
"name": "#%%\n"
342349
}
343350
},
351+
"outputs": [],
344352
"source": [
345353
"trace_mask = dataset.trace_mask[:]\n",
346354
"\n",
347355
"twt_data.plot(vmin=-2 * std, vmax=2 * std, cmap=\"gray_r\", x=\"cdp_x\", y=\"cdp_y\", alpha=0.5, figsize=(8, 5))\n",
348356
"trace_mask.plot(vmin=0, vmax=1, x=\"cdp_x\", y=\"cdp_y\", alpha=0.5);"
349-
],
350-
"outputs": [],
351-
"execution_count": null
357+
]
352358
},
353359
{
354360
"cell_type": "markdown",
@@ -380,29 +386,29 @@
380386
},
381387
{
382388
"cell_type": "code",
389+
"execution_count": null,
383390
"metadata": {
384391
"pycharm": {
385392
"name": "#%%\n"
386393
}
387394
},
395+
"outputs": [],
388396
"source": [
389397
"dataset.headers[\"cdp_x\"].compute()"
390-
],
391-
"outputs": [],
392-
"execution_count": null
398+
]
393399
},
394400
{
395401
"cell_type": "code",
402+
"execution_count": null,
396403
"metadata": {
397404
"pycharm": {
398405
"name": "#%%\n"
399406
}
400407
},
408+
"outputs": [],
401409
"source": [
402410
"dataset.headers[\"cdp_y\"].compute()"
403-
],
404-
"outputs": [],
405-
"execution_count": null
411+
]
406412
},
407413
{
408414
"cell_type": "markdown",
@@ -423,11 +429,13 @@
423429
},
424430
{
425431
"cell_type": "code",
432+
"execution_count": null,
426433
"metadata": {
427434
"pycharm": {
428435
"name": "#%%\n"
429436
}
430437
},
438+
"outputs": [],
431439
"source": [
432440
"xl_dataset = dataset.sel(crossline=100) # slices everything available in MDIO dataset!\n",
433441
"\n",
@@ -447,9 +455,7 @@
447455
"hdr_ax.set_xlabel(\"\")\n",
448456
"\n",
449457
"plt.tight_layout()"
450-
],
451-
"outputs": [],
452-
"execution_count": null
458+
]
453459
},
454460
{
455461
"cell_type": "markdown",
@@ -470,11 +476,13 @@
470476
},
471477
{
472478
"cell_type": "code",
479+
"execution_count": null,
473480
"metadata": {
474481
"pycharm": {
475482
"name": "#%%\n"
476483
}
477484
},
485+
"outputs": [],
478486
"source": [
479487
"from mdio import mdio_to_segy\n",
480488
"\n",
@@ -483,9 +491,7 @@
483491
" output_path=\"filt_mig_roundtrip.sgy\",\n",
484492
" segy_spec=teapot_segy_spec,\n",
485493
")"
486-
],
487-
"outputs": [],
488-
"execution_count": null
494+
]
489495
},
490496
{
491497
"cell_type": "markdown",
@@ -511,11 +517,13 @@
511517
},
512518
{
513519
"cell_type": "code",
520+
"execution_count": null,
514521
"metadata": {
515522
"pycharm": {
516523
"name": "#%%\n"
517524
}
518525
},
526+
"outputs": [],
519527
"source": [
520528
"import numpy as np\n",
521529
"from segy import SegyFile\n",
@@ -536,22 +544,17 @@
536544
" np.testing.assert_equal(original_segy.trace[idx], roundtrip_segy.trace[idx])\n",
537545
"\n",
538546
"print(\"Files identical!\")"
539-
],
540-
"outputs": [],
541-
"execution_count": null
547+
]
542548
},
543549
{
544550
"cell_type": "code",
551+
"execution_count": null,
545552
"metadata": {},
546-
"source": [],
547553
"outputs": [],
548-
"execution_count": null
554+
"source": []
549555
}
550556
],
551557
"metadata": {
552-
"mystnb": {
553-
"execution_mode": "force"
554-
},
555558
"kernelspec": {
556559
"display_name": "Python 3 (ipykernel)",
557560
"language": "python",
@@ -569,6 +572,9 @@
569572
"pygments_lexer": "ipython3",
570573
"version": "3.13.5"
571574
},
575+
"mystnb": {
576+
"execution_mode": "force"
577+
},
572578
"widgets": {
573579
"application/vnd.jupyter.widget-state+json": {
574580
"state": {

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "multidimio"
3-
version = "1.0.6"
3+
version = "1.0.7"
44
description = "Cloud-native, scalable, and user-friendly multi dimensional energy data!"
55
authors = [{ name = "Altay Sansal", email = "[email protected]" }]
66
requires-python = ">=3.11,<3.14"
@@ -181,7 +181,7 @@ init_typed = true
181181
warn_required_dynamic_aliases = true
182182

183183
[tool.bumpversion]
184-
current_version = "1.0.6"
184+
current_version = "1.0.7"
185185
allow_dirty = true
186186
commit = false
187187
tag = false

0 commit comments

Comments
 (0)