RuntimeError: no matching Java method overloads found
def main():
## All Sentinel-1 data sub folders are located within a super folder (make sure the data is already unzipped and each sub folder name ends with ‘.SAFE’):
#path = r’data\s1_images’
path = os.path.join(os.getcwd(), ‘s1_images’)
#outpath = r’data\s1_preprocessed’
outpath=os.path.join(os.getcwd(), ‘s1_preprocessed’)
if not os.path.exists(outpath):
os.makedirs(outpath)
## well-known-text (WKT) file for subsetting (can be obtained from SNAP by drawing a polygon)
#wkt = ‘POLYGON ((-157.79579162597656 71.36872100830078, -155.4447021484375 71.36872100830078,
#-155.4447021484375 70.60020446777344, -157.79579162597656 70.60020446777344, -157.79579162597656 71.36872100830078))’
wkt='MultiPolygon (((22.02233412 0.99869668, 7802.8681872 0.99869668, 7760.92292654 -8429.99869668, 42.99496445 -8388.05343602, 22.02233412 0.99869668)))'
## UTM projection parameters
proj = '''PROJCS["UTM Zone 4 / World Geodetic System 1984",GEOGCS["World Geodetic System 1984",DATUM["World Geodetic System 1984",SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],UNIT["degree", 0.017453292519943295],AXIS["Geodetic longitude", EAST],AXIS["Geodetic latitude", NORTH]],PROJECTION["Transverse_Mercator"],PARAMETER["central_meridian", -159.0],PARAMETER["latitude_of_origin", 0.0],PARAMETER["scale_factor", 0.9996],PARAMETER["false_easting", 500000.0],PARAMETER["false_northing", 0.0],UNIT["m", 1.0],AXIS["Easting", EAST],AXIS["Northing", NORTH]]'''
for folder in os.listdir(path):
gc.enable()
gc.collect()
# sentinel_1 = ProductIO.readProduct(path + "\\" + folder + "\\manifest.safe")
#print(sentinel_1)
product_path = os.path.join(path, folder, "manifest.safe")
sentinel_1 = ProductIO.readProduct(product_path)
print(sentinel_1)
loopstarttime=str(datetime.datetime.now())
print('Start time:', loopstarttime)
start_time = time.time()
## Extract mode, product type, and polarizations from filename
modestamp = folder.split("_")[1]
productstamp = folder.split("_")[2]
polstamp = folder.split("_")[3]
polarization = polstamp[2:4]
if polarization == 'DV':
pols = 'VH,VV'
elif polarization == 'DH':
pols = 'HH,HV'
elif polarization == 'SH' or polarization == 'HH':
pols = 'HH'
elif polarization == 'SV':
pols = 'VV'
else:
print("Polarization error!")
## Start preprocessing:
applyorbit = do_apply_orbit_file(sentinel_1)
thermaremoved = do_thermal_noise_removal(applyorbit)
calibrated = do_calibration(thermaremoved, polarization, pols)
down_filtered = do_speckle_filtering(calibrated)
del applyorbit
del thermaremoved
del calibrated
## IW images are downsampled from 10m to 40m (the same resolution as EW images).
if (modestamp == 'IW' and productstamp == 'GRDH') or (modestamp == 'EW' and productstamp == 'GRDH'):
down_tercorrected = do_terrain_correction(down_filtered, proj, 1)
down_subset = do_subset(down_tercorrected, wkt)
del down_filtered
del down_tercorrected
elif modestamp == 'EW' and productstamp == 'GRDM':
tercorrected = do_terrain_correction(down_filtered, proj, 0)
subset = do_subset(tercorrected, wkt)
del down_filtered
del tercorrected
else:
print("Different spatial resolution is found.")
down = 1
try: down_subset
except NameError:
down = None
if down is None:
print("Writing...")
# ProductIO.writeProduct(subset, outpath + '\\' + folder[:-5], 'GeoTIFF')
ProductIO.writeProduct(subset, os.path.join(outpath, folder[:-5]),"GeoTIFF")
del subset
elif down == 1:
print("Writing undersampled image...")
#ProductIO.writeProduct(down_subset, outpath + '\\' + folder[:-5] + '_40', 'GeoTIFF')
ProductIO.writeProduct(down_subset, os.path.join(outpath,folder[:-5]), '_40',"GeoTIFF" )
del down_subset
else:
print("Error.")
print('Done.')
sentinel_1.dispose()
sentinel_1.closeIO()
print("--- %s seconds ---" % (time.time() - start_time))
if name== “main”:
main() is giving RuntimeError Traceback (most recent call last)
in
157
158 if name== “main”:
→ 159 main()
in main()
146 print(“Writing undersampled image…”)
147 #ProductIO.writeProduct(down_subset, outpath + ‘\’ + folder[:-5] + ‘_40’, ‘GeoTIFF’)
→ 148 ProductIO.writeProduct(down_subset, os.path.join(outpath,folder[:-5]), ‘_40’,“GeoTIFF” )
149 del down_subset
150 else:
RuntimeError: no matching Java method overloads found
what can be the possible solution