<?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: Environment mask ERROR 010422 in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154323#M2145</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you upload the full code, its difficult to answer this with just 1 line of code which is clearly ok if it ran for 100 times?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Nov 2014 14:35:10 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2014-11-07T14:35:10Z</dc:date>
    <item>
      <title>Environment mask ERROR 010422</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154322#M2144</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'm doing a python script that does:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;outRast = Raster(inRast1) - Raster(inRast2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have about 500 of these to process however after about 100 of these the script fails with the warning:&lt;/P&gt;&lt;P&gt;"ERROR 010422: Error in processing the environment mask"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The trouble is that I cannot see anything different in the rasters being processed when the script fails compared to all the ones it has already completed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added a shapefile that encolses all the rasters&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.mask = "mask_poly.shp"&lt;/P&gt;&lt;P&gt;but this hasn't helped.&amp;nbsp; I'm stuck for things to try.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Nov 2014 10:55:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154322#M2144</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-11-07T10:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Environment mask ERROR 010422</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154323#M2145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you upload the full code, its difficult to answer this with just 1 line of code which is clearly ok if it ran for 100 times?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Nov 2014 14:35:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154323#M2145</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2014-11-07T14:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Environment mask ERROR 010422</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154324#M2146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Always the same one?&amp;nbsp; It sounds like one of the rasters doesn't fit within the mask and was projected-on-the-fly&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Nov 2014 15:56:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154324#M2146</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-07T15:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Environment mask ERROR 010422</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154325#M2147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But what can I do about it?&amp;nbsp; I've created a mask shapefile that encompasses all my files but it hasn't helped - I'm not clear on what the mask does.&amp;nbsp; Can I somehow clear a cache so it's recreated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does always fail on the same one, but that's not the only one that fails.&amp;nbsp; I thought it might be a problem with cell size but files that have smaller and larger cells have passed through ok.&amp;nbsp; Files that include nulls have also passed ok.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the full script - and then the botton 4 lines repeat some 500 times with different inputs and outputs.&amp;nbsp; The point of the script is to look for differences in elevation in adjacent tiles - each tile has a 1 row or column of pixel overlaps with its neighbour.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14156053342192406 jive_text_macro" jivemacro_uid="_14156053342192406"&gt;
&lt;P&gt;import arcpy&lt;/P&gt;
&lt;P&gt;import os&lt;/P&gt;
&lt;P&gt;from arcpy import env&lt;/P&gt;
&lt;P&gt;arcpy.CheckOutExtension("Spatial")&lt;/P&gt;
&lt;P&gt;from arcpy.sa import *&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;env.workspace = "c:/myfiles"&lt;/P&gt;
&lt;P&gt;arcpy.env.mask = "c:/maskpoly.shp"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;inRast = "E000_N00.tif"&lt;/P&gt;
&lt;P&gt;inRast2 = "E000_N01.tif"&lt;/P&gt;
&lt;P&gt;outRast = Raster(inRast) - Raster(inRast2)&lt;/P&gt;
&lt;P&gt;outRast.save = "c:/E000_N00a.tif"&lt;/P&gt;



&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 07:47:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154325#M2147</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-11-10T07:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Environment mask ERROR 010422</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154326#M2148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My point was about projections on the fly...is there the remotest possibility that those tiles have been projected-on-the-fly so they appear to be within the mask but are actually not?&amp;nbsp; I would add those tiles that fail ...separately....into a dataframe and examine the coordinates using the coordinates in the bottom right hand corner of the frame and see if they agree with what is expected.&amp;nbsp; alternately bring in just the adjacent tiles and recreate the mask for just those and see if it makes sense.&amp;nbsp; You have ruled out cell size and nodata issues, it boils down to the mask itself or your use of a mask in the first place.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from the help files.... " If the analysis mask is a feature dataset, it will internally be converted to a raster on execution.&amp;nbsp; For this reason, you should take care to ensure that the &lt;A class="xref" href="http://resources.arcgis.com/en/help/main/10.2/001w/001w0000001s000000.htm" rel="/en/help/main/10.2/001w/001w0000001s000000.htm"&gt;Cell Size&lt;/A&gt; and &lt;A class="xref" href="http://resources.arcgis.com/en/help/main/10.2/001w/001w0000000m000000.htm" rel="/en/help/main/10.2/001w/001w0000000m000000.htm"&gt;Snap Raster&lt;/A&gt; are set appropriately for your analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and for snap raster "&lt;/P&gt;&lt;P&gt;Tools that honor the Snap Raster environment will adjust&amp;nbsp; the extent of output rasters so that they match the cell alignment of the specified snap raster.&lt;/P&gt;&lt;P&gt;A Snap Raster is typically used where inputs to tools:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt; Have different cell alignments&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Have different cell resolutions&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Have different coordinate systems&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Are features&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Sooo that is all I can think of... dump the mask...or set cell size and coordinate system...or examine the snap raster possibility.&lt;BR /&gt;Good luck and please report back&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 08:16:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154326#M2148</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-10T08:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Environment mask ERROR 010422</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154327#M2149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok so I don't really understand the problem but I defined an extent and it seems to work now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can define the extent at the beginning as the whole world but, as expected, the script runs slowly.&amp;nbsp; So I calculate the extents for each raster pair in turn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.env.extent = arcpy.Extent(minX, minY, maxX, maxY)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.......hmmm, I also set snap raster to be the same as input raster as just setting extend produced inaccurate results - I don't understand why I have to do this when my input1 and input2 have same cell size and cell alignment.&lt;/P&gt;&lt;P&gt;arcpy.env.snapRaster = inRast&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 10:33:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/environment-mask-error-010422/m-p/154327#M2149</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-11-10T10:33:44Z</dc:date>
    </item>
  </channel>
</rss>

