<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcPy script for supervised classification selectively fails on CreateSignature in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644680#M4383</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See if you get better results using forward slashes in your paths. '\t' means tab in Python.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Feb 2016 20:16:16 GMT</pubDate>
    <dc:creator>DarrenWiens2</dc:creator>
    <dc:date>2016-02-15T20:16:16Z</dc:date>
    <item>
      <title>ArcPy script for supervised classification selectively fails on CreateSignature</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644679#M4382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have written a script to partially automate a supervised classification of a raster (my only interest is to differentiate water features from non-water features) and it worked seamlessly on several tests, but I am now encountering error(s) when I attempt to create signature file(s). I am running ArcGIS 10.2.1 (Advanced)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import python modules
import arcpy, os, ntpath

# Input Parameters
classRast = arcpy.GetParameterAsText(0)
trainSamp = arcpy.GetParameterAsText(1)
aPriori = arcpy.GetParameterAsText(2)
outDir = arcpy.GetParameterAsText(3)

#Environments
arcpy.env.workspace = outDir
ws = arcpy.env.workspace
arcpy.env.overwriteOutput = True

def stripped(path):
&amp;nbsp;&amp;nbsp;&amp;nbsp; head, tail = ntpath.split(path)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return tail or ntpath.basename(head)

# Create Signatures from Shoreline Training Samples
arcpy.AddMessage("Generating Signature File from Training Samples...")
sigFile = outDir + "/TrainSignats.GSG"
arcpy.gp.CreateSignatures_sa(classRast,trainSamp,sigFile,"COVARIANCE","Classvalue")&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On one failed example, the inputs are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;classRast =&amp;nbsp; m_3307811_ne_17_1_20130929.tif&lt;/P&gt;&lt;P&gt;trainSamp = S:/Software/Scripts and Tools/ShorelineTools/ExtractShorelines.gdb/ShorelineTrainingSamples&lt;/P&gt;&lt;P&gt;aPriori = S:/Software/Scripts and Tools/ShorelineTools/apriori.txt&lt;/P&gt;&lt;P&gt;outDir = T:/PERSONAL/Jimmy/SE USA/test5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hit an error on line 22 stating:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp; File "T:\PERSONAL\Jimmy\Tools and References\python scripts\ExtractShorelines.py", line 29, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.gp.CreateSignatures_sa(classRast,trainSamp,sigFile,"COVARIANCE","Classvalue")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 498, in &amp;lt;lambda&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return lambda *args: val(*gp_fixargs(args, True))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;ExecuteError: ERROR 010423: T:\PERSONAL\Jimmy\SE USA\test5\t_t285 does not have valid statistics as required by the operation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;ERROR 010159: Unable to open VAT file of t:\personal\jimmy\se~d1mse\test5\t_t285. ClassSig failed!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;ERROR 010067: Error in executing grid expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;Failed to execute (CreateSignatures)&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried building pyramids and statistics for the problem raster(s) prior to executing the script. I have also tried the raster(s) into GRID format, but neither of these approaches has changed the result. I have had some tiff rasters succeed &lt;SPAN style="color: #303030;"&gt;but othe&lt;/SPAN&gt;r tiffs fail and so far all jp2 files have failed. The location of the VAT file looks suspect as I'm not sure where the '&lt;SPAN style="color: #e23d39;"&gt;\se~d1mse' &lt;SPAN style="color: #303030;"&gt;portion of the filepath comes from or what it refers to. Any ideas why the CreateSignatures fails?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:23:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644679#M4382</guid>
      <dc:creator>StevenSteinmetz</dc:creator>
      <dc:date>2021-12-12T03:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script for supervised classification selectively fails on CreateSignature</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644680#M4383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See if you get better results using forward slashes in your paths. '\t' means tab in Python.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 20:16:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644680#M4383</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-02-15T20:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script for supervised classification selectively fails on CreateSignature</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644681#M4384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;also to note, r notation, no spaces, tildes etc&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migration-blogpost/55463"&gt;Filenames and file paths in Python&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and Darren's poll&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="2285" __jive_macro_name="polls" class="jive_macro_polls jive_macro" data-orig-content="How do you write Python path strings?" data-renderedposition="73_8_263_17" href="https://community.esri.com/"&gt;&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 20:24:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644681#M4384</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-02-15T20:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script for supervised classification selectively fails on CreateSignature</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644682#M4385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;to build on what everyone else is saying, here is an entire thread where file paths are discussed:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/171770"&gt;arcpy.TableToTable_conversion CSV to DBF help&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 20:28:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644682#M4385</guid>
      <dc:creator>AdrianWelsh</dc:creator>
      <dc:date>2016-02-15T20:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script for supervised classification selectively fails on CreateSignature</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644683#M4386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you, I wrote these in incorrectly in the original post...in the actual script theses are user-defined parameters where the user can navigate to / select the folder or file...so the slash shouldn't be the issue&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 20:29:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644683#M4386</guid>
      <dc:creator>StevenSteinmetz</dc:creator>
      <dc:date>2016-02-15T20:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script for supervised classification selectively fails on CreateSignature</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644684#M4387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check and print it out... since it is just returning a string, there is no guarantee that it is properly interpreted... check the examples in my blog post... those are all examples that can be returned from tools.&amp;nbsp; The fixes/checks are easy to fix in a script or tool.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 20:33:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644684#M4387</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-02-15T20:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script for supervised classification selectively fails on CreateSignature</title>
      <link>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644685#M4388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found that in my case, the issue was with one of my input files and not with the code itself. Thank you to all who chimed in.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 21:45:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcpy-script-for-supervised-classification/m-p/644685#M4388</guid>
      <dc:creator>StevenSteinmetz</dc:creator>
      <dc:date>2016-02-15T21:45:02Z</dc:date>
    </item>
  </channel>
</rss>

