SEG-Y text header operations
Use these functions to view or modify existing SEGY text headers or create new segysak compatable text headers.
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 |
|
put_segy_texthead(segy_file, ebcidc, line_counter=True, **segyio_kwargs)
Puts a text header (ebcidc) into a SEG-Y file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
segy_file |
Union[str, PathLike]
|
The path to the file to update. |
required |
ebcidc |
Union[str, List[str], Dict[int, str], ByteString]
|
A standard string, new lines will be preserved. A list or lines to add. A dict with numeric keys for line numbers e.g. {1: 'line 1'}. A pre-encoded byte header to add to the SEG-Y file directly. |
required |
line_counter |
bool
|
Add a line counter with format "CXX " to the start of each line. This reduces the maximum content per line to 76 chars. |
True
|
Source code in segysak/segy/_segy_text.py
Python | |
---|---|
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 |
|
create_default_texthead(override=None)
Returns a simple default textual header dictionary.
Basic fields are auto populated and a dictionary indexing lines 1-40 can be passed to override keyword for adjustment. By default lines 6-34 are empty.
Line length rules apply, so overrides will be truncated if they have >80 chars.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
override |
Union[Dict[int, str], None]
|
Override any line with custom values. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
text_header |
Dict[int, str]
|
Dictionary with keys 1-40 for textual header of SEG-Y file |
Example
Override lines 7 and 8 of the default text header.
>>> create_default_texthead(override={7:'Hello', 8:'World!'})
{1: 'segysak SEG-Y Output',
2: 'Data created by: username ',
3: '',
4: 'DATA FORMAT: SEG-Y; DATE: 2019-06-09 15:14:00',
5: 'DATA DESCRIPTION: SEG-Y format data output from segysak',
6: '',
7: 'Hello',
8: 'World!',
9: '',
...
34: '',
35: '*** BYTE LOCATION OF KEY HEADERS ***',
36: 'CMP UTM-X 181-184, ALL COORDS X100, CMP UTM-Y 185-188',
37: 'INLINE 189-193, XLINE 194-198, ',
38: '',
39: '',
40: 'END TEXTUAL HEADER'}
Source code in segysak/segy/_segy_text.py
Python | |
---|---|
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
|