<?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: ExtractByMask issue in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011569#M59358</link>
    <description>&lt;P&gt;You have saved/copied the tif to that location, and the shapefile in the other location? Not just tried using those paths I hope?&lt;/P&gt;&lt;P&gt;Does the .tif file open and display in ArcGIS fine?&amp;nbsp; How do the paths show up in the properties of the datasets when you view them in arcgis?&lt;/P&gt;&lt;P&gt;Also, this script is very simplistic, is it part of a larger script , or to be added to an iterator?&amp;nbsp; I ask because you can easily run the tool instead in ArcGIS.&amp;nbsp; Another troubleshoot would be to initially run the tool in ArcGIS with those inputs.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Dec 2020 20:20:14 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2020-12-21T20:20:14Z</dc:date>
    <item>
      <title>ExtractByMask issue</title>
      <link>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011487#M59352</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;By running the code:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#Local variables&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;v19830101_tif = "C:\\Users\\me\\blablabla\\Dropbox\\Input\\Rainfall1\\19830101.tif"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Process: Extract by Mask&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.gp.ExtractByMask_sa(v19830101_tif, Fish2_shp__3_, clip)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I get the following error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ERROR 000861: Input raster: C:\\Users\\me\\blablabla\\Dropbox\\Input\\Rainfall1\\19830101.tif is not valid&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Does anyone know why? I tried to save the file in a local folder (instead of Dropbox) but I get the same error.&lt;/P&gt;&lt;P&gt;I am using ArcGis Pro 2.4.0&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 17:15:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011487#M59352</guid>
      <dc:creator>AndreaGiglio</dc:creator>
      <dc:date>2020-12-21T17:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: ExtractByMask issue</title>
      <link>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011495#M59353</link>
      <description>&lt;P&gt;Is there any reason behind using the gp tool rather than&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/spatial-analyst/extract-by-mask.htm" target="_blank"&gt;Extract by Mask (Spatial Analyst)—ArcGIS Pro | Documentation.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You've not shown all your parameters in the code, and it's unformatted, also consider renaming your variables to something readable.&lt;/P&gt;&lt;P&gt;I'm guessing it was copied from model builder?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 17:30:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011495#M59353</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-21T17:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: ExtractByMask issue</title>
      <link>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011509#M59354</link>
      <description>&lt;P&gt;Exactly! It was copied from model builder (which was not created by me and it was from 2 years ago so I guess that also the software's version is older than the one I am using). Actually, I also tried this:&lt;/P&gt;&lt;P&gt;outExtractByMask = arcpy.sa.ExtractByMask(v19830101_tif , Fish2_shp__3_)&lt;/P&gt;&lt;P&gt;but still it is showing the same error. Regarding the other parameters, &lt;STRONG&gt;Fish2_shp__3_&lt;/STRONG&gt; is the area to extract while I guess &lt;STRONG&gt;clip &lt;/STRONG&gt;are the clip features but I think the problem is with the .tif file. Can it be a problem of *.tif file extension?&lt;/P&gt;&lt;P&gt;Also, what do you mean by "renaming the variable to something readable"? (I am sorry for the very basic question but I am totally new to ArcGis)&lt;/P&gt;&lt;P&gt;Thanks a lot for your help,&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 18:00:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011509#M59354</guid>
      <dc:creator>AndreaGiglio</dc:creator>
      <dc:date>2020-12-21T18:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: ExtractByMask issue</title>
      <link>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011520#M59355</link>
      <description>&lt;P&gt;I would definitely stay away from your dropbox for both the input and output destinations until you get it working, then you can try to adjust those locations later.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You'll see below how giving logical variable names makes the code more readable, especially when looking at the tool inputs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

input_raster = r"C:\Users\me\19830101.tif"
clip_feature = r"C:\Users\me\fish2.shp"
out_path = r"C:\Users\me\extracted.tif"

outExtractByMask = arcpy.sa.ExtractByMask(input_raster, clip_feature)
outExtractByMask.save(out_path)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 18:20:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011520#M59355</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-21T18:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: ExtractByMask issue</title>
      <link>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011553#M59357</link>
      <description>&lt;LI-CODE lang="python"&gt;input_raster= r"C:\Users\me\Desktop\19830101.tif"
clip_feature=r"C:\Users\me\Desktop\Fish2.shp"
out_path = r"C:\Users\me\Desktop\extracted.tif"
outExtractByMask = arcpy.sa.ExtractByMask(input_raster, clip_feature)
outExtractByMask.save(out_path)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the code above I got the following error (the part in red is the error I was getting with the very first code):&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 4, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\sa\Functions.py", line 7337, in ExtractByMask&lt;BR /&gt;in_mask_data)&lt;BR /&gt;File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\sa\Utils.py", line 53, in swapper&lt;BR /&gt;result = wrapper(*args, **kwargs)&lt;BR /&gt;File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\sa\Functions.py", line 7333, in Wrapper&lt;BR /&gt;out_raster)&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 506, in &amp;lt;lambda&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;arcgisscripting.ExecuteError: ERROR 000861: Input raster: C:\Users\me\Desktop\19830101.tif is not valid.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Failed to execute (ExtractByMask).&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 19:29:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011553#M59357</guid>
      <dc:creator>AndreaGiglio</dc:creator>
      <dc:date>2020-12-21T19:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: ExtractByMask issue</title>
      <link>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011569#M59358</link>
      <description>&lt;P&gt;You have saved/copied the tif to that location, and the shapefile in the other location? Not just tried using those paths I hope?&lt;/P&gt;&lt;P&gt;Does the .tif file open and display in ArcGIS fine?&amp;nbsp; How do the paths show up in the properties of the datasets when you view them in arcgis?&lt;/P&gt;&lt;P&gt;Also, this script is very simplistic, is it part of a larger script , or to be added to an iterator?&amp;nbsp; I ask because you can easily run the tool instead in ArcGIS.&amp;nbsp; Another troubleshoot would be to initially run the tool in ArcGIS with those inputs.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 20:20:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011569#M59358</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-21T20:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: ExtractByMask issue</title>
      <link>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011611#M59361</link>
      <description>&lt;P&gt;Yes, I did (the doubt was legitimate though, given my level)! I realized that the tiff file does not even open with Photo Viewer therefore I must have done something wrong when unzipping or renaming the original files&lt;/P&gt;&lt;P&gt;Thanks for the help and for the patience,&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 23:04:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extractbymask-issue/m-p/1011611#M59361</guid>
      <dc:creator>AndreaGiglio</dc:creator>
      <dc:date>2020-12-21T23:04:38Z</dc:date>
    </item>
  </channel>
</rss>

