<?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: Issues with multiprocessing and spatial analyst in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695111#M53880</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes it is a pain. I have a version of the code without multiprocessing which I keep up-to-date with the multiprocessing version to check that I at least do not have any 'normal' bugs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Feb 2014 18:45:42 GMT</pubDate>
    <dc:creator>JamesRamm</dc:creator>
    <dc:date>2014-02-28T18:45:42Z</dc:date>
    <item>
      <title>Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695101#M53870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have read every blog post and thread I can find on multiprocessing with arcpy and none of the fixes in them have fully addressed my problem. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to do a relatively simple watershed calculation using multiprocessing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The 'worker' function looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
def multi_watershed(pnts, branchID, flowdir, flowacc, scratchWks):

&amp;nbsp;&amp;nbsp;&amp;nbsp; direc = tempfile.mkdtemp(dir = scratchWks) # If called in a pll process, needs to write to seperate directories
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.scratchWorkspace = direc&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; polylist = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for i, p in enumerate(pnts):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = arcpy.PointGeometry(arcpy.Point(p.x, p.y, ID=i))&amp;nbsp; #Convert the shapely point to an arcpy point
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pourpt = sa.SnapPourPoint(pnt, flowacc, 1000) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ws = sa.Watershed(flowdir, pourpt)&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out = os.path.join(direc, "pol_%i"%i) #Generate a filename for the output polygon
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RasterToPolygon_conversion(ws, out)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polylist.append(out) #Append the output file to the list to be returned
&amp;nbsp;&amp;nbsp;&amp;nbsp; res = (branchID, polylist)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return res&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Given a list of points, it snaps the point to high flow accumulation, calculates the watershed and converts it to a polygon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Using one process, this works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a dictionary where each value is a list of points and I am trying to do the multiprocessing over this dictionary. The multiprocessing function looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
def watershed_pll(data, flowdir, flowacc, tempfolder, proc=4):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """ Calculate the watershed for each station point using parallel processing """
&amp;nbsp;&amp;nbsp;&amp;nbsp; pool = Pool(processes = proc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; jobs = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for key, val in data.iteritems():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jobs.append(pool.apply_async(multi_watershed, (val, key, flowdir, flowacc, temp)))&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pool.close()
&amp;nbsp;&amp;nbsp;&amp;nbsp; pool.join()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return jobs
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is as simple as can be and just returns the list of 'Apply_Result' objects. I then run this function from a script. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When using multiprocessing, sometimes it works, but more often than not I get one of these errors:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 010088: Invalid input geodataset (Layer, Tin, etc.).]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unable to remove directory.&amp;nbsp; Possible causes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1- Not owner of the directory&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2- Another person or application is accessing this directory&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or even&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FATAL ERROR(INFADI)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MISSING FILE OR DIRECTORY&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There seems to be no pattern as to if/when these errors will occur and which one it will be...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 08:03:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695101#M53870</guid>
      <dc:creator>JamesRamm</dc:creator>
      <dc:date>2014-02-27T08:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695102#M53871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just a comment, how are you running this script? I have never been able to get multiprocessing to work in pyscripter (my IDE of choice). A collegue of mine did use multiprocessing successfully but ran it in IDLE.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 09:29:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695102#M53871</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2014-02-27T09:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695103#M53872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Just a comment, how are you running this script? I have never been able to get multiprocessing to work in pyscripter (my IDE of choice). A collegue of mine did use multiprocessing successfully but ran it in IDLE.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Through spyder, but really the python console is a seperate process, so I doubt spyder is impacting anything.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I run other operations using arcpy and multiprocessing with no problem - the difference there is that they are only calling one tool; here there are 3 or 4. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My feeling is that arc is attempting to delete/move data inbetween operations that I haven't told it to....although I could be wrong.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 09:54:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695103#M53872</guid>
      <dc:creator>JamesRamm</dc:creator>
      <dc:date>2014-02-27T09:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695104#M53873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wonder if this be one of two potential problems:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Environments/folders getting mixed up. The input data is passed as complete filepaths to some raster datasets which are outside of the scratchWorkspace (which is set locally for each process) where intermediate/output data is created. However, I have noticed that Arc may make folders (typically and 'info' folder) in the directories of the input data. Why is that? Can it be prevented, or can I prevent Arc from then trying to delete it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Are there any potential problems with accessing the input raster data sets at the same time? I.e each process will be attempting to open and read from the flow direction and flow accumulation rasters which are passed into the function.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 09:33:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695104#M53873</guid>
      <dc:creator>JamesRamm</dc:creator>
      <dc:date>2014-02-28T09:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695105#M53874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;info&lt;/SPAN&gt;&lt;SPAN&gt; directory is an important part of an ESRI raster, you will not be able to prevent its generation. With regards to #2 just had an idea, if several processes connecting to the same data is the problem why not duplicate that data but with different names? It looks like you are attempting to use 4 cores so have 4 flow direction grids? Just an idea?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 09:45:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695105#M53874</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2014-02-28T09:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695106#M53875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes that is worth trying; it will at least confirm whether that is the source of the error.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 10:09:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695106#M53875</guid>
      <dc:creator>JamesRamm</dc:creator>
      <dc:date>2014-02-28T10:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695107#M53876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I believe I have solved the issue. I have just done 6 tests with no error...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I have not solved the problem of &lt;/SPAN&gt;&lt;STRONG&gt;why &lt;/STRONG&gt;&lt;SPAN&gt;the issue occurred. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My original 'worker' function called a number of arcpy commands in sequence:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- first it converted a point to an arcpy point using Point and PointGeometry&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- It called the SnapPourPoint tool which output a temporary raster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- It called the Watershed tool, which output another temporary raster&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- It called the RasterToPolygon_conversion tool to create a Polygon object&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I edited the original code so that the only tool used with parallel processing is the Watershed tool (which is most time consuming). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The point conversion and snap pour point tool is called in its own loop separately and the results stored to disk. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The watershed calculation is then performed using parallel processing and the resulting rasters stored to disk.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The conversion is then performed in a loop on these results. Finally, all those intermediate files &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The parallel code now looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def watershed_pll(data, flowdir, flowacc, tempfolder proc=4):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """ Calculate the watershed for each station point using parallel processing """
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Preprocessing of data points for watershed calculation
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts = []&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for key, val in data.iteritems():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts.append(prepare_point(val, flowacc, key, tempfolder))
&amp;nbsp;&amp;nbsp;&amp;nbsp; pp = dict(pnts)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Do the watershed calc in parallel
&amp;nbsp;&amp;nbsp;&amp;nbsp; pool = Pool(processes = proc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; jobs = []&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for key, val in pp.iteritems():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jobs.append(pool.apply_async(pll_watershed, (val, key, flowdir, flowacc, temp)))&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pool.close()
&amp;nbsp;&amp;nbsp;&amp;nbsp; pool.join()&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Converte watershed rasters to polygons
&amp;nbsp;&amp;nbsp;&amp;nbsp; ws_rast = dict([job.get() for job in jobs])
&amp;nbsp;&amp;nbsp;&amp;nbsp; res = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for key, val in ws_rast.items():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res.append(af.ws_poly(val, key, mod.temp))
&amp;nbsp;&amp;nbsp;&amp;nbsp; pols = dict(res)
&amp;nbsp;&amp;nbsp;&amp;nbsp; return pols
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks much bigger - there are now 3 loops instead of one. There is also a lot of dictionary formatting etc to preserve the results format/order for the next loop. This is all a bit more expensive, but happily, the watershed tool is by far the most time consuming and is parallelised. So there is still a significant speed up from single processing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully, the other 2 loops can also be parallelised independently to give another speed up... I'll look into that next.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My only worry is that the intermediate files cannot be deleted each iteration as they need to be used in the next loop..this could potentially be a problem with big data..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am also unsure what caused the initial problem in the first place, which would be good to know.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:15:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695107#M53876</guid>
      <dc:creator>JamesRamm</dc:creator>
      <dc:date>2021-12-12T05:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695108#M53877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In my experience with multiprocessing and pyscripter i have learned a few things about this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Similar to you i had a nightmare trying to get scripts to complete correctly, they would often power through 200 rasters or so then simply stop for no reason... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The solution i had determined in my case (with rasters) was that if i attempted to write the rasters all to the root folder then it would fail. Thus, i simply had each process generate a new folder with a number on the end which would then become the destination folder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After all my rasters had been processed you can then step through the folders and collect them all into a single merged file at the end.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This was the only solution that i could find that worked. The other one was creating "in_memory" versions of the base data each time a process ran. You'll need to manage the data and make sure you delete the files created otherwise you'll run out of memory.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can toss the code up if that would be helpful..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This: &lt;/SPAN&gt;&lt;A href="http://blogs.esri.com/esri/arcgis/2012/09/26/distributed-processing-with-arcgis-part-1/"&gt;http://blogs.esri.com/esri/arcgis/2012/09/26/distributed-processing-with-arcgis-part-1/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;and this: &lt;/SPAN&gt;&lt;A href="http://pythongisandstuff.wordpress.com/2013/07/31/using-arcpy-with-multiprocessing-%E2%80%93-part-3/"&gt;http://pythongisandstuff.wordpress.com/2013/07/31/using-arcpy-with-multiprocessing-%E2%80%93-part-3/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;were also dead useful&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 16:04:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695108#M53877</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2014-02-28T16:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695109#M53878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Code would be helpful.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was already generating a new workspace folder for each process so that is not the problem..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately my solution above is not the total answer. I have found that for larger data, it will still fail, but usually with an ArcGIS error code stating that it is unable to execute the tool or something (will have to wait til monday to get the exact code).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So there is still a problem somewhere...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 16:25:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695109#M53878</guid>
      <dc:creator>JamesRamm</dc:creator>
      <dc:date>2014-02-28T16:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695110#M53879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The other thing that i also remember from my experience is debugging multiprocess is a pain too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I couldn't debug when running asynchronously, i had to work the kinks of the code before then hope that the multi ran fine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 16:31:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695110#M53879</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2014-02-28T16:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695111#M53880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes it is a pain. I have a version of the code without multiprocessing which I keep up-to-date with the multiprocessing version to check that I at least do not have any 'normal' bugs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 18:45:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695111#M53880</guid>
      <dc:creator>JamesRamm</dc:creator>
      <dc:date>2014-02-28T18:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695112#M53881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James and Cody&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm currently busy with my Masters Thesis where I'm developing a geostatistical monte carlo model (conditional sequential guassian simulation) to measure uncertainty within stream networks derived from DEM using Arc Hydro D8 algorithm. My simulation requires a 100 simulations of my study area using Arc Hydro. I'm looking to multi-process the Flow Direction and Flow Accumulation process, but battling to figure out how to cut up the DEM as the following processes require the entire dem to generate the flow direction and flow accumulation. Any&amp;nbsp; ideas&amp;nbsp; or advice would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2014 19:10:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695112#M53881</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2014-07-29T19:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695113#M53882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you clarify the 100 simulations bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are they 100 different versions of the Flow Direction/Accumulation, or is there only one base Flow Direction/Accumulation that your GA model uses?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Taking a guess, if your creating something that does flow direction/accumulation it would seem imperative that having the whole raster would be critical to determining the correct information for flow.&lt;/P&gt;&lt;P&gt;My other guess would be if you could determine where the watersheds are in the area, and break it down into multiple smaller sections you could split the DEM that way potentially.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hard to say without having an understanding of the data though, so hopefully i can help more in a bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2014 20:20:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695113#M53882</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2014-07-29T20:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695114#M53883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Cody&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'l try to explain the workflow of the Monte Carlo Simulation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Monte Carlo simulation takes a raw hydrological DEM\DTM as input and using statistics generates a new DEM\DTM that represents error, by adjusting the elevation values. The following is repeated a certain amount o times, the more the better to produce a better probability distribution of the error. Each DEM\DTM that is produced from the Monte Carlo simulation is then processed using Arc Hydro Terrain Preprocessing to generate a &lt;STRONG&gt;stream network&lt;/STRONG&gt; from the DEM. The Spatial Analyst Hydrology Tools are the same tools (i.e. Flow Direction ; Flow Accumulation ; Stream Definition). My simulation requires that I generate 1000 simulations to produce a new version of the&lt;STRONG&gt; stream network&lt;/STRONG&gt;. The 1000 version of the stream network are then compared to quantify where the uncertainty\error is found within the DEM by how many times the stream network is the same for each version and where it differs due to the change in heights introduced by the simulation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Flow Direction and Flow Acummulation processes are exceptionally computational and currently the tools don't make use of multiprocessing or the the additional memory available as part of the 64bit architecture. I'm looking for a way to split the DEM\DTM and process it using multiprocessing and stick it back together at the end of the process. As you mentioned if there was a way to identify the location of the catchments before hand one could split the DEM\DTM accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 05:02:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695114#M53883</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2014-07-30T05:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiprocessing and spatial analyst</title>
      <link>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695115#M53884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My answer at the moment would be to look elsewhere than arcpy/arcgis for numerical modelling. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps arcobject would allow better control, but there are certainly faster algorithms out there that use less memory consumption than arc hydro's offerings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D8 algorithms are not hard to program yourself and you do not need to look at a 'whole raster' at once. D8 algorithms only look at 9 cells at a time - the current cell and it's neighbours.&lt;/P&gt;&lt;P&gt;The difficulty is in how to manage edge cases. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did a quick example a while ago for work showing that with python/cython and gdal, you could process large rasters (in a format supported by gdal) far quicker than archydro does it by streaming 3 rows at a time and shipping these out to parallel processes. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2014 10:01:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-with-multiprocessing-and-spatial-analyst/m-p/695115#M53884</guid>
      <dc:creator>JamesRamm</dc:creator>
      <dc:date>2014-09-26T10:01:05Z</dc:date>
    </item>
  </channel>
</rss>

