Hello everyone.
I am raising a problem which I haven’t found much info about anywhere.
Context: I am using snappy for interferometry with sentinel-1 data and I want to apply a coherence mask BEFORE unwrapping. So, by following various instructions, I have come to find out that I have to modify the Phase expression (I won’t go into details right now as it’s out of scope).
Anyway, I am now stuck, because, in order to what I described above, I have to extract the Pixel-Value Expression of the Phase band (so I can make this a new variable; the new expression will be a function of the phase (this variable) and the coherence band). See image below.
I am able to print out all the other raster band properties except for this one. See below:
(I put the first expression at the end so that you can see that the other one gives None (although this is also wrong: I have tried modifying that second expression and saving the product, but it still prints out “None”: but this is an issue for another time.))
And this is the python function used, in case you’re interested:
import snappy
from snappy import ProductIO, HashMap, GPF
def read(product):
GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis()
prod_read = ProductIO.readProduct(product)
operator_name = 'BandSelect'
parameters = HashMap()
parameters.put('bandNamePattern', 'Phase.*')
band_phase = GPF.createProduct(operator_name, parameters, prod_read)
bands_phase = band_phase.getBands()
for band1 in bands_phase:
phase_band = band1.getName()
name = band_phase.getBand(phase_band).getName()
print(f"band name: {name}")
unit = band_phase.getBand(phase_band).getUnit()
print(f"band unit: {unit}")
dt = band_phase.getBand(phase_band).getDataType()
print(f"band dt: {dt}")
size = band_phase.getBand(phase_band).getRasterSize()
print(f"band size: {size}")
expression2 = band_phase.getBand(phase_band).getValidPixelExpression()
print(f"band Valid-Pixel Expression: {expression2}")
expression1 = band_phase.getBand(phase_band).getPixelValueExpression()
print(f"band Pixel-Value Expression: {expression1}")
return None
Any suggestion would be much appreciated. I have looked extensively at the SNAP API manual
(Overview (SNAP Engine API)), as well as the snap-core repo (master branch, downloaded from git), and tried other functions but still I was not able to find the right solution.
Thank you in advance!