subset .nc file with gpt

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
awazyue
Posts: 1
Joined: Wed Dec 22, 2021 2:16 am America/New_York
Answers: 0

subset .nc file with gpt

by awazyue » Mon May 08, 2023 3:15 am America/New_York

I want to subset nc file with gpt, my .xml is as follow:
<graph id="GeoCropGraph">
<version>1.0</version>
<node id="GeoCropNode">
<operator>Subset</operator>
<sources>
<source>${source}</source>
</sources>
<parameters>
<geoRegion>POLYGON((${west} ${north}, ${east} ${north}, ${east} ${south}, ${west} ${south}, ${west} ${north}))</geoRegion>
</parameters>
</node>
</graph>
and my .par is
north=23.5
south=22
west=113
east=114.5

the command is :gpt.sh geoCrop.xml -p geoCropp.par -Ssource=A2017023193500.L2_LAC_OC.nc -t A2017023193500_geoCropGulfMexico.nc,
but I met the problem:
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~16.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)

com.thoughtworks.xstream.converters.ConversionException: Cannot construct org.esa.beam.framework.gpf.graph.Graph as it does not have a no-args constructor : Cannot construct org.esa.beam.framework.gpf.graph.Graph as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct org.esa.beam.framework.gpf.graph.Graph as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct org.esa.beam.framework.gpf.graph.Graph as it does not have a no-args constructor
class : org.esa.beam.framework.gpf.graph.Graph
required-type : org.esa.beam.framework.gpf.graph.Graph
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /graph
line number : 1
version : null
-------------------------------
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1052)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1036)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:912)
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:498)
at com.bc.ceres.launcher.Launcher.launch(Launcher.java:154)
at com.bc.ceres.launcher.Launcher.main(Launcher.java:56)
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct org.esa.beam.framework.gpf.graph.Graph as it does not have a no-args constructor
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:71)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:428)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:233)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
... 23 more

Error: Cannot construct org.esa.beam.framework.gpf.graph.Graph as it does not have a no-args constructor : Cannot construct org.esa.beam.framework.gpf.graph.Graph as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct org.esa.beam.framework.gpf.graph.Graph as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct org.esa.beam.framework.gpf.graph.Graph as it does not have a no-args constructor
class : org.esa.beam.framework.gpf.graph.Graph
required-type : org.esa.beam.framework.gpf.graph.Graph
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /graph
line number : 1
version : null
-------------------------------

I don't know how to solve this, please tell me the solutions.

Tags:

OB SeaDAS - xuanyang02
Subject Matter Expert
Subject Matter Expert
Posts: 629
Joined: Tue Feb 09, 2021 5:42 pm America/New_York
Answers: 1
Been thanked: 1 time

Re: subset .nc file with gpt

by OB SeaDAS - xuanyang02 » Mon May 08, 2023 1:12 pm America/New_York

First, I downloaded AQUA_MODIS.20170123T193500.L2.OC.nc, and the metadata shows
north=39
south=18
west=-110
east=-81,

so your subset area
north=23.5
south=22
west=113
east=114.5

has no intersection with the source product's boundary.

Secondly, you need to provide the absolute path of the files for the command (It's a known issue)

Code: Select all

gpt /Users/*/Scenes/MODIS_AQUA/forum/geoCrop.xml -p /users/*/Scenes/MODIS_AQUA/forum/geoCrop.par -Ssource=/Users/*/Scenes/MODIS_AQUA/forum/AQUA_MODIS.20170123T193500.L2.OC.nc -t /Users/*/Scenes/MODIS_AQUA/forum/A2017023193500_geoCropGulfMexico.nc

Post Reply