The example is from the times were on two products could be collocated in one step.
Now, you can collocate more products and there are more options. This can make it more complicated or easier.
If all your products cover already the same region, and you just want to create a stack then you can leave out the master/slave parameters.
Instead you can simply add a comma separated list of all products paths to the parameters map.
If you want to define a master, the one which defines the geographical extent, then find this one in SNAP desktop and get the name of it.
Right-click on it in the Product Explorer and select Properties. Here the name is shown and you can copy it.
Set this name as parameter ‘masterProductName’.
I will follow up this question with another of mine, since I have a similar/related doubt.
I’ve been processing Sentinl-1 for a while, but recently I found that none of the processed images align with each other.
E.g. I have 60 Sentinel-1 images of one area from one year from the same orbit. I didn’t use ApplyOrbitFile step as I would like to use the image as soon as it has been acquired and not wait 20 days for it (as I saw in other discussions).
For the sake of my research (crop classification) I want images to align, pixel to pixel between all the images.
Would collocation be a good solution? What is a good way to implement it in processing workflow that is performed for each image individually? I would like to keep each image independently, not as a stack.
In case ApplyPreciseOrbit step was included in workflow, would the processed images align or still no?
P.S. Good to hear that more than two product can be collocated at once.
Was wondering if you managed to resolve the null pointer exception error?
I am also facing the same issue here and would appreciate any insights.
My code is as follow:
# Read the product name of Sen1 data so that we can set it as the master
s1_product = ProductIO.readProduct(sen1)
s1_product_name = s1_product.getName()
Hi @xholmes ,
I am facing your same problem. Have you found a solution for this? @marpet please, could you kindly help us on this. I have followed your advice above (Snappy: Collocate, set 'masterProduct' - #5 by marpet) but when I run the last line GPF.createProduct('Collocate', parameters), I got the same error message like @xholmes .
Thank you in advance for your help.
Dear @janardanroy
thank you for your suggestion.
Do you know if the output from CreateStack is the same of Collocate? I have a long series of Landsat images and I am analyzing the change in a specific AOI. For this, I need an alignment among all the pixels in the scene.
Thank you in advance.
“RuntimeError: java.lang.NullPointerException” basically means an error has occurred. Many different problems will generate the same message, so it is very possilbe that your problem is not related to this topic.
You should provide enough detail to allow others to reproduce the problem, including your SNAP version (is it fully updated?), input data, and python script.
Note that many overly helpful editors replace ASCII characters like quotes and dashes with “look-alike” unicode glyphs. This is so common and hard to detect visually that many editors (emacs, MS Code) provide ways to check for non-ASCII characters in your script.
Liked @janardanroy , i also switched to using CreateStack. However, to answer your question, I recalled the issue for me was primarily because of how the “sourceProductPaths” was being defined. I cannot remember which is the correct one, but I think the variable you pass in to that parameter has to be a list.
It has been sometime and I do not have the code that worked for me, so apologies if that is not the solution.
Dear @gnwiii ,
thank you for your reply.
Yes SNAP is updated to the last version.
I would like to collocate a list of Landsat images (more than 200) included in a folder.
To do that, I have created a simple python function, using the suggestions from @marpet above
I give in input to the script the following pathsList as suggested by @marpet pathsList = ('D:\\isardSAT\\coastal-change\\buenos_aires\\Output\\224084\\Low_Tide\\NDVI\\LC08_L2SP_224084_20201126_20210316_02_T1_NDVI.tif,D:\\isardSAT\\coastal-change\\buenos_aires\\Output\\224084\\Low_Tide\\NDVI\\LC08_L2SP_224084_20210606_20210615_02_T1_NDVI.tif')
and then that error message comes out.
It is important to highlight that this error doesn’t happen when I use the same files through the graph builder with this xml
where master= ProductIO.readProduct('D:\\isardSAT\\coastal-change\\buenos_aires\\Output\\224084\\Low_Tide\\NDVI\\LC08_L2SP_224084_20201126_20210316_02_T1_NDVI.tif')
and slave= ProductIO.readProduct('D:\\isardSAT\\coastal-change\\buenos_aires\\Output\\224084\\Low_Tide\\NDVI\\LC08_L2SP_224084_20210606_20210615_02_T1_NDVI.tif')
``
Thank you in advance for any suggestions.