|
16 | 16 | import org.esa.snap.core.util.ProductUtils; |
17 | 17 | import org.esa.snap.idepix.s2msi.operators.cloudshadow.CloudShadowUtils; |
18 | 18 | import org.esa.snap.idepix.s2msi.util.S2IdepixConstants; |
| 19 | +import org.esa.snap.idepix.s2msi.util.S2IdepixUtils; |
19 | 20 | import org.opengis.referencing.operation.MathTransform; |
20 | 21 |
|
21 | 22 | import javax.media.jai.BorderExtender; |
@@ -80,7 +81,7 @@ public void initialize() throws OperatorException { |
80 | 81 | throw new OperatorException("Could not retrieve spatial resolution from Geo-coding"); |
81 | 82 | } |
82 | 83 | } else { |
83 | | - throw new OperatorException("Could not retrieve spatial resolution from Geo-coding"); |
| 84 | + spatialResolution = S2IdepixUtils.determineResolution(sourceProduct); |
84 | 85 | } |
85 | 86 | elevationBand = sourceProduct.getBand(S2IdepixConstants.ELEVATION_BAND_NAME); |
86 | 87 | if (elevationBand == null) { |
@@ -114,14 +115,24 @@ public void computeTileStack(Map<Band, Tile> targetTiles, Rectangle targetRectan |
114 | 115 | float[] elevationData = elevationTile.getDataBufferFloat(); |
115 | 116 | float[] sourceLatitudes = new float[(int) (sourceRectangle.getWidth() * sourceRectangle.getHeight())]; |
116 | 117 | float[] sourceLongitudes = new float[(int) (sourceRectangle.getWidth() * sourceRectangle.getHeight())]; |
| 118 | + if (getSourceProduct().getSceneGeoCoding() instanceof CrsGeoCoding) { |
117 | 119 | ((CrsGeoCoding) getSourceProduct().getSceneGeoCoding()). |
118 | 120 | getPixels((int) sourceRectangle.getMinX(), |
119 | 121 | (int) sourceRectangle.getMinY(), |
120 | 122 | (int) sourceRectangle.getWidth(), |
121 | 123 | (int) sourceRectangle.getHeight(), |
122 | 124 | sourceLatitudes, |
123 | 125 | 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 | + } |
125 | 136 | // possible additional params for computeSlopeAndAspect |
126 | 137 | // final Tile saaTile = getSourceTile(saaBand, sourceRectangle, borderExtender); |
127 | 138 | // float[] saaData = saaTile.getDataBufferFloat(); |
|
0 commit comments