示例#1
0
 /**
  * Sets resampled coordinates for the specified well log. Uses this directional survey and the
  * log's map coordinates (xe,yn,ze) to compute the resampled coordinates (x1,x2,x3).
  *
  * @param log the well log.
  */
 public void setCoordinates(WellLog log) {
   assert id == log.id : "id of well log and directional survey match";
   Locater locater = new Locater(log.xe, log.yn, log.ze, z, t, p);
   int n = log.z.length;
   log.x1 = new float[n];
   log.x2 = new float[n];
   log.x3 = new float[n];
   for (int i = 0; i < n; ++i) {
     Coordinates.Csm csm = locater.locate(log.z[i]);
     log.x1[i] = (float) csm.x1;
     log.x2[i] = (float) csm.x2;
     log.x3[i] = (float) csm.x3;
   }
 }
示例#2
0
 /**
  * Constructs well header data from the specified file. The file is in Excel CSV
  * (comma-delimited) format.
  *
  * @param fileName file containing well header data.
  */
 public Data(String fileName) {
   try {
     FileInputStream fis = new FileInputStream(fileName);
     Scanner s = new Scanner(fis);
     while (s.hasNextLine()) {
       String line = s.nextLine();
       String[] fields = line.split(",");
       if (fields.length < 10) continue;
       long id = WellLog.idFromString(fields[0]);
       if (id < 0) continue;
       WellHeader wh = new WellHeader();
       wh.id = id;
       try {
         wh.xe = Double.parseDouble(fields[5]);
         wh.yn = Double.parseDouble(fields[4]);
         wh.ze = Double.parseDouble(fields[9]);
         add(wh);
       } catch (NumberFormatException e) {
         // do nothing if well header is missing something
       }
     }
     s.close();
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
示例#3
0
 /**
  * Constructs directional survey data from the specified file. The file is in Excel CSV
  * (comma-delimited) format.
  *
  * @param fileName file containing directional survey data.
  */
 public Data(String fileName) {
   try {
     FileInputStream fis = new FileInputStream(fileName);
     Scanner s = new Scanner(fis);
     long id = -1;
     DoubleList zl = new DoubleList();
     DoubleList tl = new DoubleList();
     DoubleList pl = new DoubleList();
     while (s.hasNextLine()) {
       String line = s.nextLine();
       String[] fields = line.split(",");
       if (fields.length < 4) continue;
       long idline = WellLog.idFromString(fields[0]);
       if (idline < 0) continue;
       if (id < 0) {
         id = idline;
       } else if (id != idline || !s.hasNextLine()) {
         DirectionalSurvey ds = new DirectionalSurvey();
         ds.id = id;
         ds.z = zl.trim();
         ds.t = tl.trim();
         ds.p = pl.trim();
         if (id == 490252304800L) { // Swap theta,phi for this survey!
           double[] temp = ds.t;
           ds.t = ds.p;
           ds.p = temp;
         }
         ds.n = ds.z.length;
         _data.put(id, ds);
         id = idline;
         zl = new DoubleList();
         tl = new DoubleList();
         pl = new DoubleList();
       }
       zl.add(Double.parseDouble(fields[1]));
       tl.add(Double.parseDouble(fields[2]));
       pl.add(Double.parseDouble(fields[3]));
     }
     s.close();
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }