HZeyen / PyRefra

Software package for treatment and tomography of multishot refraction seismic data
GNU General Public License v3.0
8 stars 0 forks source link

Bug in reading file seg2 #5

Open asharsae opened 4 months ago

asharsae commented 4 months ago

Dear Mr. Hermann I intend to ask about problems related to solving bugs in the seg2.py file in obspy. I've followed the installation instructions from GitHub and run the program for my field data in Pyrefra. At first I didn't have any problems with the 24 geophones field data but when I ran the field data with 7 geophones it read an error "Has obspy bug "NOTE" been corrected?". How to solve it?

HZeyen commented 3 months ago

Hi, would you please send me a data sample together with the files receivers.geo and shots.geo? Without this, it is impossible to solve the problem. Please use email (I don't really know how to use github): hermann.zeyen@universite-paris-saclay.fr Cheers, Hermann

asharsae commented 3 months ago

I have sent it to your email. I sincerely appreciate your help, thank you for your feedback

HZeyen commented 3 months ago

Dear Ashar,

There is a problem with your data, they do not have standard SEG2 format. I use obspy to read the data and obspy says: "File indicates 7 traces, but there are only 0 trace pointers." What does it mean?

If you search the description of SEG2 format, you will see that in the beginning of a file, there is a File Descriptor Block. In bytes 4 and 5, there should be a number "Size of Trace Pointer Sub-block", which is typically equal to 4*N where N is the number of traces stored in the file (factor 4 because the pointers are written as Integer values in 4 bytes). However, in your data, there is a 0 and this is not possible.

Since the routine used to read the data file is not mine, but I am using an external library, is is difficult to solve this problem. I will see whether I can do something, but you should contact the obspy programmers and report a problem. Better even, you contact the enterprise who sold you the seismograph and mention this problem. They really should change there acquisition program to make the data real SEG2 data (see also the following part). Seg2 headers should contain the key words "RECEIVER STATION NUMBER and SOURCE STATION NUMBER. Also the values of "SOURCE_LOCATION" and "RECEIVER LOCATION" are all zeros, in all files and for all receivers. So, strictly speaking, your data are unusable, they are missing critical information.

Even if this problem was solved, there would be other problems, specific to my program:

1 1 1 1 0. 0 2 2 1 1 0. 0 3 3 1 1 0. 0

If I find a way around in obspy, I will tell you

All the best, Hermann

HZeyen commented 3 months ago

Hi again I found a way around, but your data have even more problems that what I mentioned earlier. e.g., it seems that the number of samples per trace varies from one shot to the next. This was not forseen in PyRefra - why did you aquire data like this, why not have always the same number of data? So, please download the new version of refraData.py and refraPlot.py and copy the file "obspy/io/seg2/seg2.py" to the corresponding position in your Python installation (see manual for this). Please take in mind that this is an ad hoc solution, it should not be perpetualized - your aquisition system should be reprogrammed. One more remark: I saw that the trigger times of your data seem to be wrong, signal does not start at time 0 (or the coordinates in receivers.geo are wrong). This may be corrected in file_corrections.dat, look in the manual for this.

asharsae commented 3 months ago

Hi Hermann,

I have followed your instructions to download new version of refraData.py and refraPlot.py and i have reconstructed the reveivers.geo but it still showed an error. After last showing error in obspy now there is an error in pyrefra "keyError: -1". error_pyres