snap-contrib / snapista

SNAP GPT thin layer for Python

Home Page:https://snap-contrib.github.io/snapista/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terrain-Correction operator error

tpilz opened this issue · comments

Hi,

the Terrain-Correction operator is not working properly. One thing is a non-existent element in the Graph leading to

Error: [NodeId: terrain-correction] Operator 'RangeDopplerGeocodingOp': Unknown element 'outputComplex'

However, when removing element outputComplex from the graph (I exported it into a file and run with gpt) the next error occurs which I did not further investigate:

java.lang.ArithmeticException: / by zero
        at javax.media.jai.PlanarImage.XToTileX(PlanarImage.java:832)
        at org.esa.snap.core.gpf.internal.OperatorImageTileStack.createLocks(OperatorImageTileStack.java:190)
        at org.esa.snap.core.gpf.internal.OperatorContext.setTargetImages(OperatorContext.java:750)
        at org.esa.snap.core.gpf.internal.OperatorContext.initializeOperator(OperatorContext.java:531)
        at org.esa.snap.core.gpf.internal.OperatorContext.getTargetProduct(OperatorContext.java:298)
        at org.esa.snap.core.gpf.Operator.getTargetProduct(Operator.java:385)
        at org.esa.snap.core.gpf.graph.NodeContext.initTargetProduct(NodeContext.java:77)
        at org.esa.snap.core.gpf.graph.GraphContext.initNodeContext(GraphContext.java:199)
        at org.esa.snap.core.gpf.graph.GraphContext.initNodeContext(GraphContext.java:182)
        at org.esa.snap.core.gpf.graph.GraphContext.initNodeContext(GraphContext.java:182)
        at org.esa.snap.core.gpf.graph.GraphContext.initOutput(GraphContext.java:166)
        at org.esa.snap.core.gpf.graph.GraphContext.<init>(GraphContext.java:85)
        at org.esa.snap.core.gpf.graph.GraphContext.<init>(GraphContext.java:58)
        at org.esa.snap.core.gpf.graph.GraphProcessor.executeGraph(GraphProcessor.java:118)
        at org.esa.snap.core.gpf.main.DefaultCommandLineContext.executeGraph(DefaultCommandLineContext.java:86)
        at org.esa.snap.core.gpf.main.CommandLineTool.executeGraph(CommandLineTool.java:547)
        at org.esa.snap.core.gpf.main.CommandLineTool.runGraph(CommandLineTool.java:391)
        at org.esa.snap.core.gpf.main.CommandLineTool.runGraphOrOperator(CommandLineTool.java:287)
        at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:188)
        at org.esa.snap.core.gpf.main.CommandLineTool.run(CommandLineTool.java:121)
        at org.esa.snap.core.gpf.main.GPT.run(GPT.java:60)
        at org.esa.snap.core.gpf.main.GPT.main(GPT.java:37)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.esa.snap.runtime.Launcher.lambda$run$0(Launcher.java:55)
        at org.esa.snap.runtime.Engine.runClientCode(Engine.java:189)
        at org.esa.snap.runtime.Launcher.run(Launcher.java:51)
        at org.esa.snap.runtime.Launcher.main(Launcher.java:31)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:84)
        at com.install4j.runtime.launcher.UnixLauncher.start(UnixLauncher.java:66)
        at install4j.org.esa.snap.runtime.Launcher_gpt.main(Unknown Source)

When I re-create the workflow with SNAP GUI it runs fine. So, I guess there is a version conflict when building the graph as elements of the operator seem to be outdated? I'm using snapista version 0.2.0 and snap version 8.0.0 with Python 3.7 installed with conda from terradue repo.

can you save the graphs with snapista and with the GUI and post them here?

