Tag Archives: Bug And Debug

[Solved] Segyio Error: Runtime Error trace count inconsistent with file size, trace lengths … #401

Article catalog

Run segyio to read segy files and report errors. Troubleshooting error cause reference

An error occurs when running segyio to read the segy file

"RuntimeError: trace count inconsistent with file size, trace lengths possibly of non-uniform"

Solution:

(1) Add: endian ='little '

with segyio.open('test.sgy','r',ignore_geometry=True,endian='little') as f:

(2) If it still fails:
check the length of the data trace. Segyio’s default trace has the same number and format of sampling points. If the length of the trace in the segy file is inconsistent, it may lead to reading errors.

Error reason

Detailed explanation of big endian and little endian
the default bytes of files read by segyio are encoded according to big endian, while your files are written according to little endian bytes

Visual studio console program output window flashed by

Write at the front:
This blog post introduces a little annoying problem solving that isn’t a bug. Programming with Visual Studio often uses the console output window, but there is always a situation where the window flashes past and it is difficult to see the output of the program. Here, I write a blog post to record it, so as not to forget or make similar mistakes in the same type of problem.
Solution:
1. In the last line of the program, return 0, add system(” pause “) or getchar(); It solves some problems, which I often do when I do some OJ tests in order to test in my IDE;
2. Don’t Press F5 to run the program, Ctrl + F5 instead, a window will be displayed like this: “Press any key tocontinue…” The words. The reason is that F5 is in Debugging mode, while CTRL +F5 is in Start Without Debugging mode. I found this on the Internet. Can really solve the problem, but their lack of practical theoretical knowledge to support, so in the future to read a lot of attention to the process.