Export Geotiff

in this code i should export whole terrain corrected data but i face memory error. is it possible to create patches from speckle_filter_tc :
import os
import esa_snappy
import rasterio
import geopandas as gpd
from rasterio.features import shapes
from esa_snappy import ProductIO, GPF
from esa_snappy import HashMap

Load your Sentinel data

path_to_sentinel_data = r"D:\flood_S1\S1A_IW_GRDH_1SDV_20190323T022830_20190323T022855_026459_02F672_5979_2.zip"
product = ProductIO.readProduct(path_to_sentinel_data)

Check if the necessary band is available

band_names = product.getBandNames()
if ‘Intensity_VV’ not in band_names:
print(“Band ‘Intensity_VV’ not found in the product.”)
exit()

Proceed with calibration

parameters = HashMap()
parameters.put(‘outputSigmaBand’, True)
parameters.put(‘sourceBands’, ‘Intensity_VV’)
parameters.put(‘selectedPolarisations’, “VV”)
parameters.put(‘outputImageScaleInDb’, False)
product_calibrated = GPF.createProduct(“Calibration”, parameters, product)

Speckle filtering

filterSizeY = ‘5’
filterSizeX = ‘5’
parameters = HashMap()
parameters.put(‘sourceBands’, ‘Sigma0_VV’)
parameters.put(‘filter’, ‘Lee’)
parameters.put(‘filterSizeX’, filterSizeX)
parameters.put(‘filterSizeY’, filterSizeY)
parameters.put(‘dampingFactor’, ‘2’)
parameters.put(‘estimateENL’, ‘true’)
parameters.put(‘enl’, ‘1.0’)
parameters.put(‘numLooksStr’, ‘1’)
parameters.put(‘targetWindowSizeStr’, ‘3x3’)
parameters.put(‘sigmaStr’, ‘0.9’)
parameters.put(‘anSize’, ‘50’)
speckle_filter = GPF.createProduct(‘Speckle-Filter’, parameters, product_calibrated)

Apply terrain correction

parameters = HashMap()
parameters.put(‘demName’, ‘SRTM 3Sec’)
parameters.put(‘pixelSpacingInMeter’, 10.0)
parameters.put(‘sourceBands’, ‘Sigma0_VV’)
speckle_filter_tc = GPF.createProduct(“Terrain-Correction”, parameters, speckle_filter)

can i get code for oil spill detection, thanks inadvance

You can find the code here: