BinningOp extends Operator { @Override public void dispose() { if (writtenProduct != null) { writtenProduct.dispose(); } super.dispose(); } BinningOp(); Geometry getRegion(); void setRegion(Geometry region); String getStartDateTime(); void setStartDateTime(String startDateTime); Double getPeriodDuration(); void setPeriodDuration(Double periodDuration); TimeFilterMethod getTimeFilterMethod(); void setTimeFilterMethod(TimeFilterMethod timeFilterMethod); Double getMinDataHour(); void setMinDataHour(Double minDataHour); int getNumRows(); void setNumRows(int numRows); Integer getSuperSampling(); void setSuperSampling(Integer superSampling); String getMaskExpr(); void setMaskExpr(String maskExpr); void setOutputFile(String outputFile); void setOutputType(String outputType); void setOutputFormat(String outputFormat); VariableConfig[] getVariableConfigs(); void setVariableConfigs(VariableConfig... variableConfigs); AggregatorConfig[] getAggregatorConfigs(); void setAggregatorConfigs(AggregatorConfig... aggregatorConfigs); CellProcessorConfig getPostProcessorConfig(); void setPostProcessorConfig(CellProcessorConfig postProcessorConfig); void setBinWriter(BinWriter binWriter); void setOutputTargetProduct(boolean outputTargetProduct); void setMetadataAggregatorName(String metadataAggregatorName); String getOutputFile(); void setPlanetaryGridClass(String planetaryGridClass); void setCompositingType(CompositingType compositingType); @Override void initialize(); @Override void dispose(); BinningConfig createConfig(); static final String DATE_INPUT_PATTERN; static final String DATETIME_INPUT_PATTERN; static final String DATETIME_OUTPUT_PATTERN; }
@Test public void testGlobalBinningViaGPF() throws Exception { final File targetFile = getTestFile("target-1.dim"); float obs1 = 0.2F; float obs2 = 0.4F; float obs3 = 0.6F; float obs4 = 0.8F; float obs5 = 1.0F; final HashMap<String, Object> parameters = new HashMap<>(); parameters.put("startDateTime", "2002-01-01"); parameters.put("periodDuration", "10"); parameters.put("numRows", 180); parameters.put("maskExpr", "true"); parameters.put("aggregatorConfigs", new AggregatorConfig[]{chlAgg(), p70Agg()}); parameters.put("outputFile", targetFile.getPath()); parameters.put("outputType", "Product"); parameters.put("outputFormat", "BEAM-DIMAP"); parameters.put("region", "POLYGON ((-180 -90, -180 90, 180 90, 180 -90, -180 -90))"); final Product targetProduct = GPF.createProduct("Binning", parameters, createSourceProduct(1, obs1), createSourceProduct(2, obs2), createSourceProduct(3, obs3), createSourceProduct(4, obs4), createSourceProduct(5, obs5)); assertNotNull(targetProduct); try { assertGlobalBinningProductIsOk(targetProduct, null, obs1, obs2, obs3, obs4, obs5); } finally { targetProduct.dispose(); } }
@Test public void testLocalBinningViaGPF() throws Exception { final File targetFile = getTestFile("target-1.dim"); float obs1 = 0.2F; float obs2 = 0.4F; float obs3 = 0.6F; float obs4 = 0.8F; float obs5 = 1.0F; final HashMap<String, Object> parameters = new HashMap<>(); parameters.put("region", "POLYGON((-1 -1, 3 -1, 3 3, -1 3, -1 -1))"); parameters.put("startDateTime", "2002-01-01"); parameters.put("periodDuration", "10"); parameters.put("numRows", 180); parameters.put("maskExpr", "true"); parameters.put("aggregatorConfigs", new AggregatorConfig[]{chlAgg(), p70Agg()}); parameters.put("outputFile", targetFile.getPath()); parameters.put("outputType", "Product"); parameters.put("outputFormat", "BEAM-DIMAP"); final Product targetProduct = GPF.createProduct("Binning", parameters, createSourceProduct(1, obs1), createSourceProduct(2, obs2), createSourceProduct(3, obs3), createSourceProduct(4, obs4), createSourceProduct(5, obs5)); assertNotNull(targetProduct); try { assertLocalBinningProductIsOk(targetProduct, null, obs1, obs2, obs3, obs4, obs5); } finally { targetProduct.dispose(); } }
@Test public void testGlobalBinningViaGPT() throws Exception { float obs1 = 0.2F; float obs2 = 0.4F; float obs3 = 0.6F; float obs4 = 0.8F; float obs5 = 1.0F; final File parameterFile = new File(getClass().getResource("BinningParamsGlobal.xml").toURI()); final File targetFile = getTestFile("output.dim"); final File sourceFile1 = getTestFile("obs1.dim"); final File sourceFile2 = getTestFile("obs2.dim"); final File sourceFile3 = getTestFile("obs3.dim"); final File sourceFile4 = getTestFile("obs4.dim"); final File sourceFile5 = getTestFile("obs5.dim"); ProductIO.writeProduct(createSourceProduct(1, obs1), sourceFile1, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(2, obs2), sourceFile2, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(3, obs3), sourceFile3, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(4, obs4), sourceFile4, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(5, obs5), sourceFile5, "BEAM-DIMAP", false); GPT.run(new String[]{ "Binning", "-p", parameterFile.getPath(), "-t", targetFile.getPath(), sourceFile1.getPath(), sourceFile2.getPath(), sourceFile3.getPath(), sourceFile4.getPath(), sourceFile5.getPath(), }); assertTrue(targetFile.exists()); final Product targetProduct = ProductIO.readProduct(targetFile); assertNotNull(targetProduct); try { assertGlobalBinningProductIsOk(targetProduct, targetFile, obs1, obs2, obs3, obs4, obs5); } finally { targetProduct.dispose(); } }
@Test public void testLocalBinningViaGPT() throws Exception { float obs1 = 0.2F; float obs2 = 0.4F; float obs3 = 0.6F; float obs4 = 0.8F; float obs5 = 1.0F; final File parameterFile = new File(getClass().getResource("BinningParamsLocal.xml").toURI()); final String fileName = "output.dim"; final File targetFile = getTestFile(fileName); final File sourceFile1 = getTestFile("obs1.dim"); final File sourceFile2 = getTestFile("obs2.dim"); final File sourceFile3 = getTestFile("obs3.dim"); final File sourceFile4 = getTestFile("obs4.dim"); final File sourceFile5 = getTestFile("obs5.dim"); ProductIO.writeProduct(createSourceProduct(1, obs1), sourceFile1, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(2, obs2), sourceFile2, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(3, obs3), sourceFile3, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(4, obs4), sourceFile4, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(5, obs5), sourceFile5, "BEAM-DIMAP", false); GPT.run(new String[]{ "Binning", "-p", parameterFile.getPath(), "-t", targetFile.getPath(), sourceFile1.getPath(), sourceFile2.getPath(), sourceFile3.getPath(), sourceFile4.getPath(), sourceFile5.getPath(), }); assertTrue(targetFile.exists()); final Product targetProduct = ProductIO.readProduct(targetFile); assertNotNull(targetProduct); try { assertLocalBinningProductIsOk(targetProduct, targetFile, obs1, obs2, obs3, obs4, obs5); } finally { targetProduct.dispose(); } }
@Test public void testGlobalBinningViaGPT_FilePattern() throws Exception { float obs1 = 0.2F; float obs2 = 0.4F; float obs3 = 0.6F; float obs4 = 0.8F; float obs5 = 1.0F; final File parameterFile = new File(getClass().getResource("BinningParamsGlobal_FilePattern.xml").toURI()); final File targetFile = getTestFile("output.dim"); final File sourceFile1 = getTestFile("obs1.dim"); final File sourceFile2 = getTestFile("obs2.dim"); final File sourceFile3 = getTestFile("obs3.dim"); final File sourceFile4 = getTestFile("obs4.dim"); final File sourceFile5 = getTestFile("obs5.dim"); ProductIO.writeProduct(createSourceProduct(1, obs1), sourceFile1, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(2, obs2), sourceFile2, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(3, obs3), sourceFile3, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(4, obs4), sourceFile4, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(5, obs5), sourceFile5, "BEAM-DIMAP", false); GPT.run(new String[]{ "Binning", "-p", parameterFile.getPath(), "-t", targetFile.getPath(), }); assertTrue(targetFile.exists()); final Product targetProduct = ProductIO.readProduct(targetFile); assertNotNull(targetProduct); try { assertGlobalBinningProductIsOk(targetProduct, targetFile, obs1, obs2, obs3, obs4, obs5); } finally { targetProduct.dispose(); } }
@Test public void testLocalBinningViaGPT_FilePattern() throws Exception { float obs1 = 0.2F; float obs2 = 0.4F; float obs3 = 0.6F; float obs4 = 0.8F; float obs5 = 1.0F; final File parameterFile = new File(getClass().getResource("BinningParamsLocal_FilePattern.xml").toURI()); final String fileName = "output.dim"; final File targetFile = getTestFile(fileName); final File sourceFile1 = getTestFile("obs1.dim"); final File sourceFile2 = getTestFile("obs2.dim"); final File sourceFile3 = getTestFile("obs3.dim"); final File sourceFile4 = getTestFile("obs4.dim"); final File sourceFile5 = getTestFile("obs5.dim"); ProductIO.writeProduct(createSourceProduct(1, obs1), sourceFile1, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(2, obs2), sourceFile2, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(3, obs3), sourceFile3, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(4, obs4), sourceFile4, "BEAM-DIMAP", false); ProductIO.writeProduct(createSourceProduct(5, obs5), sourceFile5, "BEAM-DIMAP", false); GPT.run(new String[]{ "Binning", "-p", parameterFile.getPath(), "-t", targetFile.getPath(), }); assertTrue(targetFile.exists()); final Product targetProduct = ProductIO.readProduct(targetFile); assertNotNull(targetProduct); try { assertLocalBinningProductIsOk(targetProduct, targetFile, obs1, obs2, obs3, obs4, obs5); } finally { targetProduct.dispose(); } }