Example #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();
}
Example #2
0
RegularSurfaceRotated<A>::RegularSurfaceRotated()
:angle_(0),
 x_ref_(0.0),
 y_ref_(0.0)
{
  surface_ = RegularSurface<A>();
  CalculateMinMaxXY();
}
Example #3
0
void RegularSurfaceRotated<A>::SetDimensions(double x_min, double y_min,
                                             double lx, double ly)
{
  surface_.SetDimensions(x_min, y_min, lx, ly);

  x_ref_ = x_min;
  y_ref_ = y_min;
  CalculateMinMaxXY();
}
Example #4
0
RegularSurfaceRotated<A>::RegularSurfaceRotated(const RegularSurface<A>& surface, double angle)
  : angle_(angle)
{
  surface_ = surface;
  x_ref_   = surface.GetXMin();
  y_ref_   = surface.GetYMin();
  SetMissingValue(surface.GetMissingValue());
  CalculateMinMaxXY();
}
Example #5
0
RegularSurfaceRotated<A>::RegularSurfaceRotated(double x_ref, double y_ref,
                                                double lx, double ly,
                                                Grid2D<A> grid, double angle)
  : angle_(angle),
    x_ref_(x_ref),
    y_ref_(y_ref)
{
  surface_ = RegularSurface<A>(x_ref, y_ref, lx, ly, grid);
  CalculateMinMaxXY();
}
Example #6
0
RegularSurfaceRotated<A>::RegularSurfaceRotated(double x_min, double y_min,
                                  double lx, double ly,
                                  size_t nx, size_t ny, double angle,
                                  const A& value)
  : angle_(angle),
    x_ref_(x_min),
    y_ref_(y_min)
{
  surface_ = RegularSurface<A>(x_min,y_min,lx,ly,nx,ny,value);
  CalculateMinMaxXY();
}
Example #7
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();
}