Handling sentinel data in python ( working with snappy)

This happens either when no reader is found or when the file name is invalid. It is weird when you can open the file in SNAP Desktop, though. Can you tell me the value of ‘path1’?

Here is :
‘D:\SENTINEL\S1A_IW_GRDH_1SDV_20181008T131251_20181008T131316_024045_02A0A4_4743\manifest.safe’

Perhaps could it be a typo in the path? Normally it should be
‘D:\SENTINEL\S1A_IW_GRDH_1SDV_20181008T131251_20181008T131316_024045_02A0A4_4743.SAFE\manifest.safe’
When you unzip it, the product folder should be [yourProductName].SAFE and if you are opening it compressed, then the path should be:
‘D:\SENTINEL\S1A_IW_GRDH_1SDV_20181008T131251_20181008T131316_024045_02A0A4_4743.zip’

try it too. but same problem. give path with distinct ways :confused:

Pity, the missing ‘.SAFE’ really looked like the problem. Anyway, if the .SAFE is missing, it won’t open.

Do you maybe have multiple installations of SNAP on your computer?

Can you open other S1 products with snappy? Or any other products for that matter?

yes i opened .geotif with snappy ,no error detected while reading geotif

Try this:

reader = ProductIO.getProductReader(‘SENTINEL-1’)
product = reader.readProductNodes(path1, None)

Is the reader None or is it an object?

You should use the path with double back-slash like ‘\\’, e.g. ‘x:\\your_dir\\imag_name.zip’

To correctly read the product you must have something like:

from snappy import ProductIO

product = ProductIO.readProduct( ‘x:\\your_dir\\imag_name.zip’)
band_names = product.getBandNames()
print (list(band_names))

If you have the correct python setup for snappy (python 3.4 !!! + snappy) then the above scratch should work.

@marpet @ABraun
Hie,
In the example provided snappy_flh.py I am getting an error:
w1 = b1.getSpectralWavelength()
AttributeError: ‘NoneType’ object has no attribute ‘getSpectralWavelength’
How can it be corrected?
Thanks

Hi @marpet and all, Can you please help me how I can subset or process Sentinel-1 SLC data line by line?

I am trying to apply oribit file but facing memory error. Is it possible to work on a small subset of SLC data to see if code is working or not?

You can apply TOPS Split to reduce the number of bursts.

Hi @ABraun thanks for your reply. Can you please correct me am I on the right track to preprocess Sentinel-1 SLC data to reach the goal of change detection.

  1. add orbit file
  2. remove border noise
  3. remove thermal noise
  4. Calibrate image to sigma0 and dB
  5. TOPSAR Deburst
  6. multilook
  7. subset to study area
  8. terrain correction
  9. radiometric correction
  10. speckle noise filter
  11. geocode/reprojection.

Please recommend what steps I have to follow. I tried TOPSAR-Split using SNAP instead of Python, but its also creating very big file as output.

[quote=“shahbazbaig, post:57, topic:2222”]I tried TOPSAR-Split using SNAP instead of Python, but its also creating very big file as output.
[/quote]

have you reduced the number of bursts as in the screenshot here? Apply orbit file error in S1-TOPS Coregistration

Some remarks on the steps:

  • Border Noise removal is not required for SLC products
  • I would apply a speckle filter earlier (before the conversion to db and multi-looking)
  • Multi-looking is not mandatory. After range doppler terrain correction your pixels are converted to squares anyhow.
  • The conversion to dB only makes sense if you search for changes in the low backscatter areas. The information is kind of the same but low values get streched while high values are shifted towards the mean. Your histogram then shows a more normal distribution.
1 Like

Great. Let me try this and will return to you with my results.
Thanks

Hi, As per your recommendation, after trying TOPSAR-Split function, I have run all the required processes successfully.

One thing I would like to confirm here. As you said border noise removal is not necessary. For testing purpose, I tried to remove border noise but function was not detecting the selected bursts product as correct one. is it because of applying TOPSAR-split function and selecting few bursts or reason is something else?

what do you mean by this?

I mean, the function to remove border thermal noise is not detecting splited bursts product as original product to apply remove border noise. Is it because we have splited the actual product?

As written above, I still think Border Noise Removal is only for GRD products, but please someone correct me if I’m wrong.

Hi @marpet do you know how to apply CoregistrationOp in Snappy? Any suggestions? I am trying this.
arameters = HashMap()
parameters.put(‘iterations’, 2)
parameters.put(‘levels’, ‘4’)
####### parameters.put(‘masterSourceBand’, ‘VV’)
####### parameters.put(‘slaveSourceBand’, ‘VV’)
parameters.put(‘rank’, 2)

####### parameters.put(‘Master’, d:/master.dim’)
####### parameters.put(‘Slave’ , ‘d:/slave.dim’)
coreg_param = snappy.GPF.createProduct(“CoregistrationOp”, parameters, ProductIO.readProduct(‘d:/master.dim’)
ProductIO.readProduct(‘d:/slave.dim’))
ProductIO.writeProduct(coreg_param, co_reg, ‘BEAM-DIMAP’)

Is there anyone to help here? Thanks in advance.