diff --git a/Dockerfile b/Dockerfile
index 71aa156a..8bc7ccff 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
FROM ghcr.io/sen2vm/sen2vm-build-env:latest AS launcher
-ENV SEN2VM_VERSION=1.2.0
+ENV SEN2VM_VERSION=1.3.0.rc1
WORKDIR /Sen2vm
diff --git a/documentation/Input/DEM_CDSE_Download.md b/documentation/Input/DEM_CDSE_Download.md
index d99a26b1..14d6b89d 100644
--- a/documentation/Input/DEM_CDSE_Download.md
+++ b/documentation/Input/DEM_CDSE_Download.md
@@ -23,7 +23,7 @@
Digital Elevation Models (DEM) are essential for geolocation and orthorectification in Sen2VM. Users can use different types of DEM (cf [Inputs Description](../Input/input_description.md)).
-Sen2VM requires DEM data **organized per square degree** (see §[DEM format requirements](../Input/input_description.md#131-dem)). The recommended way to obtain Copernicus DEM in the correct format is to use the **[CDSE-Copernicus-DEM-downloader](https://github.com/senbox-org/CDSE-Copernicus-DEM-downloader)** tool, which downloads individual 1°×1° geocells from the Copernicus Data Space Ecosystem.
+Sen2VM requires DEM data **organized per square degree** (see §[DEM format requirements](../Input/input_description.md#131-dem)) but can now also handle mosaic of square degrees. The recommended way to obtain Copernicus DEM in the correct format is to use the **[CDSE-Copernicus-DEM-downloader](https://github.com/senbox-org/CDSE-Copernicus-DEM-downloader)** tool, which downloads individual 1°×1° geocells from the Copernicus Data Space Ecosystem.
---
diff --git a/documentation/Input/input_description.md b/documentation/Input/input_description.md
index c14468c7..ca49dc00 100644
--- a/documentation/Input/input_description.md
+++ b/documentation/Input/input_description.md
@@ -174,8 +174,11 @@ For this, as Sen2VM uses SXGEO (OREKIT/RUGGED), a GEOID and a DEM shall be used.
Access to the DEM is provided via a path to a folder containing the dataset.
The DEM must meet the following requirements:
- * it should be split into files or folders (dynamically read) per square degrees,
- * each DEM file (per square degree) shall be readable by gdal.
+
+ * it can be split into files or folders (dynamically read),
+ * each DEM file shall be readable by gdal.
+
+Sen2VM also handles mosaic of square degree DEM.
Examples of DEM structures can be found in [/src/test/resources/DEM/](/src/test/resources/DEM)
diff --git a/pom.xml b/pom.xml
index c6fb2728..dc7155ff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
esa.sen2vm
sen2vm-core
- 1.2.0
+ 1.3.0.rc1
sen2vm-core
https://github.com/sen2vm/sen2vm-core
diff --git a/src/main/java/esa/sen2vm/Sen2VM.java b/src/main/java/esa/sen2vm/Sen2VM.java
index e1b195f7..6644d41d 100644
--- a/src/main/java/esa/sen2vm/Sen2VM.java
+++ b/src/main/java/esa/sen2vm/Sen2VM.java
@@ -22,6 +22,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+
+import java.util.Arrays;
+
import java.util.Vector;
import java.util.HashMap;
import java.util.List;
@@ -44,7 +47,7 @@
import esa.sen2vm.enums.DetectorInfo;
import esa.sen2vm.exception.Sen2VMException;
import esa.sen2vm.input.Configuration;
-import esa.sen2vm.input.GenericDemFileManager;
+import esa.sen2vm.input.DEM.GenericDemFileManager;
import esa.sen2vm.input.OptionManager;
import esa.sen2vm.input.Params;
import esa.sen2vm.input.datastrip.DataStripManager;
@@ -181,7 +184,6 @@ public static void main( String[] args ) throws Sen2VMException, Exception
//Using Sen2VM FileManager
GenericDemFileManager demFileManager = new GenericDemFileManager(config.getDem());
- demFileManager.buildMap(config.getDem());
GeoidManager geoidManager = new GeoidManager(config.getGeoid(), isOverlappingTiles);
DemManager demManager = new DemManager(
@@ -260,11 +262,11 @@ public static void main( String[] args ) throws Sen2VMException, Exception
// Test if no grids exists already
if (config.getOperation().equals(Sen2VMConstants.DIRECT))
{
- safeManager.testifDirectGridsToComputeAlreadyExist(detectors, bands) ;
+ safeManager.testifDirectGridsToComputeAlreadyExist(detectors, bands);
}
else
{
- safeManager.testifInverseGridsToComputeAlreadyExist(detectors, bands, config.getInverseLocOutputFolder()) ;
+ safeManager.testifInverseGridsToComputeAlreadyExist(detectors, bands, config.getInverseLocOutputFolder());
}
for (BandInfo bandInfo: bands)
@@ -339,7 +341,6 @@ public static void main( String[] args ) throws Sen2VMException, Exception
// Correction post build VRT
outputFileManager.correctGeoGrid(inputTIFs);
outputFileManager.correctVRT(vrtFileName);
-
}
// Inverse Loc case
@@ -352,6 +353,7 @@ public static void main( String[] args ) throws Sen2VMException, Exception
double[][] groundGrid = invGrid.get2DgridLatLon();
double[][] inverseLocGrid = simpleLocEngine.computeInverseLoc(sensorList.get(bandInfo.getNameWithB() + "/" + detectorInfo.getNameWithD()), groundGrid, "EPSG:4326");
+
double[][][] grid3D = invGrid.get3Dgrid(inverseLocGrid, georefConventionOffsetPixel, -georefConventionOffsetLine);
String invFileName = datastrip.getCorrespondingInverseLocGrid(detectorInfo, bandInfo, config.getInverseLocOutputFolder());
@@ -372,11 +374,11 @@ public static void main( String[] args ) throws Sen2VMException, Exception
}
outputFileManager.writeInfoJson(config, bands, detectors, outputConfigPath);
}
- catch ( IOException exception )
+ catch (IOException exception)
{
throw new Sen2VMException(exception);
}
- catch ( SXGeoException exception )
+ catch (SXGeoException exception)
{
String newMessage = "";
if(exception.toString().contains("Cant find bundle for base name S2GeoMessages"))
diff --git a/src/main/java/esa/sen2vm/input/DEM/DemTile.java b/src/main/java/esa/sen2vm/input/DEM/DemTile.java
new file mode 100644
index 00000000..dfea4673
--- /dev/null
+++ b/src/main/java/esa/sen2vm/input/DEM/DemTile.java
@@ -0,0 +1,31 @@
+package esa.sen2vm.input.DEM;
+
+public class DemTile
+{
+ public double minX;
+ public double maxX;
+ public double minY;
+ public double maxY;
+ public String filePath;
+
+ public DemTile(double a_minX, double a_maxX, double a_minY, double a_maxY, String filePathString)
+ {
+ minX = a_minX;
+ maxX = a_maxX;
+ minY = a_minY;
+ maxY = a_maxY;
+ filePath = filePathString;
+ }
+
+ public boolean containPoint(double x, double y)
+ {
+ return x >= minX && x <= maxX &&
+ y >= minY && y <= maxY;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "DemTile (" + minX + ";" + maxX + "),(" + minY + ";" + maxY + ")" + filePath;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/esa/sen2vm/input/GenericDemFileManager.java b/src/main/java/esa/sen2vm/input/DEM/GenericDemFileManager.java
similarity index 55%
rename from src/main/java/esa/sen2vm/input/GenericDemFileManager.java
rename to src/main/java/esa/sen2vm/input/DEM/GenericDemFileManager.java
index 5d6ae8e4..13259511 100644
--- a/src/main/java/esa/sen2vm/input/GenericDemFileManager.java
+++ b/src/main/java/esa/sen2vm/input/DEM/GenericDemFileManager.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.*/
-package esa.sen2vm.input;
+package esa.sen2vm.input.DEM;
import org.hipparchus.util.FastMath;
import java.io.File;
@@ -24,6 +24,8 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
import java.util.HashMap;
import java.util.logging.Logger;
@@ -32,9 +34,11 @@
import org.gdal.gdalconst.gdalconstConstants;
import org.sxgeo.input.dem.SrtmFileManager;
+
import org.sxgeo.exception.SXGeoException;
import esa.sen2vm.exception.Sen2VMException;
+import esa.sen2vm.input.DEM.DemTile;
//Extend SrtmFileManager and not DemManager, as an check on the type of instanciation is made if isInstance of SrtmFileManager
@@ -50,22 +54,48 @@ public class GenericDemFileManager extends SrtmFileManager
// Map dem filepath with a string that represents longitude/latitude
// Example: with a SRTM tile on Madeira island located at longitude -16 and latitude 30
- // the correponding map entry will be ("-16/30"="/DEMDIR/DEM_SRTM/w016/n30.dt1")
+ // the corresponding map entry will be ("-16/30"="/DEMDIR/DEM_SRTM/w016/n30.dt1")
// Key corresponding to "longitude/latitude" and value corresponding to the dem filepath.
- Map demFilePathMap = new HashMap<>();
+ Map> demGridMap = new HashMap<>();
/**
* {@inheritDoc}
*/
- public GenericDemFileManager(String demRootDir)
+ public GenericDemFileManager(String demRootDir) throws Sen2VMException
{
super(demRootDir);
+ LOGGER.info("Loading DEM from : " + demRootDir);
+ buildMap(demRootDir);
+ }
+
+
+ private long mapKey(int x, int y)
+ {
+ return (((long) x) << 32) | (y & 0xffffffffL);
+ }
+
+ private void addDemTile(DemTile d)
+ {
+ int xMin = (int)FastMath.floor(d.minX);
+ int xMax = (int)FastMath.floor(d.maxX);
+ int yMin = (int)FastMath.floor(d.minY);
+ int yMax = (int)FastMath.floor(d.maxY);
+
+ for (int x = xMin; x < xMax; x++)
+ {
+ for (int y = yMin; y < yMax; y++)
+ {
+ LOGGER.finer("Loading DEM from : " + x + " " + y);
+ long key = mapKey(x, y);
+ demGridMap.computeIfAbsent(key, k -> new ArrayList<>()).add(d);
+ }
+ }
}
/**
* Build a map that contains dem files
*/
- public void buildMap(String directory) throws Sen2VMException
+ private void buildMap(String directory) throws Sen2VMException
{
try
{
@@ -81,10 +111,14 @@ public void buildMap(String directory) throws Sen2VMException
else
{
String filePath = currentFile.getAbsolutePath();
- String lonlat = getLonLatFromFile(filePath);
- if (lonlat != null)
+ LOGGER.finer("Loading DEM Tile : " + filePath);
+ LOGGER.info("Loading DEM Tile : " + filePath);
+ DemTile newDemTile = getDemTileFromFile(filePath);
+ if (newDemTile != null)
{
- demFilePathMap.put(lonlat, filePath);
+ LOGGER.finer("DEM Tile loaded : " + newDemTile.toString());
+ LOGGER.info("DEM Tile loaded : " + newDemTile.toString());
+ addDemTile(newDemTile);
}
}
}
@@ -104,34 +138,7 @@ public boolean findRasterFile(String directory) throws SXGeoException
{
try
{
- Path dir = FileSystems.getDefault().getPath(directory);
- DirectoryStream stream = Files.newDirectoryStream(dir);
- boolean found = false;
- for (Path path : stream)
- {
- if (!found)
- {
- File currentFile = path.toFile();
- if (currentFile.isDirectory())
- {
- found = findRasterFile(currentFile.getAbsolutePath());
- }
- else
- {
- String filePath = currentFile.getAbsolutePath();
- if ( ( filePath.matches(".*.dt1") ) || ( filePath.matches(".*.dt2") )) {
- found = true;
- }
- }
- if (found)
- {
- stream.close();
- return true;
- }
- }
- }
- stream.close();
- throw new SXGeoException("NO_RASTER_FILE_FOUND_IN_DEM");
+ return (demGridMap.size() != 0);
}
catch (Exception e)
{
@@ -145,8 +152,10 @@ public boolean findRasterFile(String directory) throws SXGeoException
@Override
protected String getRasterFilePath(double latitude, double longitude)
{
- double latFloor = FastMath.floor(FastMath.toDegrees(latitude));
- double lonFloor = FastMath.floor(FastMath.toDegrees(longitude));
+ int latFloor = (int)FastMath.floor(FastMath.toDegrees(latitude));
+ int lonFloor = (int)FastMath.floor(FastMath.toDegrees(longitude));
+
+ LOGGER.finer("Searching DEM Tile for lat " + FastMath.toDegrees(latitude) + " lon " + FastMath.toDegrees(longitude));
// when close to the anti-meridian
if (lonFloor >= 180)
@@ -158,26 +167,38 @@ else if (lonFloor < -180)
lonFloor += 360;
}
- String lonlat = (int) lonFloor + "/" + (int) latFloor;
- String filePath = this.demFilePathMap.get(lonlat);
- if (filePath == null)
+ long key = mapKey(lonFloor, latFloor);
+ List candidates = demGridMap.get(key);
+
+ if (candidates != null)
{
- filePath = "";
+ for (DemTile d: candidates)
+ {
+ if(d.containPoint(FastMath.toDegrees(longitude), FastMath.toDegrees(latitude)))
+ {
+ // LOGGER.finer("DEM TILE FOUND FOR THIS LAT/LON");
+ // LOGGER.finer(d.toString());
+ LOGGER.info("DEM TILE FOUND FOR THIS LAT/LON");
+ LOGGER.info(d.toString());
+ return d.filePath;
+ }
+ }
}
- return filePath;
+
+ return "";
}
/**
- * Get footprint information from file
+ * Get footprint information and create a DemTile object from file
*/
- public String getLonLatFromFile(String filePath)
+ public DemTile getDemTileFromFile(String filePath)
{
gdal.AllRegister();
Dataset dataset = gdal.Open(filePath, gdalconstConstants.GA_ReadOnly);
if (dataset == null)
{
- LOGGER.severe("Error when reading : " + gdal.GetLastErrorMsg());
+ LOGGER.severe("Error when reading : " + gdal.GetLastErrorMsg());
//System.err.println("Error when reading : " + gdal.GetLastErrorMsg());
return null;
}
@@ -186,17 +207,23 @@ public String getLonLatFromFile(String filePath)
double minX = geoTransform[0];
double maxY = geoTransform[3];
- double pixelWidth = geoTransform[1];
- double pixelHeight = geoTransform[5];
-
+ final double pixelWidth = geoTransform[1];
+ final double pixelHeight = geoTransform[5];
+ // DEM convention int Lat/Lon at center
+ minX += pixelWidth/2;
+ maxY += pixelHeight/2;
int imageWidth = dataset.getRasterXSize();
int imageHeight = dataset.getRasterYSize();
-
- double maxX = minX + imageWidth * pixelWidth;
- double minY = maxY + imageHeight * pixelHeight;
+ double maxX = minX + (imageWidth - 1) * pixelWidth;
+ double minY = maxY + (imageHeight - 1) * pixelHeight;
dataset.delete();
- String lonlat = Math.round(minX) + "/" + Math.round(minY);
- return lonlat;
+ minX = Math.round(minX);
+ maxX = Math.round(maxX);
+ minY = Math.round(minY);
+ maxY = Math.round(maxY);
+
+ return new DemTile(minX, maxX, minY, maxY, filePath);
}
+
}
\ No newline at end of file
diff --git a/src/test/java/esa/sen2vm/Sen2VMDirectTest.java b/src/test/java/esa/sen2vm/Sen2VMDirectTest.java
index 1bdf2a04..0ae1e7b7 100644
--- a/src/test/java/esa/sen2vm/Sen2VMDirectTest.java
+++ b/src/test/java/esa/sen2vm/Sen2VMDirectTest.java
@@ -349,9 +349,9 @@ public void testDirectParallelisation()
@Test
public void testDirectDem()
{
- String[] detectors = new String[]{"01"};
+ String[] detectors = new String[]{"08"};
String[] bands = new String[]{"B01"};
- String[] testsDem = new String[]{"dem_1", "dem_2", "dem_3", "dem_4"};
+ String[] testsDem = new String[]{"dem_1", "dem_2", "dem_3", "dem_4", "dem_5", "dem_6"};
int stepBand10m = 600; // corresponding to 6 kms
try
diff --git a/src/test/java/esa/sen2vm/Sen2VMInverseTest.java b/src/test/java/esa/sen2vm/Sen2VMInverseTest.java
index 255beb45..68a43db4 100644
--- a/src/test/java/esa/sen2vm/Sen2VMInverseTest.java
+++ b/src/test/java/esa/sen2vm/Sen2VMInverseTest.java
@@ -368,11 +368,30 @@ public void testInverseAreaHandling()
@Test
public void testInverseDem()
{
- String[] detectors = new String[]{"06"};
+ String[] detectors = new String[]{"08"};
String[] bands = new String[]{"B01", "B02"};
- String[] testsDem = new String[]{"dem_1", "dem_2", "dem_3", "dem_4"};
+ String[] testsDem = new String[]{"dem_1", "dem_2", "dem_3", "dem_4", "dem_5", "dem_6"};
+ // String[] bands = new String[]{"B01"};
+ // String[] testsDem = new String[]{"dem_4", "dem_5"};
int stepBand10m = 6000;
+
+ // ElevationManager elev_dem90_xarray = ElevationManager(
+ // store,
+ // half_pixel_dem_shift=False, # only for ZARR_GETAS for now
+ // geoid_path=geoid_path,
+ // flip_lat=False,
+ // shift_lon=None,
+ // shift_lat=None,
+ // );
+
+ // SimpleTile tile = new SimpleTile();
+ // elev_dem90_xarray.update_tile(latitude, longitude, tile);
+
+
+ // double altitude = tile.interpolate_elevation(latitude, longitude);
+
+
try
{
String nameTest_ref = "testInverseDem_ref";
@@ -391,6 +410,7 @@ public void testInverseDem()
Sen2VM.main(args);
Utils.verifyInverseLoc(config, outputDir_ref);
+ // Utils.verifyInverseLoc(config, outputDir_ref, 0.02);
}
} catch (Sen2VMException e) {
LOGGER.warning(e.getMessage());
diff --git a/src/test/java/esa/sen2vm/Utils.java b/src/test/java/esa/sen2vm/Utils.java
old mode 100644
new mode 100755
index d81551d1..bac03d38
--- a/src/test/java/esa/sen2vm/Utils.java
+++ b/src/test/java/esa/sen2vm/Utils.java
@@ -32,6 +32,9 @@
import java.util.logging.Logger;
import java.util.stream.Stream;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+
import esa.sen2vm.exception.Sen2VMException;
import esa.sen2vm.input.Configuration;
import esa.sen2vm.utils.Sen2VMConstants;
@@ -250,63 +253,121 @@ public static boolean myIsNan(double value){
return false;
}
- public static boolean imagesEqualInverse(String img1Path, String img2Path, double threshold, double res) throws IOException{
+ public static boolean imagesEqualInverse(String img1Path, String img2Path, double threshold, double res) throws IOException {
+
Dataset ds1 = gdal.Open(img1Path, 0);
Dataset ds2 = gdal.Open(img2Path, 0);
+
+ double[] gt = new double[6];
+ ds1.GetGeoTransform(gt);
+
+ boolean isOK = true;
+ int errorCount = 0;
+
+ Path outputFile = Paths.get(Paths.get("target").toAbsolutePath().toString() + "/DebugMVN/debugInverse.txt");
+ // Create directory tree if needed
+ Files.createDirectories(outputFile.getParent());
+
+ LOGGER.info("Wrting output comparison errors in: " + outputFile);
+
+ BufferedWriter writer = Files.newBufferedWriter(outputFile);
+
LOGGER.info("Comparing: " + img1Path + " with " + img2Path);
- if (ds1.GetRasterCount() == ds2.GetRasterCount() && ds1.getRasterXSize() == ds2.getRasterXSize() && ds1.getRasterYSize() == ds2.getRasterYSize()) {
+ if (ds1.GetRasterCount() == ds2.GetRasterCount()
+ && ds1.getRasterXSize() == ds2.getRasterXSize()
+ && ds1.getRasterYSize() == ds2.getRasterYSize()) {
Band ds1b1 = ds1.GetRasterBand(1);
Band ds1b2 = ds1.GetRasterBand(2);
Band ds2b1 = ds2.GetRasterBand(1);
Band ds2b2 = ds2.GetRasterBand(2);
- for(int r = 0; r < ds1.getRasterYSize(); r++) {
+ for (int r = 0; r < ds1.getRasterYSize(); r++) {
double[] data1b1 = new double[ds1.getRasterXSize()];
- ds1b1.ReadRaster(0, r, ds1.getRasterXSize(), 1, data1b1);
double[] data1b2 = new double[ds1.getRasterXSize()];
- ds1b2.ReadRaster(0, r, ds1.getRasterXSize(), 1, data1b2);
-
double[] data2b1 = new double[ds1.getRasterXSize()];
- ds2b1.ReadRaster(0, r, ds1.getRasterXSize(), 1, data2b1);
double[] data2b2 = new double[ds1.getRasterXSize()];
+
+ ds1b1.ReadRaster(0, r, ds1.getRasterXSize(), 1, data1b1);
+ ds1b2.ReadRaster(0, r, ds1.getRasterXSize(), 1, data1b2);
+ ds2b1.ReadRaster(0, r, ds1.getRasterXSize(), 1, data2b1);
ds2b2.ReadRaster(0, r, ds1.getRasterXSize(), 1, data2b2);
- for(int c = 0; c < ds1.getRasterXSize(); c++) {
+ for (int c = 0; c < ds1.getRasterXSize(); c++) {
// nan in one grid and value in other grid case
- if (!(myIsNan(data1b1[c]) == myIsNan(data2b1[c])))
- {
- return false;
- }
+ if (!(myIsNan(data1b1[c]) == myIsNan(data2b1[c]))) {
+
+ isOK = false;
+ errorCount++;
- // values in both grids
- if (!(Double.isNaN(data1b1[c]))) {
+ writer.write("NaN mismatch at pixel (" + r + "," + c + ")\n");
+ if (errorCount==1)
+ {
+ LOGGER.warning("NaN mismatch at pixel (" + r + "," + c + ")");
+ }
+ continue;
+ }
- // Calculation planar error
+ // Values in both grids
+ if (!(Double.isNaN(data1b1[c])))
+ {
+ // Calculation of planar error
double diff_column = data1b1[c] - data2b1[c];
- double diff_column_2 = diff_column * diff_column;
+ double diff_column_2 = diff_column * diff_column; // To be kept as a separated line,
double diff_line = data1b2[c] - data2b2[c];
- double diff_line_2 = diff_line * diff_line;
- double diff = Math.sqrt(diff_line_2 + diff_column_2);
+ double diff_line_2 = diff_line * diff_line; // To be kept as a separated line,
+ double diff = Math.sqrt(diff_line_2 + diff_column_2); // To be kept as a separated line,
+ // If lines above are not kept all separated, it can lead to comparison errors due to Java optimisation
+ // Indeed doing a diff of lines numbers that can be very big, but results can be very small
+ // Then operation on small numbers shall be in a separated lines
diff = diff * res;
if (diff > threshold) {
- LOGGER.warning("Error in " + img1Path);
- String error = "(" + String.valueOf(data1b2[c]) + ", " + String.valueOf(data1b1[c]) + ")";
- error = error + " vs (" + String.valueOf(data2b2[c]) + ", " + String.valueOf(data2b1[c]) + ")";
- error = error + " = " + String.valueOf(diff);
- LOGGER.warning("Coordinates (" + String.valueOf(r) + "," + String.valueOf(c) + "): " + error);
- return false;
+
+ isOK = false;
+ errorCount++;
+
+ double lon = gt[0] + c * gt[1] + r * gt[2];
+ double lat = gt[3] + c * gt[4] + r * gt[5];
+
+ writer.write(
+ "Pixel (" + r + "," + c + ") → "
+ + "lat=" + lat + ", lon=" + lon + " → "
+ + "(" + data1b2[c] + ", " + data1b1[c] + ") vs "
+ + "(" + data2b2[c] + ", " + data2b1[c] + ") "
+ + " diff=" + diff + "\n"
+ );
+
+ if (errorCount==1)
+ {
+ LOGGER.warning("Pixel (" + r + "," + c + ") → "
+ + "lat=" + lat + ", lon=" + lon + " → "
+ + "(" + data1b2[c] + ", " + data1b1[c] + ") vs "
+ + "(" + data2b2[c] + ", " + data2b1[c] + ") "
+ + " diff=" + diff + "\n");
+ }
+
}
}
-
}
}
+
+ if (errorCount>1)
+ {
+ LOGGER.warning("[...]");
+ }
+ writer.write("\nTotal errors = " + errorCount + "\n");
+ LOGGER.warning("\nTotal errors = " + errorCount + "\n");
- return true;
+ writer.close();
+
+ return isOK;
}
+
+ LOGGER.warning("Not same number of bands");
+ writer.close();
return false;
}
}
diff --git a/src/test/resources/tests/data/dem_tests/dem_2/w06_n30.dt1 b/src/test/resources/tests/data/dem_tests/dem_2/w016_n30.dt1
similarity index 100%
rename from src/test/resources/tests/data/dem_tests/dem_2/w06_n30.dt1
rename to src/test/resources/tests/data/dem_tests/dem_2/w016_n30.dt1
diff --git a/src/test/resources/tests/data/dem_tests/dem_3/n30_w06.dt2 b/src/test/resources/tests/data/dem_tests/dem_3/n30_w016.dt2
similarity index 100%
rename from src/test/resources/tests/data/dem_tests/dem_3/n30_w06.dt2
rename to src/test/resources/tests/data/dem_tests/dem_3/n30_w016.dt2
diff --git a/src/test/resources/tests/data/dem_tests/dem_4/n30_w06.dt1 b/src/test/resources/tests/data/dem_tests/dem_4/n30_w016.dt1
similarity index 100%
rename from src/test/resources/tests/data/dem_tests/dem_4/n30_w06.dt1
rename to src/test/resources/tests/data/dem_tests/dem_4/n30_w016.dt1
diff --git a/src/test/resources/tests/data/dem_tests/dem_5/README.txt b/src/test/resources/tests/data/dem_tests/dem_5/README.txt
new file mode 100644
index 00000000..5e7b55be
--- /dev/null
+++ b/src/test/resources/tests/data/dem_tests/dem_5/README.txt
@@ -0,0 +1,2 @@
+# Build with the following command
+gdalbuildvrt dem_Madeira_island.vrt ../dem_4/n32_w017.dt1 ../dem_4/n32_w018.dt1
diff --git a/src/test/resources/tests/data/dem_tests/dem_5/dem_Madeira_island.vrt b/src/test/resources/tests/data/dem_tests/dem_5/dem_Madeira_island.vrt
new file mode 100644
index 00000000..006414cb
--- /dev/null
+++ b/src/test/resources/tests/data/dem_tests/dem_5/dem_Madeira_island.vrt
@@ -0,0 +1,23 @@
+
+ GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]
+ -1.8000416666666666e+01, 8.3333333333333339e-04, 0.0000000000000000e+00, 3.3000416666666666e+01, 0.0000000000000000e+00, -8.3333333333333339e-04
+
+ -32767
+
+ ../dem_4/n32_w017.dt1
+ 1
+
+
+
+ -32767
+
+
+ ../dem_4/n32_w018.dt1
+ 1
+
+
+
+ -32767
+
+
+
diff --git a/src/test/resources/tests/data/dem_tests/dem_5/n30_w016.dt1 b/src/test/resources/tests/data/dem_tests/dem_5/n30_w016.dt1
new file mode 100644
index 00000000..6cedc35f
Binary files /dev/null and b/src/test/resources/tests/data/dem_tests/dem_5/n30_w016.dt1 differ
diff --git a/src/test/resources/tests/data/dem_tests/dem_5/n33_w017.dt1 b/src/test/resources/tests/data/dem_tests/dem_5/n33_w017.dt1
new file mode 100644
index 00000000..9a4adc01
Binary files /dev/null and b/src/test/resources/tests/data/dem_tests/dem_5/n33_w017.dt1 differ
diff --git a/src/test/resources/tests/data/dem_tests/dem_6/README.txt b/src/test/resources/tests/data/dem_tests/dem_6/README.txt
new file mode 100644
index 00000000..e9d1ac80
--- /dev/null
+++ b/src/test/resources/tests/data/dem_tests/dem_6/README.txt
@@ -0,0 +1,2 @@
+*# Build with the following command
+gdalbuildvrt dem_Madeira_vert.vrt ../dem_4/n33_w017.dt1 ../dem_4/n32_w017.dt1
diff --git a/src/test/resources/tests/data/dem_tests/dem_6/dem_Madeira_vert.vrt b/src/test/resources/tests/data/dem_tests/dem_6/dem_Madeira_vert.vrt
new file mode 100644
index 00000000..f1115ca2
--- /dev/null
+++ b/src/test/resources/tests/data/dem_tests/dem_6/dem_Madeira_vert.vrt
@@ -0,0 +1,23 @@
+
+ GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]
+ -1.7000416666666666e+01, 8.3333333333333339e-04, 0.0000000000000000e+00, 3.4000416666666666e+01, 0.0000000000000000e+00, -8.3333333333333339e-04
+
+ -32767
+
+ ../dem_4/n33_w017.dt1
+ 1
+
+
+
+ -32767
+
+
+ ../dem_4/n32_w017.dt1
+ 1
+
+
+
+ -32767
+
+
+
diff --git a/src/test/resources/tests/data/dem_tests/dem_6/n30_w016.dt1 b/src/test/resources/tests/data/dem_tests/dem_6/n30_w016.dt1
new file mode 100644
index 00000000..6cedc35f
Binary files /dev/null and b/src/test/resources/tests/data/dem_tests/dem_6/n30_w016.dt1 differ
diff --git a/src/test/resources/tests/data/dem_tests/dem_6/n32_w018.dt1 b/src/test/resources/tests/data/dem_tests/dem_6/n32_w018.dt1
new file mode 100644
index 00000000..2887df5f
Binary files /dev/null and b/src/test/resources/tests/data/dem_tests/dem_6/n32_w018.dt1 differ