I was wondering if anyone has an example of how to write a python snappy script with multiple sequential operators? There’s also a strong chance I’m misunderstanding exactly how to work with snappy. I’ve tried examining a few examples such as NDVI_OP (which I don’t understand how to use) and snappy_flh (which I think I understand but am not sure what multispectral sensor input is required).
I’ve also looked at @abgbaumann’s snappy_glcm , and it seems like I could repeat/modify that (func_name & func_code) to cover each operator I need, then have another script that calls each operator in a sequence on the file. Is that the best approach?
What I’d like to make in the end is a script that will:
INGEST sentinel-1 scene
CALIBRATE sentinel-1 scene
TERRAIN FLATTEN calibrated sentinel-1 scene
SPECKLE FILTER terrain-cal sentinel 1 scene
GEORECTIFY speckle-terrain-cal sentinel 1 scene
OUTPUT geo-speckle-terrain-cal sentinel 1 scene
You invoke each operator by calling GPF.createProduct('OperatorName', parameter, source_product). This will give you a new product which you can use as source product for the next operator.
What is java.util.HashMap? Would this be a list or array that contains strings/numerics of the parameters for the operator tools? Do I need to specify this or does the API know what is needed and have default values?
HashMap is a dictionary. It maps parameter names (strings) to values (objects). It depends on the operator and parameter if a default value exists. Even if all parameters have a default value, an empty HashMap needs to be used.
No you can use it like a script as you do in your example.
The advantage which @abgbaumann is showing by putting it into a class and a method is that it is better reusable in an other context.
What to use depends also on the use case you have.
Figure out that I hadn’t been including the parameter: outputImageInComplex with true, which was causing the problem.
I am now having issues with JavaHeapSpace/DataBuffer, despite running the performance optimizing options. I’ll try modifying the snappy.ini as others have suggest.
@marpet Many thanks!
I want to use snappy for SAR interferogram, when I set parameters for TOPSAR-split, but I find it doesn’t work as expected.
could u help me to check it?
Set Params
params={
# TOPSAR-split
“subswath”: “IW2”,
“selectedPolarisations”: ‘VV’,
“bursts”: “1 to 2 (max number of bursts: 4)”, # not work
}
Parameters Assignments
parameters = HashMap()
for a in params:
# print(a)
parameters.put(a, params[a])
Parameter Options:
-PfirstBurstIndex= The first burst index
Valid interval is [1, *).
Default value is ‘1’.
-PlastBurstIndex= The last burst index
Valid interval is [1, *).
Default value is ‘9999’.
-PselectedPolarisations=<string,string,string,…> The list of polarisations
-Psubswath= The list of source bands.
-PwktAoi= WKT polygon to be used for selecting bursts