Hi Helga,
In the provided code your are only getting and change the GeoCoding. But you also need to set the changed value to the target product. Try
target.setSceneGeoCoding(gc_target)
But probably you just want to copy from the source product. In this case try
snappy.ProductUtils.copyGeoCoding(source, target)
The problem with target_band.ensureRasterData()
indicates two things the JVM started by your snappy does not have a lot memory assigned. See:
You need to change the configuration in the snappy.ini file. The file is located in the snappy folder.
Change the line
# java_max_mem: 4G
to e.g.
java_max_mem: 6GThis means that snappy can use 6GB of your RAM. A recommended value is 70%-80% of the available RAM in your system.
If this does not help you can iterate over the dimensions of the band.
target_band.ensureRasterData()
means that the whole band is loaded at once, so a lot of memory is allocated.
Have a look at the followingexample. Here the data is processed line-by-line. I guess you can do it in a similar way.