Skip to content

Commit

Permalink
Improve SEGY_INVALID_SORTING message
Browse files Browse the repository at this point in the history
'unable to find sorting' exception is also raised if user doesn't
compare file iline/xline bytes position with segyio.open default values
for iline, xline arguments. Updated possible solutions might help users
catch that faster, and error message might help users catch that.
  • Loading branch information
raplima authored and jokva committed Apr 21, 2020
1 parent 51c74f2 commit 90c92c4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ just a collection of traces in arbitrary order, this would fail.

#### Possible solutions

Check if segyio.open `iline` and `xline` input parameters are correct for current file.
Segyio supports files that are just a collection of traces too, but has to be
told that it's ok to do so. Pass `strict = False` or `ignore_geometry = True`
to `segyio.open` to allow or force unstructured mode respectively. Please note
Expand Down
10 changes: 9 additions & 1 deletion python/segyio/segyio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ PyObject* RuntimeError( int err ) {
return RuntimeError( msg.c_str() );
}

template< typename T1, typename T2 >
PyObject* RuntimeError( const char* msg, T1 t1, T2 t2 ) {
return PyErr_Format( PyExc_RuntimeError, msg, t1, t2 );
}

PyObject* IOErrno() {
return PyErr_SetFromErrno( PyExc_IOError );
}
Expand Down Expand Up @@ -841,7 +846,10 @@ struct metrics_errmsg {
"or offset (%i) field", il, xl, of );

case SEGY_INVALID_SORTING:
return RuntimeError( "unable to find sorting." );
return RuntimeError( "unable to find sorting."
"Check iline, (%i) and xline (%i) "
"in case you are sure the file is "
"a 3D sorted volume", il, xl);

default:
return Error( err );
Expand Down

0 comments on commit 90c92c4

Please sign in to comment.