mistie_correction_segy.py
#
Compensate mistie for SEG-Y file(s) via cross-correlation of nearest traces of intersecting lines.
jit(*args, **kwargs)
#
create_geometries(df, coord_cols=['x', 'y'], idx_col='line_id')
#
Create shapely
geometries from input dataframe.
Parameters:
-
df
(DataFrame
) –Input dataframe holding merged navigation of all SEG-Y files to process.
-
coord_cols
(list
, default:['x', 'y']
) –Column names of X and Y coordinates (default: [
x
,y
]). -
idx_col
(str
, default:'line_id'
) –Column name holding corresponding line indices (default:
line_id
).
Returns:
-
linestrings
(ndarray(n)
) –Array of LineString geometries (
shapely.geometry.LineString
) ofn
input lines (i.e. SEG-Y files). -
points_split
(ndarray(n)
) –Array of coordinate arrays ((k,2)) with X and Y columns where
n
is the number of lines (i.e. SEG-Y files) andk
the number of vertices (i.e. shotpoints) per line. -
points_line_idx
(ndarray(n * k)
) –Array of line indices for each point (i.e. shotpoint).
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
find_intersections(linestrings)
#
Find all intersections of input array of LineStrings.
Returns array of Points (shapely.geometry.Point
) with array of their indices and
corresponding line intersection indices array (referring to input).
Parameters:
-
linestrings
(ndarray
) –Array of
shapely.geometry.LineString
geometries for each SEG-Y file from:1. navigation file or 2. read from SEG-Y trace headers.
Returns:
-
intersections_pts_exploded
(ndarray
) –Array of exploded intersection points (
shapely.geometry.Point
). -
intersections_pts_exploded_idx
(ndarray
) –Index array of exploded intersection points (referring to rows of
line_intersections_idx
). -
line_intersections_idx
(ndarray
) –Array of line intersection indices referring to input linestring array.
Notes#
The point array returns the exploded version of detected geometries (i.e. separated segments of multipart features). For multiple intersections of a line pair, this results in multiple geometries with identical reference indices and, thus, could result in a larger number of output features.
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
nearest_intersection_vertices(points_split, intersections_pts_exploded, line_intersections_idx)
#
Return nearest intersection vertex indices and corresponding distances to
intersection point for both intersecting lines referenced in input index
array line_intersections_idx
.
Parameters:
-
points_split
(ndarray(n)
) –Array of coordinate arrays ((k,2)) with X and Y columns where
n
is the number of lines (i.e. SEG-Y files) andk
the number of vertices (i.e. shotpoints) per line. -
intersections_pts_exploded
(ndarray(j)
) –Array of intersection points (exploded).
-
line_intersections_idx
(ndarray
) –Array of line intersection indices referring to input point array.
Returns:
-
nearest_0
(ndarray
) –Array of nearest line vertex indices and distance for each intersection based on first line (i.e. column 0 in
line_intersections_idx
). -
nearest_1
(ndarray
) –Array of nearest line vertex indices and distance for each intersection based on second line (i.e. column 1 in
line_intersections_idx
).
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
load_trace(path, idx_tr, check_bad_traces=False, ntraces2mix=3)
#
Load and return single trace from SEG-Y file.
Parameters:
-
path
(str
) –File path to SEG-Y on disk.
-
idx_tr
(int
) –Index of trace to load (starting at 0).
-
check_bad_traces
(bool
, default:False
) –Simple check if loaded trace is too bad/noisy by testing if amplitude mean or rescaled trace is greater than 0.4 (default:
False
). -
ntraces2mix
(int
, default:3
) –Number of traces to load and average if bad trace was detected. The "bad" trace is excluded from averaging (default:
3
).
Returns:
-
trace
(ndarray(nsamples)
) –Array of trace amplitudes.
-
dt
(float
) –Sampling rate (in ms).
-
twt
(ndarray
) –Array of samples with appropriate intervals (determined by
dt
).
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
compute_misties(segy_dir, line_intersections_names, line_intersections_idx, nearest_0, nearest_1, win=(False, False), quality=0, lookup_df=None, lookup_col=None, check_bad_traces=False, ntraces2mix=3, return_ms=False, return_coeff=False, verbosity=1)
#
Compute mistie at line intersections (in number of samples). Returns tuple of single shift per input line and shift per line vertex. Option to additionally return shift in milliseconds (ms) and/or cross-correlation coefficients (i.e. quality indicator).
Parameters:
-
segy_dir
(str
) –Directory path of SEG-Y files.
-
line_intersections_names
(ndarray
) –Array of string objects of SEG-Y names.
-
line_intersections_idx
(ndarray
) –Index array of SEG-Y names.
-
nearest_0
(ndarray
) –Array of nearest line vertex indices and distance for each intersection based on first line (i.e. column 0 in
line_intersections_idx
). -
nearest_1
(ndarray
) –Array of nearest line vertex indices and distance for each intersection. based on second line (i.e. column 1 in
line_intersections_idx
). -
win
(tuple
, default:(False, False)
) –Upper and lower limit of two-way traveltime (TWT) window used for cross-correlation. If (False, False), full overlapping trace range is used.
-
quality
(float
, default:0
) –Threshold quality of cross-correlations to include to solve for global offsets (default:
0
, i.e. only positive correlations). -
lookup_df
(DataFrame
, default:None
) –Dataframe with index set corresponding to names in
line_intersections_names
and column of acutal file names to use. Default: None (i.e. using file name from provided array). -
lookup_col
(str
, default:None
) –Column name with reference SEG-Y file names (default:
None
). -
check_bad_traces
(bool
, default:False
) –Simple check if loaded trace is too bad/noisy by testing if amplitude mean or rescaled trace is greater than 0.4 (default:
False
). -
ntraces2mix
(int
, default:3
) –Number of traces to load and average if bad trace was detected. The "bad" trace is excluded from averaging (default:
3
). -
return_ms
(bool
, default:False
) –Return shift in milliseconds (ms) (default:
False
). -
return_coeff
(bool
, default:False
) –Return cross-correlation coefficients (i.e. quality indicator). Default: False.
-
verbosity
(int
, default:1
) –Control level of output messages (default:
1
, i.e.info
).
Returns:
-
offsets
(ndarray
) –Array of sample shift per line with shape (nlines,).
-
offsets_ms
(ndarray
) –Array of shift (in milliseconds) per line with shape (nlines,).
-
coeff
(ndarray
) –Array of quality indications (Pearson’s correlation coefficient).
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
|
euclidian_distance(a, b)
#
Calculate euclidian distance between array of points (n,2) and single point (2,).
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
cross_correlation_shift(cc)
#
Return cross-correlation shift (in samples) between correlated signals.
Parameters:
-
cc
(ndarray
) –Cross-correlation between two signals (1D).
Returns:
-
shift
(int
) –Lag shift between both signals.
shift
< 0 ---> signal A later than signal Bshift
> 0 ---> signal A earlier than signal B
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
compensate_mistie(data, mistie, verbosity=1)
#
Apply computed static offsets to seismic traces (2D array).
Parameters:
-
data
(ndarray
) –2D array of input seismic traces (
samples
xtraces
). -
mistie
((int, float)
) –1D array of mistie offsets (for all traces).
Returns:
-
data_mistie
(ndarray(s)
) –Compensated seismic section.
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
write_intersections_QC(args, pts_split, line_intersections_idx, line_intersections_names, nearest_0, nearest_1, intersections_pts, crs='EPSG:32760')
#
Write GeoPackage of line intersections and nearest traces.
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
main_misties(args)
#
Compute line intersection misties.
Parameters:
-
args
(Namespace
) –Input parameter.
Returns:
-
list_segy
(list
) –List of SEG-Y files to correct.
-
offsets
(ndarray
) –Vertical misties per intersection (in samples).
-
offsets_ms
(ndarray
) –Vertical mistie per intersection (in milliseconds TWT).
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 |
|
wrapper_mistie_correction_segy(in_path, offset, offset_ms, args)
#
Apply computed misties to each line (SEG-Y file).
Source code in pseudo_3D_interpolation\mistie_correction_segy.py
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 |
|