GUI Mockup
In order to implement this we would need three new registries. One for the resampling presets and two for the up- and down- samplers.
The following image shows a brief diagram of the classes.
Drafted code example
Resample Service Provider
package org.esa.snap.core.gpf.ui.resample; import org.esa.snap.core.datamodel.Product; import org.esa.snap.core.datamodel.RasterDataNode; public interface ResamplingProvider { String getName(); boolean isCompatible(Product p); ResampleMethodology getResampleMethod(RasterDataNode raster); }
I'm not yet sure about the upsampling
and downsampling in ResamplingMethodology.
Maybe we should define a common interface for both. Additionally it would be good to make use of the implementations of org.esa.snap.core.dataop.resamp.Resampling
. And the interpolation and aggregation operations also need to be extended by a SPI or at least should be retrieved by ResamplingProvider
. Here a bit more of thinking is probably needed.
Resampling method
package org.esa.snap.core.gpf.ui.resample; import org.esa.snap.core.gpf.common.resample.AggregationType; import org.esa.snap.core.gpf.common.resample.InterpolationType; public class ResamplingMethod { InterpolationType upsampling; AggregationType downsampling; boolean isEditable; }
This is how the parameter xml file could look like.
GPF Parameter XML
<parameters> <referenceBand>B1</referenceBand> <!-- Still supported but deprecated <upsampling>Nearest</upsampling> <downsampling>First</downsampling> <flagDownsampling>First</flagDownsampling> --> <!-- if empty the the default is used --> <resamplingPreset>S2_MSI_RESAMPLER</resamplingPreset> <!-- over rules the settings by the resampling preset--> <bandResamplings>B2:First,B3:First,B4:First,B5:Median</bandResamplings> <resampleOnPyramidLevels>true</resampleOnPyramidLevels> </parameters>