<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>On my phone so can explain fully, but there are several blockers in GDAL Library that prevent multi threading from being effective. Try using different processes if it is completely required.<br><br>Blake Thompson</div><div><br>On Mar 2, 2016, at 5:44 PM, Lorenzo Bottaccioli <<a href="mailto:lorenzo.bottaccioli@gmail.com">lorenzo.bottaccioli@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,36,38);font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px">Hi,<br>I'm trying to parallelize a code for raster calculation with Gdal_calc.py, but i have relay bad results. I need to perform several raster operation like FILE_out=FILA_a<em style="margin:0px;padding:0px;border:0px">k1+FILE_b</em>k2.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,36,38);font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px">This is the code I'm usign:</p><pre class="" style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;color:rgb(57,51,24);word-wrap:normal;background-color:rgb(238,238,238)"><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">import</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> pandas </span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">as</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> pd
</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">import</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> os
</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">import</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> time
</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">from</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> multiprocessing </span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">import</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> </span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">Pool</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">

df </span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> pd</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">read_csv</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'input.csv'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> sep</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">";"</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> index_col</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'Date Time'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> decimal</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">','</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">)</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
df</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">index </span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> pd</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">to_datetime</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">df</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">index</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> unit</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'s'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">)</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">

start_time </span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> time</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">time</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">()</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
pool</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">Pool</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">processes</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">8</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">)</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
pool</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">map</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">mapcalc</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,[</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">df</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">iloc</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">*</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">20</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">1</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">)*</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">20</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">]</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> </span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">for</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> i </span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">in</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> range</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">len</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">df</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">index</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">)/</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">20</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">1</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">)])</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
pool</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">close</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">()</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
pool</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">join</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">()</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">print</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">"--- %s seconds ---"</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> </span><span class="" style="margin:0px;padding:0px;border:0px;color:black">%</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> </span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">time</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">time</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">()</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> </span><span class="" style="margin:0px;padding:0px;border:0px;color:black">-</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> start_time</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">))</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">


</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">def</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> mapcalc</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">df</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">):</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">

    month</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">={</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">1</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'17'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">2</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'47'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">3</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'75'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">4</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'105'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">5</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'135'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">6</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'162'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">7</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'198'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">8</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'228'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">9</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'258'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">10</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'288'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">11</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'318'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">12</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'344'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">}</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
    hour</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">={</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">4</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'04'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">5</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'05'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">6</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'06'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">7</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'07'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">8</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'08'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">9</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'09'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">10</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'10'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">11</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'11'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">12</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'12'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">13</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'13'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">14</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'14'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">15</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'15'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">16</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'16'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">17</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'17'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">18</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'18'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">19</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'19'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">20</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'20'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">21</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'21'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">22</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'22'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">}</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
    minute</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">={</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">0</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'00'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">15</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'15'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">30</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'30'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">45</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'45'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">}</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
    directory</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'/home/user/Raster/'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
    tmp</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'/home/usr/tmp/'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
    </span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">for</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> i </span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">in</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> df</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">index</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
        </span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">if</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> </span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">4</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"><=</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">hour</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"><</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">22</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">:</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
            </span><span class="" style="margin:0px;padding:0px;border:0px;color:gray">#try:</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
        timeg</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">=</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">time</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">time</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">()</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
            os</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">system</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'gdal_calc.py -A '</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">directory</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'filea_'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">month</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">month</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">]+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'_'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">hour</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">hour</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">]+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">minute</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">minute</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">]+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">' -B '</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">directory</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'fileb_'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">month</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">month</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">]+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'_'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">hour</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">hour</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">]+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">minute</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">minute</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">]+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">' --outfile='</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">tmp</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">str</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">date</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">())+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'_'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">str</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">time</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">())+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">' --calc=A*'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">str</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">df</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">ix</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'k1'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">])+</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'+B*'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">+</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">str</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">df</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">ix</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">'k2'</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">]))</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">
            </span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">print</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">i</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:maroon">"--- %s seconds ---"</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> </span><span class="" style="margin:0px;padding:0px;border:0px;color:black">%</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> </span><span class="" style="margin:0px;padding:0px;border:0px;color:black">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">time</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">.</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">time</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">()</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> </span><span class="" style="margin:0px;padding:0px;border:0px;color:black">-</span><span class="" style="margin:0px;padding:0px;border:0px;color:black"> timeg</span><span class="" style="margin:0px;padding:0px;border:0px;color:black">))</span></code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,36,38);font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px">If i run the code with out parallelization it takes around 650s to complete the calculation. Each process of the for loop is executed in ~10s. If i run with parallelization it takes ~900s to complete the procces and each process of the for loop it takes ~30s.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,36,38);font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px">How is that? how can i Fix this?</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,36,38);font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px">Best L</p></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>gdal-dev mailing list</span><br><span><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a></span><br><span><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></span></div></blockquote></body></html>