Hi Andreas,
Thanks very much for your quick response. I’m sorry my post wasn’t very clear. It’s helpful already to know that TC isn’t a substitute for TF - evidently I don’t quite know what I’m doing, I really appreciate your help.
I’ve been trying to follow your advice but I seem to have a rather odd problem. When I try to perform Terrain-Flattening, I get this following error:
SEVERE: org.esa.snap.core.util.SystemUtils$SnapImagingListener: JAI error occurred: 'Problem occurs when computing a tile by the owner.' at com.sun.media.jai.util.SunTileScheduler@29147c12
org.esa.snap.core.gpf.OperatorException: TerrainFlattening requires beta0 or T3, C3, C2 as input
at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:415)
at org.esa.s1tbx.sar.gpf.geometric.TerrainFlatteningOp.computeTileStack(TerrainFlatteningOp.java:511)
at org.esa.snap.core.gpf.internal.OperatorImageTileStack.computeRect(OperatorImageTileStack.java:116)
at org.esa.snap.core.gpf.internal.OperatorImageTileStack.computeTile(OperatorImageTileStack.java:85)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at javax.media.jai.PlanarImage.getData(PlanarImage.java:2085)
at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
at org.esa.snap.core.datamodel.Band.writeRasterDataFully(Band.java:384)
at org.esa.snap.core.dataio.ProductIO.writeAllBands(ProductIO.java:448)
at org.esa.snap.core.dataio.ProductIO.writeProduct(ProductIO.java:401)
at org.esa.snap.core.dataio.ProductIO.writeProduct(ProductIO.java:306)
Caused by: org.esa.snap.core.gpf.OperatorException: TerrainFlattening requires beta0 or T3, C3, C2 as input
at org.esa.s1tbx.sar.gpf.geometric.TerrainFlatteningOp.computeTileStack(TerrainFlatteningOp.java:474)
... 10 more
…which is clearly saying that the Beta0 band is missing - indeed, when I check the list of bands in the product, I only have Sigma0_VV. But I’m very confused by this because the parameters I am passing to the Calibration procedure are instructing snappy specifically to product Beta0 and not Sigma0. Here’s the code I’m using for this:
parameters = HashMap()
parameters.put("outputSigmaBand", False)
parameters.put("outputBetaBand", True)
print(parameters) # prints: "{outputSigmaBand=false, outputBetaBand=true}"
cal_path = os.path.join(tmp_dir, "calibration")
calib_param = snappy.GPF.createProduct(
"Calibration", parameters, ProductIO.readProduct(orbit_path + ".dim")
)
ProductIO.writeProduct(calib_param, cal_path, "BEAM-DIMAP")
cal_product = ProductIO.readProduct(cal_path+'.dim')
print(list(cal_product.getBandNames())) # prints: "['Sigma0_VV']"
I have re-checked this a few times and I can’t understand why this code is producing a product with only Sigma0 data. I’m sure there must be something simple that I’m missing. Do you have any idea what I might be doing wrong here?
Separately, could I please ask you to elaborate a little on your point about GeoReferencing being impractical? I added the GeoReferencing step because I wanted to produce GeoTIFF output to be ingested by some other code for onward analysis, and it seemed that GeoReferencing was the best way to ensure that the Affine matrix in the GeoTIFF file was accurate - if there’s a better way to do this, please let me know.