GPF.createProduct variables as arguments for functions


if i create a Product with GPF.createProduct is it possible to read this Product with ProductIO.readProduct or do i have to write the product first with ProductIO.writeProduct. Is there a way to read a GPF.createProduct product as variable. For a automation Process i want to pass intermediate results(variables) from one function (method) to another and i dont want to write every product to save time.
I try to create a class the first method takes a Band from a L1C Product and subsets it to an AOI.
The next method is suposed to merge two of those Objects together.

subset_1 and subset_2 are the arguments for the method merge_Bands:


Like i mentioned i dont want to write the product i want to pass in the variable as Product is this somehow possible? In the moment i get the error message:

RuntimeError: java.lang.ClassCastException: java.lang.String cannot be cast to org.esa.snap.core.datamodel.Product

Thanks for any help.

1 Like

solved it by myself.

1 Like