Hello, everyone!
The problem appeared when trying to extract data from Sentinel-1 archive via snappy. I need highly accurate georeference and use GPF.createProduct with ‘Update-Geo-Reference’ and/or ‘Terrain-Correction’ parameters in order to avhieve it. But when I try to write result to geotiff file or extract bands to numpy arrays, everything hangs for a couple of minutes and crashes with memory overflow.
There is object named “raw_product” obtained from Sentinel-1 archive via ProductIO.readProduct method and consistently passed ‘Apply-Orbit-File’, ‘removeThermalNoise’ and ‘Calibration’ procedures.
> type(raw_product)
<class 'org.esa.snap.core.datamodel.Product'>
> (raw_product.getSceneRasterWidth(),raw_product.getSceneRasterHeight())
(10375, 10705)
It can be saved without problems via ProductIO.writeProduct(raw_product, outpath,‘GeoTIFF’)
But after passing update georeference procedure as follows
def do_update_georeference(source):
parameters = HashMap()
parameters.put('saveLatLon', True)
parameters.put('demName', 'GETASSE30')
output_product = GPF.createProduct('Update-Geo-Reference', parameters, source)
return output_product
result = do_update_georeference(raw_product)
ProductIO.writeProduct(result, outpath,‘GeoTIFF’)
hangs for couple of minutes, eats > 45 Gb ram, and yields memory overflow exception (‘java heap… blah blah’), while size of raster is same:
> (result.getSceneRasterWidth(),result.getSceneRasterHeight())
(10375, 10705)
Situation is same for terrain_correction as follows:
def do_terrain_correction(source):
parameters = HashMap()
parameters.put('demName', 'GETASSE30')
parameters.put('imgResamplingMethod', 'BILINEAR_INTERPOLATION')
parameters.put('pixelSpacingInMeter', 40.0)
output = GPF.createProduct('Terrain-Correction', parameters, source)
return output
And also same problem appears when trying to extract data from result of
‘Terrain-Correction’ or ‘Update-Geo-Reference’ to numpy arrays:
w = result.getSceneRasterWidth()
h = result.getSceneRasterHeight()
I_s = np.zeros((w,h),dtype=np.float32)
I_s_t = result.getBand('Sigma0_HH')
I_s_t.readPixels(0, 0, w, h, I_s)
What can I do with it?
Thanks in advance!