Skip to content

Commit 90c92c4

Browse files
raplimajokva
authored andcommitted
Improve SEGY_INVALID_SORTING message
'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.
1 parent 51c74f2 commit 90c92c4

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ just a collection of traces in arbitrary order, this would fail.
604604

605605
#### Possible solutions
606606

607+
Check if segyio.open `iline` and `xline` input parameters are correct for current file.
607608
Segyio supports files that are just a collection of traces too, but has to be
608609
told that it's ok to do so. Pass `strict = False` or `ignore_geometry = True`
609610
to `segyio.open` to allow or force unstructured mode respectively. Please note

Diff for: python/segyio/segyio.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ PyObject* RuntimeError( int err ) {
9393
return RuntimeError( msg.c_str() );
9494
}
9595

96+
template< typename T1, typename T2 >
97+
PyObject* RuntimeError( const char* msg, T1 t1, T2 t2 ) {
98+
return PyErr_Format( PyExc_RuntimeError, msg, t1, t2 );
99+
}
100+
96101
PyObject* IOErrno() {
97102
return PyErr_SetFromErrno( PyExc_IOError );
98103
}
@@ -841,7 +846,10 @@ struct metrics_errmsg {
841846
"or offset (%i) field", il, xl, of );
842847

843848
case SEGY_INVALID_SORTING:
844-
return RuntimeError( "unable to find sorting." );
849+
return RuntimeError( "unable to find sorting."
850+
"Check iline, (%i) and xline (%i) "
851+
"in case you are sure the file is "
852+
"a 3D sorted volume", il, xl);
845853

846854
default:
847855
return Error( err );

0 commit comments

Comments
 (0)