Write/Export image as a GeoTIFF file with GPT

Please enter here to ask a question about any NASA Science related topics!
Post Reply
alicealo
Posts: 14
Joined: Mon Apr 30, 2018 7:31 pm America/New_York

Write/Export image as a GeoTIFF file with GPT

by alicealo » Sun Jun 03, 2018 1:25 pm America/New_York

Hi everyone,

I am trying to export an image as a GeoTIFF file with the GPT. The input file(iFile.dim) is a Landsat 8 C1 image that I processed with L2gen, reprojected and subsetted to keep a few bands only.
I used the following command:

gpt.sh write.xml -Ssource=iFile.dim -t test.tif

where "write.xml" is:
<node id="anyNodeId">
     <operator>Write</operator>
     <sources>
         <source>${anySourceNodeId}</source>
     </sources>
     <parameters>
         <file>test.tif</file>
         <formatName>GeoTIFF</formatName>
         <deleteOutputOnFailure>true</deleteOutputOnFailure>
         <writeEntireTileRows>true</writeEntireTileRows>
         <clearCacheAfterRowWrite>true</clearCacheAfterRowWrite>
     </parameters>
</node>

I am getting the error message below. Can anyone help me figure this out?

Thank you!
Alice

java.lang.ClassCastException: org.esa.beam.framework.gpf.graph.Node cannot be cast to org.esa.beam.framework.gpf.graph.Graph
  at org.esa.beam.framework.gpf.graph.GraphIO.read(GraphIO.java:83)
  at org.esa.beam.framework.gpf.main.DefaultCommandLineContext.readGraph(DefaultCommandLineContext.java:71)
  at org.esa.beam.framework.gpf.main.CommandLineTool.readGraph(CommandLineTool.java:504)
  at org.esa.beam.framework.gpf.main.CommandLineTool.runGraph(CommandLineTool.java:305)
  at org.esa.beam.framework.gpf.main.CommandLineTool.runGraphOrOperator(CommandLineTool.java:249)
  at org.esa.beam.framework.gpf.main.CommandLineTool.run(CommandLineTool.java:150)
  at org.esa.beam.framework.gpf.main.CommandLineTool.run(CommandLineTool.java:122)
  at org.esa.beam.framework.gpf.main.GPT.run(GPT.java:54)
  at org.esa.beam.framework.gpf.main.GPT.main(GPT.java:34)
  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:497)
  at com.bc.ceres.launcher.Launcher.launch(Launcher.java:154)
  at com.bc.ceres.launcher.Launcher.main(Launcher.java:56)

Error: org.esa.beam.framework.gpf.graph.Node cannot be cast to org.esa.beam.framework.gpf.graph.Graph

Tags:

alicealo
Posts: 14
Joined: Mon Apr 30, 2018 7:31 pm America/New_York

Write/Export image as a GeoTIFF file with GPT

by alicealo » Mon Jun 04, 2018 6:25 pm America/New_York

Alright, I figured it out:
Instead of going through two consecutive steps (1. subset selected bands and save as .dim file with Subset operator; 2. export as .TIF with Write operator), I subsets the bands AND save as .tif file with the Subset operator. That simple. Beginner beginning.

OB SeaDAS - knowles
Subject Matter Expert
Subject Matter Expert
Posts: 227
Joined: Mon Apr 07, 2008 4:40 pm America/New_York

Write/Export image as a GeoTIFF file with GPT

by OB SeaDAS - knowles » Tue Jun 05, 2018 10:32 am America/New_York

Alice,

The reason why your first post failed was because you only included the node tag.   A graph xml must look like this:

<graph id="someGraphId">
    <version>1.0</version>
        <node id="someNodeId">
        ......
       </node>       
       <node id="someOtherNodeId">
        ......
       </node>
</graph>

Danny

Post Reply