usgs / swarm

a Java application designed to display and analyze seismic waveforms in real-time.
http://volcanoes.usgs.gov/software/swarm
Other
36 stars 16 forks source link

Division by 0 error when reading SEED file #110

Closed dlnorgaard closed 6 years ago

dlnorgaard commented 7 years ago

2017-06-06 08:49:25 INFO - user input file type: D:\Data\Seismic Test Data\SaudiArabia\SEED\20090405 -> SEED/miniSEED file java.lang.ArithmeticException: / by zero at gov.usgs.plot.data.file.SeedDataFile.join(SeedDataFile.java:156) at gov.usgs.plot.data.file.SeedDataFile.read(SeedDataFile.java:118) at gov.usgs.volcanoes.swarm.data.FileDataSource$1.construct(FileDataSource.java:155) at gov.usgs.volcanoes.swarm.SwingWorker$2.run(SwingWorker.java:108) at java.lang.Thread.run(Thread.java:745)

dlnorgaard commented 7 years ago

See https://github.com/crotwell/seisFile/issues/7. We'll need to update to 1.8.0 of seisFile when it is released.

dlnorgaard commented 6 years ago

Tested seisFile 1.8.0 but still getting an error with this file, albeit a different one. Will dig into it more. Other SEED files seem to read fine as before.

2017-11-28 09:13:52 INFO - user input file type: D:\Data\Seismic Test Data\SaudiArabia\SEED\20090407 -> SEED/miniSEED file java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at gov.usgs.volcanoes.core.data.file.SeedDataFile.join(SeedDataFile.java:159) at gov.usgs.volcanoes.core.data.file.SeedDataFile.read(SeedDataFile.java:114) at gov.usgs.volcanoes.swarm.data.FileDataSource$1.construct(FileDataSource.java:155) at gov.usgs.volcanoes.swarm.SwingWorker$2.run(SwingWorker.java:111) at java.lang.Thread.run(Thread.java:748)

dlnorgaard commented 6 years ago

Upon rereading crotwell's comments I realized I needed to add following code to gov.usgs.volcanoes.core.data.file.SeedDataFile (lines 108-117):

    Blockette[] blocketts = dr.getBlockettes(100);
    float sampleRate;
    if (blocketts.length != 0) {
      Blockette100 b100 = (Blockette100) blocketts[0];
      sampleRate = b100.getActualSampleRate();
    } else {
      sampleRate = dh.getSampleRate();
    }
    sampleRates.put(code, sampleRate);

This fixed the problem.