# Gpt with command (problems executing a kmeans cluster analysis)

Hello,

This is my first time using gpt with commands.

I want to execute a kmeans cluster analysis but the script is not working.
This is the command line I’m using:
gpt S:\Temporal_Step3_kmeans_v3.xml -t E:\prova.dim E:\juliol_mosaic.dim

and the xml file:
Step3_kmeans_v3.xml (1.3 KB)

The error message is:
Error: [NodeId:Read] Specified “file” [$file* does not exist. Any help will be much appreciated. Hi , In order to run your graph in GPT you need to specify three arguments which are the following: 1. path to your graph 2. path to your output folder 3. Source product In the command line, this should look like something like this: gpt c:\tutorial\cloudMask.xml -t c:\tutorial\out\mask.dim C:\tutorial\in\A2008112121000.L2_LAC.hdf first argument is your graph (xml) -t denotes the output folder finally your source product Hi, .hdf?? Which format is that?? My input data is a mosaic of several images in BEAM_DIMAP format. Would that be ok?? This is just an example. It does not have to be .hdf extension. You just provide the gpt with your source product (it might be tiff or any format that SNAP recognizes) You shouldn’t need a “read” node. Just follow the example of gpt KMeansClusterAnalysis -h which has:  <operator>KMeansClusterAnalysis</operator> <sources> <source>${source}</source>
</sources>


The value of \${source}} should come from the final argument(s) on the command-line, per:

Usage:
gpt <op>|<graph-file> [options] [<source-file-1> <source-file-2> ...]

the KMeansClusteringAnalysis graph looks like the one in the figure below:

We just need to populate the parameters and run it on the command line.
I have never run cluster analysis on the terminal but the general idea on running a process on the command line is the following:

gpt KMeansClusterAnalysis -s <source of your product> <output product>

1 Like