Inspecting SEG-Y
TraceHeaders
A convenience class for accessing and iterating over a SEG-Y files trace headers. This class should be used with a context manager.
Examples:
>>> with TraceHeaders(segy_file, bytes_filter=bytes_filter, **segyio_kwargs) as headers:
ntraces = headers.ntraces
df = headers.to_dataframe(selection=slice(0, 100)))
Source code in segysak/segy/_segy_headers.py
Python | |
---|---|
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
to_dataframe(selection=None)
Return the Trace Headers as a DataFrame
Parameters:
Name | Type | Description | Default |
---|---|---|---|
selection
|
Union[int, slice, None]
|
A subset of trace headers will be returned based on trace numbering. |
None
|
Source code in segysak/segy/_segy_headers.py
Python | |
---|---|
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
segy_header_scrape(segy_file, partial_scan=None, bytes_filter=None, chunk=100000, **segyio_kwargs)
Scape all data from segy trace headers
Parameters:
Name | Type | Description | Default |
---|---|---|---|
segy_file
|
Union[str, PathLike]
|
SEG-Y File path |
required |
partial_scan
|
Union[int, None]
|
Setting partial scan to a positive int will scan only that many traces. Defaults to None. |
None
|
bytes_filter
|
Union[List[int], None]
|
List of byte locations to load exclusively. |
None
|
chunk
|
int
|
Number of traces to read in one go. |
100000
|
segyio_kwargs
|
Any
|
Arguments passed to segyio.open |
{}
|
Returns:
Type | Description |
---|---|
DataFrame
|
pandas.DataFrame: Raw header information in table for scanned traces. |
Source code in segysak/segy/_segy_headers.py
Python | |
---|---|
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 213 214 215 216 217 218 |
|
segy_bin_scrape(segy_file, **segyio_kwargs)
Scrape binary header
Parameters:
Name | Type | Description | Default |
---|---|---|---|
segy_file
|
Union[str, PathLike]
|
SEG-Y file path |
required |
segyio_kwargs
|
Any
|
Arguments passed to segyio.open |
{}
|
Returns:
Type | Description |
---|---|
Dict
|
Binary header key value pairs |
Source code in segysak/segy/_segy_headers.py
Python | |
---|---|
165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
segy_header_scan(segy_file, max_traces_scan=1000, **segyio_kwargs)
Perform a scan of the segy file headers and return ranges.
To get the complete raw header values see segy_header_scrape
Parameters:
Name | Type | Description | Default |
---|---|---|---|
segy_file
|
Union[str, PathLike]
|
SEG-Y file path |
required |
max_traces_scan
|
int
|
Number of traces to scan. For scan all traces set to <= 0. Defaults to 1000. |
1000
|
segyio_kwargs
|
Any
|
Arguments passed to segyio.open |
{}
|
Returns:
Type | Description |
---|---|
DataFrame
|
Uses pandas describe to return statistics of your headers. |
Source code in segysak/segy/_segy_headers.py
Python | |
---|---|
132 133 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 |
|
get_segy_texthead(segy_file, ext_headers=False, no_richstr=False, **segyio_kwargs)
Return the ebcidc header as a Python string. New lines are separated by the \n
char.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
segy_file
|
Union[str, PathLike]
|
Segy File Path |
required |
ext_headers
|
bool
|
Return EBCIDC and extended headers in list. Defaults to False |
False
|
no_richstr
|
bool
|
Defaults to False. If true the returned string will not be updated for pretty HTML printing. |
False
|
segyio_kwargs
|
Dict[str, Any]
|
Key word arguments to pass to segyio.open |
{}
|
Returns:
Name | Type | Description |
---|---|---|
text |
str
|
Returns the EBCIDC text as a formatted paragraph. |
Source code in segysak/segy/_segy_text.py
Python | |
---|---|
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
header_as_dimensions(head_df, dims)
Convert dim_kwargs to a dictionary of dimensions. Also useful for checking geometry is correct and unique for each trace in a segy file header.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
head_df
|
DataFrame
|
The header DataFrame from |
required |
dims
|
tuple
|
Dimension names as per head_df column names. |
required |
Returns:
Name | Type | Description |
---|---|---|
dims |
Dict[str, array]
|
Dimension name and label pairs. |
Source code in segysak/segy/_segy_headers.py
Python | |
---|---|
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|