<?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: Raster save method in python window arcmap 10.2 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/raster-save-method-in-python-window-arcmap-10-2/m-p/341292#M26767</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. My Mask was a polygon shapefile. Specifying its name in the dataframe instead of the path didn't cause any problems.&lt;/P&gt;&lt;P&gt;2. Originally the default workspace was '..\ArcGIS\Default.gdb'&lt;/P&gt;&lt;P&gt;Setting the workspaces to a folder solved my problem! Thanks a lot!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know why using the geodatabase as the workspace didn't work out? Should map algebra always be done outside a file geodatabase?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Dec 2014 15:31:34 GMT</pubDate>
    <dc:creator>jancor</dc:creator>
    <dc:date>2014-12-12T15:31:34Z</dc:date>
    <item>
      <title>Raster save method in python window arcmap 10.2</title>
      <link>https://community.esri.com/t5/python-questions/raster-save-method-in-python-window-arcmap-10-2/m-p/341290#M26765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i try to execute the following commands in the python window&lt;/P&gt;&lt;P&gt;(the spatial analyst extension is checked out)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy.sa import *

# Set Mask environment
arcpy.env.mask = r'mask'

#calculate
temp = Raster("rasterA") - Raster("rasterB")
temp.save("Result")&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RasterA and rasterB are in my dataframe.&lt;/P&gt;&lt;P&gt;After executing &lt;EM&gt;temp = Raster("rasterA") - Raster("rasterB")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;a raster 'temp' appears in my dataframe (source = temporary raster 'minus_ras' in my default geodatabase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if a then execute &lt;EM&gt;temp.save("Result")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I get the following Arcmap drawing error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"One or more layers failed to draw:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;temp:&amp;nbsp; The table was not found. [fras_blk_minus_ras]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;temp:&amp;nbsp; The table was not found."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the geodatabase an entry "Result" can be found, but it's a File Geodatabase Table instead of a File Geodatabase Raster, and I can't add it to my dataframe..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anybody knows what's going wrong?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:07:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-save-method-in-python-window-arcmap-10-2/m-p/341290#M26765</guid>
      <dc:creator>jancor</dc:creator>
      <dc:date>2021-12-11T16:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Raster save method in python window arcmap 10.2</title>
      <link>https://community.esri.com/t5/python-questions/raster-save-method-in-python-window-arcmap-10-2/m-p/341291#M26766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. what is "mask"? If that's a raster or feature layer, I suggest using the real path to the data on disk.&lt;/P&gt;&lt;P&gt;2. What are your workspace settings?&amp;nbsp; Temporary rasters are always saved in grid format so if you're doing a lot of map algebra I've always felt it makes sense to set the workspace and scratch workspace to a folder, and then either .save() or copy your results to a file geodatabase when you are done if that's where you want to save the rasters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy&amp;nbsp; 
from arcpy.sa import *&amp;nbsp; 
from arcpy import env
env.workspace&amp;nbsp; = r"d:\user\work"
env.scratchWorkspace = env.workspace
# set mask to a path to a dataset on disk
env.mask = arcpy.Describe("mask").catalogPath
# calculate
temp = Raster("rasterA") - Raster("rasterB")&amp;nbsp; 
temp.save("Result")&amp;nbsp; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:07:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-save-method-in-python-window-arcmap-10-2/m-p/341291#M26766</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T16:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Raster save method in python window arcmap 10.2</title>
      <link>https://community.esri.com/t5/python-questions/raster-save-method-in-python-window-arcmap-10-2/m-p/341292#M26767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. My Mask was a polygon shapefile. Specifying its name in the dataframe instead of the path didn't cause any problems.&lt;/P&gt;&lt;P&gt;2. Originally the default workspace was '..\ArcGIS\Default.gdb'&lt;/P&gt;&lt;P&gt;Setting the workspaces to a folder solved my problem! Thanks a lot!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know why using the geodatabase as the workspace didn't work out? Should map algebra always be done outside a file geodatabase?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2014 15:31:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-save-method-in-python-window-arcmap-10-2/m-p/341292#M26767</guid>
      <dc:creator>jancor</dc:creator>
      <dc:date>2014-12-12T15:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Raster save method in python window arcmap 10.2</title>
      <link>https://community.esri.com/t5/python-questions/raster-save-method-in-python-window-arcmap-10-2/m-p/341293#M26768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Do you know why using the geodatabase as the workspace didn't work out?&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Map algebra will use the env.scratchFolder for temporary grids if it needs a place to write them. This would fail if for some reason the env.scratchFolder (which is a dynamic property designed to always provide you a writable folder) is not available or corrupt. Normally there isn't a problem.... you may want to debug this with "print env.scratchFolder" and look there and maybe it will be obvious why you couldn't write there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the workspace is a geodatabase and the the scratch workspace is a folder, maybe it would work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think different raster workflows work better with certain file formats, but I'm kind of old school so I like grids. I also like the performance advantages of having a .save() of a temporary grid simply rename it instead of having to actually save the temporary raster to a permanent raster somewhere else.&amp;nbsp; My feeling is that file gdbs are more useful as a raster storage and retrieval format, not as a raster workspace, because files are just a more natural format for raster datasets, with their very large sizes and the inherent spatial indexing of pixel locations. Also, quite a while ago &lt;A href="https://community.esri.com/migrated-users/3428"&gt;Steve Lynch&lt;/A&gt;‌ said doing map algebra with folder workspaces is a good plan and he would know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Dec 2014 02:20:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/raster-save-method-in-python-window-arcmap-10-2/m-p/341293#M26768</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-12-13T02:20:59Z</dc:date>
    </item>
  </channel>
</rss>

