Skip to content

Commit 772c83b

Browse files
support inputs with pixel geocoding, missing update of SlopeAspectOrientationOp
1 parent fe06ada commit 772c83b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

idepix-s2msi/src/main/java/org/esa/snap/idepix/s2msi/operators/mountainshadow/SlopeAspectOrientationOp.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.esa.snap.core.util.ProductUtils;
1717
import org.esa.snap.idepix.s2msi.operators.cloudshadow.CloudShadowUtils;
1818
import org.esa.snap.idepix.s2msi.util.S2IdepixConstants;
19+
import org.esa.snap.idepix.s2msi.util.S2IdepixUtils;
1920
import org.opengis.referencing.operation.MathTransform;
2021

2122
import javax.media.jai.BorderExtender;
@@ -80,7 +81,7 @@ public void initialize() throws OperatorException {
8081
throw new OperatorException("Could not retrieve spatial resolution from Geo-coding");
8182
}
8283
} else {
83-
throw new OperatorException("Could not retrieve spatial resolution from Geo-coding");
84+
spatialResolution = S2IdepixUtils.determineResolution(sourceProduct);
8485
}
8586
elevationBand = sourceProduct.getBand(S2IdepixConstants.ELEVATION_BAND_NAME);
8687
if (elevationBand == null) {
@@ -114,14 +115,24 @@ public void computeTileStack(Map<Band, Tile> targetTiles, Rectangle targetRectan
114115
float[] elevationData = elevationTile.getDataBufferFloat();
115116
float[] sourceLatitudes = new float[(int) (sourceRectangle.getWidth() * sourceRectangle.getHeight())];
116117
float[] sourceLongitudes = new float[(int) (sourceRectangle.getWidth() * sourceRectangle.getHeight())];
118+
if (getSourceProduct().getSceneGeoCoding() instanceof CrsGeoCoding) {
117119
((CrsGeoCoding) getSourceProduct().getSceneGeoCoding()).
118120
getPixels((int) sourceRectangle.getMinX(),
119121
(int) sourceRectangle.getMinY(),
120122
(int) sourceRectangle.getWidth(),
121123
(int) sourceRectangle.getHeight(),
122124
sourceLatitudes,
123125
sourceLongitudes);
124-
126+
} else {
127+
S2IdepixUtils.
128+
getPixels(getSourceProduct().getSceneGeoCoding(),
129+
(int) sourceRectangle.getMinX(),
130+
(int) sourceRectangle.getMinY(),
131+
(int) sourceRectangle.getWidth(),
132+
(int) sourceRectangle.getHeight(),
133+
sourceLatitudes,
134+
sourceLongitudes);
135+
}
125136
// possible additional params for computeSlopeAndAspect
126137
// final Tile saaTile = getSourceTile(saaBand, sourceRectangle, borderExtender);
127138
// float[] saaData = saaTile.getDataBufferFloat();

0 commit comments

Comments
 (0)