Beispiel #1
0
void RegularSurfaceRotated<A>::ReadFromFile(const std::string& filename,
                                            SurfaceFileFormat  format)
{
  if (format == SURF_UNKNOWN) {
    format = FindSurfaceFileType(filename);
    if (format == SURF_UNKNOWN) {
      throw FileFormatError("Failed to determine file format for surface file: " + filename);
    }
  }

  switch (format) {
    case SURF_IRAP_CLASSIC_ASCII:
      ReadIrapClassicAsciiSurf(filename, surface_, angle_);
      break;
    case SURF_STORM_BINARY:
      ReadStormBinarySurf(filename, surface_);
      angle_ = 0.0;
      break;
    case SURF_SGRI:
      ReadSgriSurf(filename, surface_, angle_);
      break;
    default:
      throw FileFormatError("Reading of file " + filename + " on format " + ToString(format)
                             + " as a rotated grid is currently not supported.");
  }

  x_ref_ = surface_.GetXMin();
  y_ref_ = surface_.GetYMin();

  CalculateMinMaxXY();
}
Beispiel #2
0
void RegularSurfaceRotated<A>::ReadFromFile(std::string       filename,
                                            SurfaceFileFormat format,
                                            double            segy_angle,
                                            double            x_ref,
                                            double            y_ref,
                                            double            lx,
                                            double            ly,
                                            int             * ilxl_area,
                                            int               il0,
                                            int               xl0,
                                            bool              first_axis_il,
                                            double            in_line0,
                                            double            cross_line0,
                                            double            il_step_x,
                                            double            il_step_y,
                                            double            xl_step_x,
                                            double            xl_step_y)
{
  if (format == SURF_UNKNOWN) {
    format = FindSurfaceFileType(filename);
    if (format == SURF_UNKNOWN) {
      throw FileFormatError("Failed to determine file format for surface file: " + filename
                            + "Allowed formats are Irap Classic, Storm binary, Sgri, Multicolumn Ascii (X,Y,Z,IL,XL) and XYZ ascii.");
    }
  }

  switch (format) {
    case SURF_IRAP_CLASSIC_ASCII:
      ReadIrapClassicAsciiSurf(filename, surface_, angle_);
      break;
    case SURF_STORM_BINARY:
      ReadStormBinarySurf(filename, surface_);
      angle_ = 0.0;
      break;
    case SURF_SGRI:
      ReadSgriSurf(filename, surface_, angle_);
      break;
    case SURF_XYZ_ASCII:
      ReadXYZAsciiSurf(filename,
                       surface_,
                       x_ref,
                       y_ref,
                       lx,
                       ly,
                       ilxl_area,
                       il0,
                       xl0,
                       first_axis_il,
                       in_line0, //The last 6 variables are used to create an IL/XL map
                       cross_line0,
                       il_step_x,
                       il_step_y,
                       xl_step_x,
                       xl_step_y);
      angle_ = segy_angle;
      break;
    case SURF_MULT_ASCII:
      ReadMulticolumnAsciiSurf(filename,
                               surface_,
                               x_ref,
                               y_ref,
                               lx,
                               ly,
                               ilxl_area,
                               il0,
                               xl0,
                               first_axis_il);
      angle_ = segy_angle;
      break;
    default:
      throw FileFormatError("Reading of file " + filename + " on format " + GetSurfFormatString(format)
                             + " as a rotated grid is currently not supported.");
  }

  x_ref_ = surface_.GetXMin();
  y_ref_ = surface_.GetYMin();

  CalculateMinMaxXY();
}