<?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 Cannot reclassify raster with python in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374666#M2429</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a raster which originates from a large tiff file being clipped and resampled. The resulting raster &lt;EM&gt;resampled_raster &lt;/EM&gt;retains the same projection and opens up just fine in arcmap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to reclassify &lt;EM&gt;resampled_raster&lt;/EM&gt; using arcpy and assign the result to a variable named &lt;EM&gt;reclassed_raster&lt;/EM&gt;. Both &lt;EM&gt;resampled_raster&lt;/EM&gt; and &lt;EM&gt;reclassed_raster&lt;/EM&gt; are not string variables but rather variables of type &lt;EM&gt;&amp;lt;class 'arcpy.arcobjects.arcobjects.Result'&amp;gt;&lt;/EM&gt; which should be fine for my purposes. I have been flinging these objects around in my script as geoprocessing inputs and outputs without any problems thus far.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following command, when executed from cmd:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;reclassed_raster = arcpy.gp.Reclassify_sa(resampled_raster, "Value", "1 1;2 1;3 1;4 1;5 1;NODATA 0", "reclass", "DATA")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;throws an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcgisscripting.ExecuteError: ERROR 999999: Error executing function.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;General function failure This spatial reference object cannot be&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;defined from the available information. Failed to execute&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;(Reclassify).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Strangely, when I try to reclass my raster (the same exact one) through an arcmap session I don't have any problems, it reclasses just fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also googled the error to see if any potential solutions or workarounds exist and I came across &lt;A href="https://support.esri.com/en/technical-article/000012382"&gt;this link&lt;/A&gt;, which claims the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Cause&lt;/STRONG&gt; This is expected behavior, as there are certain naming&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;restrictions set for the grid raster format. The naming restrictions&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;include special characters, which are not supported by the grid raster&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;format. Special characters may include accents and umlauts as well as&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;non-alphanumeric characters.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Solution or Workaround&lt;/STRONG&gt; Rename the folder to ensure the path name of&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;the raster dataset does not contain special characters, or move the&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;raster file to a directory containing no special characters.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in my case my directory contains no special characters. I tried different possibilities such as adding the name of the output raster in my function call, not assigning the result to a `reclassed_raster` variable and other obvious variations, but to no avail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to be able to reclass this raster through cmd so I don't have to babysit my script. What could be the problem here? Why does it run OK in arcmap but not in my script through cmd?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Aug 2018 04:15:00 GMT</pubDate>
    <dc:creator>TheWorm</dc:creator>
    <dc:date>2018-08-07T04:15:00Z</dc:date>
    <item>
      <title>Cannot reclassify raster with python</title>
      <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374666#M2429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a raster which originates from a large tiff file being clipped and resampled. The resulting raster &lt;EM&gt;resampled_raster &lt;/EM&gt;retains the same projection and opens up just fine in arcmap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to reclassify &lt;EM&gt;resampled_raster&lt;/EM&gt; using arcpy and assign the result to a variable named &lt;EM&gt;reclassed_raster&lt;/EM&gt;. Both &lt;EM&gt;resampled_raster&lt;/EM&gt; and &lt;EM&gt;reclassed_raster&lt;/EM&gt; are not string variables but rather variables of type &lt;EM&gt;&amp;lt;class 'arcpy.arcobjects.arcobjects.Result'&amp;gt;&lt;/EM&gt; which should be fine for my purposes. I have been flinging these objects around in my script as geoprocessing inputs and outputs without any problems thus far.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following command, when executed from cmd:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;reclassed_raster = arcpy.gp.Reclassify_sa(resampled_raster, "Value", "1 1;2 1;3 1;4 1;5 1;NODATA 0", "reclass", "DATA")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;throws an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcgisscripting.ExecuteError: ERROR 999999: Error executing function.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;General function failure This spatial reference object cannot be&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;defined from the available information. Failed to execute&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;(Reclassify).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Strangely, when I try to reclass my raster (the same exact one) through an arcmap session I don't have any problems, it reclasses just fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also googled the error to see if any potential solutions or workarounds exist and I came across &lt;A href="https://support.esri.com/en/technical-article/000012382"&gt;this link&lt;/A&gt;, which claims the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Cause&lt;/STRONG&gt; This is expected behavior, as there are certain naming&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;restrictions set for the grid raster format. The naming restrictions&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;include special characters, which are not supported by the grid raster&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;format. Special characters may include accents and umlauts as well as&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;non-alphanumeric characters.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Solution or Workaround&lt;/STRONG&gt; Rename the folder to ensure the path name of&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;the raster dataset does not contain special characters, or move the&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;raster file to a directory containing no special characters.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in my case my directory contains no special characters. I tried different possibilities such as adding the name of the output raster in my function call, not assigning the result to a `reclassed_raster` variable and other obvious variations, but to no avail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to be able to reclass this raster through cmd so I don't have to babysit my script. What could be the problem here? Why does it run OK in arcmap but not in my script through cmd?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 04:15:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374666#M2429</guid>
      <dc:creator>TheWorm</dc:creator>
      <dc:date>2018-08-07T04:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot reclassify raster with python</title>
      <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374667#M2430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when you are running outside of arcmap or pro, you need to be particular about specifying your environment or using full path names to your data.&amp;nbsp; Are you wanting to run a script as a scheduled task?&amp;nbsp; I would not be surprised that you didn't get other error messages given the information that you have provided.&amp;nbsp; What information preceeded the line you posted?&amp;nbsp; If you are running a script, can you provide it in full using code syntax highlighting. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 07:08:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374667#M2430</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-08-07T07:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot reclassify raster with python</title>
      <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374668#M2431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan, thanks for your response. I have attached the full scripts to my original question. The problematic line is line 100. &lt;EM&gt;test.py&lt;/EM&gt; is the main script. &lt;EM&gt;force_zonal.py &lt;/EM&gt;is called by&amp;nbsp;&lt;EM&gt;test.py&amp;nbsp;&lt;/EM&gt;at line&amp;nbsp;123 but I really don't think it will have an impact on the reclassify problem. I've just included here for completeness. If you cannot find the scripts, please let me know and I'll provide another link for you to download them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 07:31:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374668#M2431</guid>
      <dc:creator>TheWorm</dc:creator>
      <dc:date>2018-08-07T07:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot reclassify raster with python</title>
      <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374669#M2432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;resampled_raster… is that on disk? or in memory? it is hard to tell since you are switching around it appears.&lt;/P&gt;&lt;P&gt;You can reclass the raster within arcmap/pro since all the information to do so can be found.&amp;nbsp; It appears that when the script is run outside, something is indeed missing in order to complete the reclassification&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 08:41:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374669#M2432</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-08-07T08:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot reclassify raster with python</title>
      <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374670#M2433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;resampled_raster&lt;/EM&gt; is on disk. I want for&amp;nbsp;&lt;EM&gt;reclassed_raster&amp;nbsp;&lt;/EM&gt;to get dumped to disk also.&amp;nbsp;Stepping out of the script to run an entire arcmap session for a simple reclass is definitely something I'd like to avoid.&amp;nbsp;I'd like&amp;nbsp;to try to resolve the source of this problem. Line 76 takes hours to run, and once its done I expect line 123 also to take hours. Furthermore I will have to make sure this script can run for several input datasets. I have to start the script and let it run overnight. Interrupting the whole process by reclassifying in ArcMap is not an option I'm afraid.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 09:00:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374670#M2433</guid>
      <dc:creator>TheWorm</dc:creator>
      <dc:date>2018-08-07T09:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot reclassify raster with python</title>
      <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374671#M2434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I followed the link from &lt;A href="https://gis.stackexchange.com/questions/291904/reclassifying-raster-with-arcpy"&gt;GIS Stack exchange&lt;/A&gt; to review your scripts and I have a few comments:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;You are saying you have some long run times and I note your inputs are shapefiles, make sure your have built &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/add-spatial-index.htm"&gt;spatial indices&lt;/A&gt; for all input shapefiles, this will speed up certain types of operations.&lt;/LI&gt;&lt;LI&gt;Geoprocessing tools return &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-classes/result.htm"&gt;RESULT objects&lt;/A&gt;, which you can query for the output and a bunch of other properties such as did it actually succeed. In your Test.py code line 47, you do not provide the correct parameters for the buffer tool, the second parameter is the output featureclass, so where has it gone? I guess ArcMap has defaulted to some other location and you assign the result of the buffer tool to "extraction_buffer". I personally think this is bad coding as "extraction_buffer" is really a &lt;EM&gt;result object&lt;/EM&gt; which you would then query for output/success.&lt;/LI&gt;&lt;LI&gt;I feel you make the same confusing mistakes on lines 23, 35 &amp;amp;&amp;nbsp; 57, you are passing result objects around and treating them as datasets which makes reading the code very confusing and may possibly be the source of your problem? For example does the result object expose the spatial reference of the output, may be the tool is trying to extract that unsuccessfully?&lt;/LI&gt;&lt;LI&gt;For track-ability you are writing some of your datasets to the workspace as defined by the python command&amp;nbsp;os.getcwd(), so where is that? Some sub-folder in your user profile I suspect? Better off defining it precisely such as r"C:\Temp".&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some ideas to follow.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 11:12:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374671#M2434</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2018-08-07T11:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot reclassify raster with python</title>
      <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374672#M2435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;would have been nice to know that there was a parallel thread going.&lt;/P&gt;&lt;P&gt;you can take over Duncan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 11:18:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374672#M2435</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-08-07T11:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot reclassify raster with python</title>
      <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374673#M2436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would never step on your toes! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 11:32:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374673#M2436</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2018-08-07T11:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot reclassify raster with python</title>
      <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374674#M2437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for taking a look. I will address items 2 and 3 from your post. 1 and 4 are important and relevant, however I don't&amp;nbsp;believe they are causing the issue at hand. My responses are as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. I am doing this because, in my humble opinion, the following is quite redundant (alternate to line 35):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;extraction_buffer = arcpy.Buffer_analysis(in_features=input_shapefile, out_feature_class = 'extraction_buffer', buffer_distance_or_field=mask_extraction_buffer_size_as_string, line_side="FULL", line_end_type="FLAT", dissolve_option="ALL", dissolve_field="", method="PLANAR")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't like the idea of having to specify both the&amp;nbsp;&lt;EM&gt;out_feature_class&amp;nbsp;&lt;/EM&gt;as '&lt;EM&gt;extraction_buffer'&amp;nbsp;&lt;/EM&gt;while instantiating the variable in my script. This result being intermediate, it's name&amp;nbsp;should be completely&amp;nbsp;irrelevant. I am intentionally omitting the output file name and letting arcpy choose an arbitrary name for it. I only want to keep a reference to it such that I can use it in a subsequent geoprocessing operation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course I could do this instead:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;arcpy.Buffer_analysis(in_features=input_shapefile, out_feature_class = 'extraction_buffer', buffer_distance_or_field=mask_extraction_buffer_size_as_string, line_side="FULL", line_end_type="FLAT", dissolve_option="ALL", dissolve_field="", method="PLANAR")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But then I would not be able to place it as part of some internal pythonic data structure if I wanted to (such as a list or dict). I'd always have to refer to it by&amp;nbsp;&lt;EM&gt;'extraction_buffer'&amp;nbsp;&lt;/EM&gt;as a string which is somehow annoying to me.I want the thing as an&amp;nbsp;object. I'm sure&amp;nbsp;&lt;EM&gt;arcpy&lt;/EM&gt; has a way to do this? Aren't &lt;EM&gt;arcpy.FeatureSet&lt;/EM&gt; and &lt;EM&gt;arcpy.Raster&lt;/EM&gt; class types which represent feature classes or rasters? I used those in lines 20 and 21...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. It's quite likely that the resultobject has no spatial reference. If so then I would ask the following: how can I set the results of geoprocessing operations such that I don't have to worry about their file name and extension, and such that they retain all their geospatial properties including projection/spatial reference?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the long-winded response, but I hope it clarifies things. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 18:21:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374674#M2437</guid>
      <dc:creator>TheWorm</dc:creator>
      <dc:date>2018-08-07T18:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot reclassify raster with python</title>
      <link>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374675#M2438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would code some thing like this, as you can see I call my result object something sensible like &lt;EM&gt;res&lt;/EM&gt; for result! Interrogate it to see if the buffer tool actual ran and as the output of a buffer tool is a FeatureClass I convert that into a layer object which I'm referencing by name with the string &lt;EM&gt;extraction_buffer_layer&lt;/EM&gt; . You could argue that your approach uses less code but I think my approach is more transparent which should help you track down the source of the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

&lt;SPAN class="comment token"&gt;#check out extension in arcpy&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CheckOutExtension&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Spatial"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

input_raster_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"D:\GIS\GIS Data\nm50_dem"&lt;/SPAN&gt;
input_raster &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Raster&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;input_raster_path&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Layer names&lt;/SPAN&gt;
extraction_buffer_layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"extraction_buffer_layer"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Set environment&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\scratch"&lt;/SPAN&gt;

res &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Buffer_analysis&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"test.shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"buffered.shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; res&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;status &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# Success OK to continue&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"buffered.shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;extraction_buffer_layer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; extracted_raster &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;gp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ExtractByMask_sa&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;input_raster&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; extraction_buffer_layer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Someting went wrong!"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:20:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/cannot-reclassify-raster-with-python/m-p/374675#M2438</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-12-11T17:20:32Z</dc:date>
    </item>
  </channel>
</rss>

