Skip to content

Commit da76d1f

Browse files
test for one-time analysis of geo-coding issue added
1 parent d51c3b3 commit da76d1f

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

calvalus-processing/src/test/java/com/bc/calvalus/processing/ProcessorAdapterTest.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,23 @@
1616

1717
package com.bc.calvalus.processing;
1818

19-
import com.bc.calvalus.processing.beam.SnapOperatorAdapter;
19+
import com.bc.calvalus.processing.executable.ExecutableProcessorAdapter;
20+
import com.bc.calvalus.processing.hadoop.ProductSplit;
21+
import org.apache.hadoop.conf.Configuration;
2022
import org.apache.hadoop.fs.Path;
23+
import org.apache.hadoop.mapred.MapTask;
24+
import org.apache.hadoop.mapreduce.MapContext;
25+
import org.apache.hadoop.mapreduce.StatusReporter;
26+
import org.apache.hadoop.mapreduce.task.MapContextImpl;
27+
import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl;
2128
import org.junit.Ignore;
2229
import org.junit.Test;
2330

24-
import static org.junit.Assert.*;
31+
import java.awt.Rectangle;
32+
import java.io.IOException;
33+
34+
import static org.junit.Assert.assertEquals;
35+
import static org.junit.Assert.assertNull;
2536

2637
public class ProcessorAdapterTest {
2738

@@ -44,4 +55,22 @@ public void testShallowCopyPatches() throws Exception {
4455
ProcessorAdapter.shallowCopyPatches("/home/boe/tmp/caltest");
4556
}
4657

58+
@Ignore
59+
@Test
60+
public void testGetInputRectangle() throws IOException {
61+
Configuration conf = new Configuration();
62+
ProductSplit productSplit = new ProductSplit(new Path("/windows/tmp/MSIL1C-60m-7blk-36T-A-107-20210718-v01.2.nc"), 1887624736L, new String[] { "localhost" }, -1, -1);
63+
conf.set(JobConfigNames.CALVALUS_REGION_GEOMETRY, "POLYGON((30 40,36 40,36 48,30 48,30 40))");
64+
MapTask mapTask = new MapTask();
65+
StatusReporter reporter = new TaskAttemptContextImpl.DummyReporter();
66+
MapContext mapContext = new MapContextImpl(conf, mapTask.getTaskID(), null, null, null, reporter, productSplit);
67+
ExecutableProcessorAdapter processorAdapter = new ExecutableProcessorAdapter(mapContext);
68+
// cuts off northern part of product while getting border pixels
69+
// set breakpoint at GeoUtils:684 regionIntersection.apply(pixelRegionFinder);
70+
// set breakpoint at GeoUtils:778: final PixelPos pixelPos = geoCoding.getPixelPos(geoPos, null);
71+
// getPixelPos fails for the northern border
72+
Rectangle inputRectangle = processorAdapter.getInputRectangle();
73+
System.out.println(inputRectangle);
74+
}
75+
4776
}

0 commit comments

Comments
 (0)