Exemple #1
0
 /**
  * Waveform in sac file.
  *
  * @param sacPath {@link Path} for a sac file
  * @return double[] of waveform data
  * @throws IOException if sacPath does not exist or if an I/O error occurs
  */
 public static double[] readSACData(Path sacPath) throws IOException {
   try (SACInputStream stream = new SACInputStream(sacPath)) {
     stream.skipBytes(79 * 4);
     int npts = stream.readInt();
     double[] data = new double[npts];
     stream.skipBytes(632 - 80 * 4);
     // stream.skipBytes(632);
     // float(4) * 70, int(4) * 40, String (8) * 22 + (16)
     // 4* 70 + 4* 40 + 8* 22 +16 = 632
     for (int i = 0; i < npts; i++) data[i] = stream.readFloat();
     return data;
   }
 }