Sure, here are the graphs, only the Terrain-Correction node (don't worry about differences in map projection).

Generated with Snap 8.0.0 GUI:

<graph id="Graph">
  <version>1.0</version>
  <node id="Terrain-Correction">
    <operator>Terrain-Correction</operator>
    <sources>
      <sourceProduct refid="read"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <sourceBands/>
      <demName>SRTM 3Sec</demName>
      <externalDEMFile/>
      <externalDEMNoDataValue>0.0</externalDEMNoDataValue>
      <externalDEMApplyEGM>true</externalDEMApplyEGM>
      <demResamplingMethod>BILINEAR_INTERPOLATION</demResamplingMethod>
      <imgResamplingMethod>BILINEAR_INTERPOLATION</imgResamplingMethod>
      <pixelSpacingInMeter>20.0</pixelSpacingInMeter>
      <pixelSpacingInDegree>8.983152841195215E-5</pixelSpacingInDegree>
      <mapProjection>GEOGCS[&quot;WGS84(DD)&quot;, 
  DATUM[&quot;WGS84&quot;, 
    SPHEROID[&quot;WGS84&quot;, 6378137.0, 298.257223563]], 
  PRIMEM[&quot;Greenwich&quot;, 0.0], 
  UNIT[&quot;degree&quot;, 0.017453292519943295], 
  AXIS[&quot;Geodetic longitude&quot;, EAST], 
  AXIS[&quot;Geodetic latitude&quot;, NORTH]]</mapProjection>
      <alignToStandardGrid>false</alignToStandardGrid>
      <standardGridOriginX>0.0</standardGridOriginX>
      <standardGridOriginY>0.0</standardGridOriginY>
      <nodataValueAtSea>true</nodataValueAtSea>
      <saveDEM>false</saveDEM>
      <saveLatLon>false</saveLatLon>
      <saveIncidenceAngleFromEllipsoid>false</saveIncidenceAngleFromEllipsoid>
      <saveLocalIncidenceAngle>false</saveLocalIncidenceAngle>
      <saveProjectedLocalIncidenceAngle>false</saveProjectedLocalIncidenceAngle>
      <saveSelectedSourceBand>true</saveSelectedSourceBand>
      <saveLayoverShadowMask>false</saveLayoverShadowMask>
      <applyRadiometricNormalization>false</applyRadiometricNormalization>
      <saveSigmaNought>false</saveSigmaNought>
      <saveGammaNought>false</saveGammaNought>
      <saveBetaNought>false</saveBetaNought>
      <incidenceAngleForSigma0>Use projected local incidence angle from DEM</incidenceAngleForSigma0>
      <incidenceAngleForGamma0>Use projected local incidence angle from DEM</incidenceAngleForGamma0>
      <auxFile>Latest Auxiliary File</auxFile>
      <externalAuxFile/>
    </parameters>
  </node>
</graph>

Generated with Snapista:

<graph>
  <version>1.0</version>
  <node id="terrain-correction">
    <operator>Terrain-Correction</operator>
    <sources>
      <sourceProduct refid="read"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <alignToStandardGrid>false</alignToStandardGrid>
      <applyRadiometricNormalization>false</applyRadiometricNormalization>
      <auxFile>Latest Auxiliary File</auxFile>
      <demName>SRTM 3Sec</demName>
      <demResamplingMethod>BILINEAR_INTERPOLATION</demResamplingMethod>
      <externalAuxFile/>
      <externalDEMApplyEGM>true</externalDEMApplyEGM>
      <externalDEMFile/>
      <externalDEMNoDataValue>0</externalDEMNoDataValue>
      <imgResamplingMethod>BILINEAR_INTERPOLATION</imgResamplingMethod>
      <incidenceAngleForGamma0>Use projected local incidence angle from DEM</incidenceAngleForGamma0>
      <incidenceAngleForSigma0>Use projected local incidence angle from DEM</incidenceAngleForSigma0>
      <mapProjection>EPSG:9822</mapProjection>
      <nodataValueAtSea>true</nodataValueAtSea>
      <outputComplex>false</outputComplex>
      <pixelSpacingInDegree>0</pixelSpacingInDegree>
      <pixelSpacingInMeter>20.0</pixelSpacingInMeter>
      <saveBetaNought>false</saveBetaNought>
      <saveDEM>false</saveDEM>
      <saveGammaNought>false</saveGammaNought>
      <saveIncidenceAngleFromEllipsoid>false</saveIncidenceAngleFromEllipsoid>
      <saveLatLon>false</saveLatLon>
      <saveLocalIncidenceAngle>false</saveLocalIncidenceAngle>
      <saveProjectedLocalIncidenceAngle>false</saveProjectedLocalIncidenceAngle>
      <saveSelectedSourceBand>true</saveSelectedSourceBand>
      <saveSigmaNought>false</saveSigmaNought>
      <sourceBandNames/>
      <standardGridOriginX>0</standardGridOriginX>
      <standardGridOriginY>0</standardGridOriginY>
    </parameters>
  </node>
</graph>