Class BaseElevationModel

java.lang.Object
org.esa.snap.core.dataop.dem.BaseElevationModel
All Implemented Interfaces:
ElevationModel, Resampling.Raster

public abstract class BaseElevationModel extends Object implements ElevationModel, Resampling.Raster
  • Field Details

    • NUM_X_TILES

      protected final int NUM_X_TILES
    • NUM_Y_TILES

      protected final int NUM_Y_TILES
    • NUM_PIXELS_PER_TILE_X

      protected int NUM_PIXELS_PER_TILE_X
    • NUM_PIXELS_PER_TILE_Y

      protected int NUM_PIXELS_PER_TILE_Y
    • NUM_PIXELS_PER_TILE_X_inv

      protected double NUM_PIXELS_PER_TILE_X_inv
    • NUM_PIXELS_PER_TILE_Y_inv

      protected double NUM_PIXELS_PER_TILE_Y_inv
    • NO_DATA_VALUE

      protected final double NO_DATA_VALUE
    • DEGREE_RES

      protected int DEGREE_RES
    • RASTER_WIDTH

      protected int RASTER_WIDTH
    • RASTER_HEIGHT

      protected int RASTER_HEIGHT
    • DEGREE_RES_BY_NUM_PIXELS_PER_TILE_X

      protected double DEGREE_RES_BY_NUM_PIXELS_PER_TILE_X
    • DEGREE_RES_BY_NUM_PIXELS_PER_TILE_Y

      protected double DEGREE_RES_BY_NUM_PIXELS_PER_TILE_Y
    • DEGREE_RES_BY_NUM_PIXELS_PER_TILE_X_inv

      protected double DEGREE_RES_BY_NUM_PIXELS_PER_TILE_X_inv
    • DEGREE_RES_BY_NUM_PIXELS_PER_TILE_Y_inv

      protected double DEGREE_RES_BY_NUM_PIXELS_PER_TILE_Y_inv
    • descriptor

      protected final ElevationModelDescriptor descriptor
    • elevationFiles

      protected final ElevationFile[][] elevationFiles
    • resampling

      protected final Resampling resampling
    • resamplingRaster

      protected final Resampling.Raster resamplingRaster
  • Constructor Details

  • Method Details

    • getResampling

      public Resampling getResampling()
      Specified by:
      getResampling in interface ElevationModel
      Returns:
      The resampling method used.
    • getDescriptor

      public ElevationModelDescriptor getDescriptor()
      Description copied from interface: ElevationModel
      Gets the descriptor of this DEM.
      Specified by:
      getDescriptor in interface ElevationModel
      Returns:
      the descriptor which is never null
    • setMaxCacheSize

      protected void setMaxCacheSize(int size)
    • getElevation

      public double getElevation(GeoPos geoPos) throws Exception
      Description copied from interface: ElevationModel
      Gets the elevation at the geographical coordinate in meters.
      Specified by:
      getElevation in interface ElevationModel
      Parameters:
      geoPos - the geographical coordinate
      Returns:
      an elevation in meters, or the special value returned by ElevationModelDescriptor.getNoDataValue() if an elevation is not available
      Throws:
      Exception - if a non-runtime error occurs, e.g I/O error
    • getIndexX

      public abstract double getIndexX(GeoPos geoPos)
    • getIndexY

      public abstract double getIndexY(GeoPos geoPos)
    • getGeoPos

      public abstract GeoPos getGeoPos(PixelPos pixelPos)
      Description copied from interface: ElevationModel
      Gets the geographical coordinates for the input pixel coordinates in the DEM reference system.
      Specified by:
      getGeoPos in interface ElevationModel
      Parameters:
      pixelPos - the pixel (x,y) coordinate
      Returns:
      (lat, lon) geographical coordinates in the reference system of a given DEM
    • getIndex

      public PixelPos getIndex(GeoPos geoPos)
      Description copied from interface: ElevationModel
      Gets the pixel index in the DEM reference system at the geographical coordinate in meters.
      Specified by:
      getIndex in interface ElevationModel
      Parameters:
      geoPos - the geographical coordinate
      Returns:
      (x, y) coordinates in the reference system of a given DEM
    • getWidth

      public int getWidth()
      Description copied from interface: Resampling.Raster
      Gets the raster's width.
      Specified by:
      getWidth in interface Resampling.Raster
      Returns:
      the raster's width
    • getHeight

      public int getHeight()
      Description copied from interface: Resampling.Raster
      Gets the raster's height.
      Specified by:
      getHeight in interface Resampling.Raster
      Returns:
      the raster's height
    • updateCache

      public void updateCache(ElevationTile tile)
    • getSample

      public final double getSample(double pixelX, double pixelY) throws Exception
      Description copied from interface: ElevationModel
      Gets the elevation at the point defined by (x,y) coordinates in DEM reference system. This method does not interpolated the elevation map!
      Specified by:
      getSample in interface ElevationModel
      Parameters:
      pixelX - coordinate
      pixelY - coordinate
      Returns:
      an elevation in meters, or the special value returned by ElevationModelDescriptor.getNoDataValue() if an elevation is not available
      Throws:
      Exception - if a non-runtime error occurs, e.g I/O error
    • getSamples

      public final boolean getSamples(int[] xArray, int[] yArray, double[][] samples) throws Exception
      Description copied from interface: ElevationModel
      Gets the elevations at the points defined by (x,y) coordinates in DEM reference system. This method does not interpolated the elevation map!
      Specified by:
      getSamples in interface ElevationModel
      Specified by:
      getSamples in interface Resampling.Raster
      Parameters:
      xArray - coordinate
      yArray - coordinate
      samples - output elevation in meters, or the special value returned by ElevationModelDescriptor.getNoDataValue() if an elevation is not available
      Returns:
      false if all values are nodata value
      Throws:
      Exception - if a non-runtime error occurs, e.g I/O error
    • dispose

      public void dispose()
      Description copied from interface: ElevationModel
      Releases all of the resources used by this object instance and all of its owned children. Its primary use is to allow the garbage collector to perform a vanilla job.

      This method should be called only if it is for sure that this object instance will never be used again. The results of referencing an instance of this class after a call to dispose() are undefined.

      Overrides of this method should always call super.dispose(); after disposing this instance.

      Specified by:
      dispose in interface ElevationModel
    • createElevationFile

      protected abstract void createElevationFile(ElevationFile[][] elevationFiles, int x, int y, File demInstallDir)
    • getReaderPlugIn

      protected static ProductReaderPlugIn getReaderPlugIn(String formatName)