Hello, I found an issue in the Znap format reader, more specifically in the ComponentGeoCodingPersistenceConverter.
The converter writes the information of the GeoRaster:
final double offsetX = geoRaster.getOffsetX();
final double offsetY = geoRaster.getOffsetY();
final double subsamplingX = geoRaster.getSubsamplingX();
final double subsamplingY = geoRaster.getSubsamplingY();
final Container codingMain = createRootContainer(NAME_COMPONENT_GEO_CODING);
codingMain.add(new Property<>(NAME_FORWARD_CODING_KEY, forwardKey));
codingMain.add(new Property<>(NAME_INVERSE_CODING_KEY, inverseKey));
codingMain.add(new Property<>(NAME_GEO_CHECKS, geoChecks.name()));
codingMain.add(new Property<>(NAME_GEO_CRS, geoCRS.toWKT()));
codingMain.add(new Property<>(NAME_LON_VARIABLE_NAME, lonVarName));
codingMain.add(new Property<>(NAME_LAT_VARIABLE_NAME, latVarName));
codingMain.add(new Property<>(NAME_RASTER_RESOLUTION_KM, resolutionKm)); // String.valueOf()
codingMain.add(new Property<>(NAME_OFFSET_X, offsetX)); // String.valueOf()
codingMain.add(new Property<>(NAME_OFFSET_Y, offsetY)); // String.valueOf()
codingMain.add(new Property<>(NAME_SUBSAMPLING_X, subsamplingX)); // String.valueOf()
codingMain.add(new Property<>(NAME_SUBSAMPLING_Y, subsamplingY)); // String.valueOf()
But when reading the Znap format and recreating the geo-coding then the subsampling and the offset of the geoRaster is ignored and the values from the tie-point grid is used.
final double offsetX = lonTPG.getOffsetX();
final double offsetY = lonTPG.getOffsetY();
final double subsamplingX = lonTPG.getSubSamplingX();
final double subsamplingY = lonTPG.getSubSamplingY();
geoRaster = new GeoRaster(longitudes, latitudes, lonVarName, latVarName, gridWidth, gridHeight,
sceneWidth, sceneHeight, resolutionInKm,
offsetX, offsetY, subsamplingX, subsamplingY);
The leads to an error when the tie-point grid is used for multiple bands of different sizes. In this case the offset and subsampling values are different.
There is a pull-requests which fixes this issue:
Get offset and subsampling from the stored values of the GeoRaster by eomasters-repos · Pull Request #464 · senbox-org/snap-engine (github.com)
Also, BEAM-DIMAP is affected as it also uses the converter.
1 Like