Thank you for response. In my case path is different:
~/snap/bin/gpt -h Terrain-Correction
As I can see, within the output, in “Graph XML Format” section I have:
<demResamplingMethod>string</demResamplingMethod>
which still might be a source of confusion, since you need to know exact spelling of available options (in your example you set BILINEAR_INTERPOLATION). Okay, in previous lines of the output there’s information: Default value is ‘BILINEAR_INTERPOLATION’ but what are the other available options?
Coming back to my question:
I used mentioned tool from command line to retrieve information about ‘Resample’ operator:
~/snap/bin/gpt -h Resample
ResampleOp.txt (2,9 KB)
and I created a stub functions (I assume that resolution is in meters?)
# I will use Sentinel and SMOS data
# I will use two functions: getCoarseResProd (to 25 km resolution) or getBetterResProd (to 1 km resolution)
def getCoarseResProd(file1, destinationPath):
return getResampled(file1, destinationPath, resolution=25000)
def getBetterResProd(file1, destinationPath):
return getResampled(file1, destinationPath, resolution=1000)
def getResampled(file1, destinationPath, resolution=25000):
# TODO: this should be tested!!!
# More info: http://forum.step.esa.int/t/aggregation-and-interpolation-of-sentinel-products-should-i-use-snappy-or-gdal-tools/2522/3
import snappy
from snappy import GPF
from snappy import ProductIO
product = snappy.ProductIO.readProduct(file1)
HashMap = jpy.get_type('java.util.HashMap')
GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis()
parameters = HashMap()
parameters.put('sourceProduct', product)
parameters.put('upsampling', "Bilinear")
parameters.put('downsampling', "Mean")
# As I checked in SNAP desktop, 'targetResolution' option is sometimes not available
# and I need to use targetHeight and targetWidth instead
parameters.put('targetResolution', resolution)
terrain = GPF.createProduct('Resample', parameters, destinationPath)
product.dispose()
return destinationPath
However, I have doubts regarding targetResolution option.
As I check in SNAP desktop I am not always able to use it and I need to provide ‘targetHeight’ (together with targetWidth) option value instead.
However, I don’t understand how to use it
In SNAP desktop, I changed value to much higher (as I understand higher cells should means coarser resolution? In other words, what should I expect if I provide higher value for this option?), but when I saved product… I received 660 GB (Gigabytes!) files instead of previous 250 MB (Megabytes). Both - input and output were saved in .dim (Beam) formats.
@fabricebrito, @marpet Could you please advice?