Problems with reading CSS file using the i4 format

Good day,
I’ve been struggling with the CSS read problem for a couple of weeks now; though with some partial success here in the field. The digitizers that are used in the Kyrgyzstan stations are of Russian manufacture, and their CSS files are now successfully integrated into my calibration software. Unfortunately, the CSS files that are used in the Kazakhstan networks use a variation of the CSS3.0 format that utilizes an “i4” data format. This format appears to not be supported within the Obspy read() function. When I attempt to load the file, I get the following:

I note that there was another discussion in November, 2014 about this issue. Does anyone know if there has been any resolution to this problem ? This is a format type which I really need to use. I have version 0.9.2-py2.7-win-amd64 installed on my computer.

The sample files that contain this css data format are found at:

https://github.com/tychoaussie/sample_data

Does anyone have any suggestions on how I can get around this showstopper? This is my last day here, and we fly back to the USA in about 17 hours. In most other aspects the trip has been a success, however. We are now field calibrating sensors from vault through digitizer across the entire pass band in just a couple of hours. The field kit & software are still a bit clunky, and the software needs lots of streamlining & error trapping, but otherwise shows potential.

  • Dan Burk
    Michigan State University

Dan,

I just had a quick look through Tobias’s reply from November - it is fixed in the obspy master version - so you will either need to update your version to the master branch or try to patch the difference (I’ve given that a go and it’s attached here - core_p.py). The diff Tobias sent is attached as well - all I have done is just merged that with the css/core.py and added the Python 2 frombuffer function as obspy.core.compatibility doesn’t seem to exist in 0.9.2. I haven’t done much testing other than your test data but it doesn’t throw any errors and produces believable traces.

Hope this helps!

David


[core_p.py|attachment](upload://vtav1yjCSRBaJ8wx3zKDNEyMaET.py) (3.65 KB)



[diff|attachment](upload://7DvAG8EEL29oMpkNILUCsik0Jqa) (3.71 KB)

Hi Dan,

I thought all was good, since you did not reply to my last answer and I
could read the files just fine (after removing the lines with missing
files, and explicitely specifying format="CSS", since you don't conform
with wdf file conventions strictly it seems).
Now I checked again and I saw that support for 'i4' was added after
release of 0.9.2 (see here: https://github.com/obspy/obspy/pull/881). So
you have two options:
- install a current master development version
- hack your installation's obspy/css/core.py, i think just adding this
change could work already:
https://github.com/obspy/obspy/pull/881/files#diff-51b7265aa256af1927645711966a7199R22

hope it helps,
Tobias

I will try this for now, but I will need to be able to get a revised Obspy onto computers of technicians in central Asia. This goes well beyond my experience base - I could use a little help with making an update procedure that they can follow.

Hello,
I tried to integrate the hack onto my 0.9.2-py2.7-win-amd64 system by replacing the obspy.css.core.py but ran into problems in that the package fails to find the new

from furure.builtins import * # NOQA

I tried to comment it out to see if that would make any difference, but the obspy.core.compatibility import frombuffer also fails.

It looks as if I need to compile and install the latest master>? This is rapidly going beyond my computer experience and into black magic territory :confused:
Sorry about the ignorance on my part -

Hello Tobias. I was away from obspy for a while, I had a couple of hard months here at work, and now I am back working with this program. I wanted to convert some files to mseed but finally I made the program, a little code on C that works now beautiful and loads the mseed files I generate very nice on obspy. But, seeing that the new version fixes some problems with CSS files, I’ll look again into it and let you know again how it went.

Thanks a lot!!

Daniel.

Hi,

I guess you can remove the line importing the frombuffer fct and replace the actual frombuffer() call further down the file with

data = np.frombuffer(data, dtype=read_fmt).copy()

I think this should work but in all honesty: its probably easier to just install the latest master or wait for a new ObsPy version which should hopefully and finally happen in the next days.

All the best,

Lion

Hello to everyone. Wel, I did something just to check the file and if it was possible to open it. I changed the flag in the wfd file to s4, and it opens very well; but the data is shown wrong (which is normal, it is i4, not s4!). And, changing it again to i4, the problem appears again. So… maybe an option to change the byte order when reading the binary files would be great! I’ll look into it.

Daniel.