def collocate_products(product, reference_product):
"""Collinearate product to reference product"""
# Op name: org.esa.snap.collocation.CollocateOp
# Op alias: Collocate
# sourceProductPaths or None
# referenceProductName or referenceProductName
# targetProductName or None
# targetProductType or None
# copySecondaryMetadata or None
# renameReferenceComponents or None
# renameSecondaryComponents or None
# referenceComponentPattern or None
# secondaryComponentPattern or None
# resamplingType or None
print("\tCollocating product...")
parameters = HashMap()
from esa_snappy import jpy
parameters = HashMap()
parameters.put('referenceProductName', reference_product.getName())
parameters.put('targetProductType', 'COLLOCATED')
parameters.put('renameReferenceComponents', True)
parameters.put('renameSecondaryComponents', True)
parameters.put('resamplingType', 'NEAREST_NEIGHBOUR')
# Pass products directly to GPF.createProduct
collocated_product = GPF.createProduct('Collocate', parameters,
[reference_product, product])
return collocated_product
some references used:
renamed master/slave to reference/secondary, resolved SNAP-3660 · senbox-org/snap-gpt-tests@722eaf5 · GitHub and
Collocation operator on Python and
snap-engine/snap-collocation/src/main/java/org/esa/snap/collocation/CollocateOp.java at 134f4b3f35278f22a3535ef349f0ee47ab4241db · senbox-org/snap-engine · GitHub
I am trying to collocate a single product to a single reference product but the output seems to be empty when viewed on the SNAP GUI. Is this the correct method to use the collocate operator in SNAP 11?