Esa_snappy Collocate renameMasterComponents

I’m adjusting all my past tools to the new esa_snappy library and SNAP 10.

My collocation script is not naming the output bands with just the original band name and is instead adding the _M, _S0, _S1, etc…

I’ve tried a few different things but it’s like my parameters are being ignored. I suspect something was renamed, but I don’t remember how to find out what the tool expects to receive. Can someone point me in the right direction?

sources = jpy.array('org.esa.snap.core.datamodel.Product', 1)
sources[0] = for_collocation_values[0]

collocate_params = esa_snappy.HashMap()
collocate_params.put('renameMasterComponents', True)
# collocate_params.put('renameMasterComponents', False)
collocate_params.put('renameSlaveComponents', True)
# collocate_params.put('renameSlaveComponents', False)
collocate_params.put('copySecondaryMetadata', False)
collocate_params.put('resamplingType', 'NEAREST_NEIGHBOUR')
collocate_params.put('masterComponentPattern', '${ORIGINAL_NAME}')
collocate_params.put('slaveComponentPattern', '${ORIGINAL_NAME}')
collocate_params.put('masterProductName', sources[0].getName())
collocate_params.put('sourceProductPaths', ",".join(source_paths[1:]))

target = GPF.createProduct('Collocate', collocate_params, sources)

image

Indeed, there has something changed.
Unfortunately, it wasn’t added to the API and Architectural Changes in SNAP 10 page.
Perhaps this can be made up for? @TomBlock @dolaf

In the JIRA ticket [SNAP-3660] Collocation Op parameter naming issue the changes are referenced.
Luckily, in one of the changes the necessary modifications you need to make are well visible.

To make it short:

renameMasterComponents → renameReferenceComponents
renameSlaveComponents → renameSecondaryComponents
masterComponentPattern → referenceComponentPattern
slaveComponentPattern → secondaryComponentPattern


EOMasters_icon_60 Marco from EOMasters - Mastering Earth Observation - Kofi_cup_40x30

I’d like to become proficient in finding the specific backend location for the tools I use in Python so I can understand the bridge better. Is there a place to look that shows the connection between the Python classes and the Java classes? The ones here give me some idea that the names changed, but I don’t see where to find the specific Python class names. Is the bridge made on the fly by jpy? I don’t want to assume names if I can help it. Since it’s burned me a few times in the past.

image

The JPY bridge directly access the Java API. So, there are not Python classes.
But you can check the Java API documentation.
Overview (SNAP Engine API) (esa.int)
Unfortunately, it does not contain all classes, only the core functionality.
@diana_harosa @TomBlock Should this be put into the issue tracker?

But you can search on GitHub for classes, there you find the collocation implementation.
snap-engine/snap-collocation/src/main/java/org/esa/snap/collocation/CollocateOp.java at master · senbox-org/snap-engine (github.com)

1 Like

Thanks for helping here Marco.

I have updated the documentation now, sorry for not having done this before. It was a last-minute change request from ESA for SNAP10 to update this naming conventions, so I just forgot to do it in the stressful release phase.

Tom

1 Like