How can I find that operation was successful?

Hey guys. I started to play with snappy and everything is fine. I am using the GPT - h for finding functions and it’s feasible. However, I am not quite sure how to find that some operation was successful.

Sentinel-1 processing workflow:

product = ProductIO.readProduct(f"{s1_directory_path}/{s1_list[0]}")

# Apply orbit file
parameters = HashMap()
parameters.put('Apply-Orbit-File', True)
output = GPF.createProduct('Apply-Orbit-File', parameters, product)
print(output.getName())

This seems that is okay from the changed name (Orb)

'S1A_IW_GRDH_1SDV_20220722T170016_20220722T170041_044216_0546FE_C0F3_Orb'

However…

# Thermal noise removal
parameters = HashMap()
parameters.put('borderLimit', 600)
parameters.put('trimThreshold', 0.5)
parameters.put('selectedPolarisations', 'I am Barbar Conan band')
output = GPF.createProduct('Remove-GRD-Border-Noise', parameters, source)
print(output.getName())

It will give you the same name of file and of course I am Barbar Conan band is not a valid band (Python will not raise the error). That would be something from list [‘Amplitude_VH’, ‘Intensity_VH’, ‘Amplitude_VV’, ‘Intensity_VV’]. However, with chosen parameter from the list, the result is the same. So what is the best approach to finding out that something is not working in the right way?

Thank you!

1 Like

Hi Teracotta,

GPT and its operators have a lifecycle. First, they are initialized and afterwards the computation takes place. During the initialisation phase the source product and the provided parameters are validated.
In your code, only this phase has been completed.

The actual computation is only performed if data is requested. For example, when the result is written to disk or by output.getBand("name").readRasterData(...).

The illegal selectedPolarisations parameter is not correctly validated. It should raise an exception.
Even if you execute the operation by writing the output, you will only get an empty product (I only had a quick look at the code).

Let’s put it this way: The operator is tolerant of misconfigurations. :wink:

Other operators will raise an exception if the configuration is not correct.

I’ve created an issue for this: [SNAP-3438] Enhanced configuration validation for Remove-GRD-Border-Noise operator - JIRA (atlassian.net)

1 Like