hi, in a python script within a mapcalc-expression I have moving window with 6 cells in all directions and a if(x,a,b) for each cell in
r.mapcalc "elevation_percentile_step2 = (100.0 / 48.0) * \ (if(eudem_osttirol[3,3] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[2,2] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[1,1] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[-3,3] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[-2,2] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[-1,1] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[3,0] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[3,-3] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[2,0] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[2,-2] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[1,0] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[1,-1] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[0,3] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[0,2] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[0,1] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[0,-1] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[0,-2] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[0,-3] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[-1,0] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[-1,-1] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[-2,0] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[-2,-2] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[-3,0] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[-3,-3] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[-4,4] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[-5,5] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[-6,6] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[0,4] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[0,5] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[0,6] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[4,4] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[5,5] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[6,6] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[4,0] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[5,0] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[6,0] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[4,-4] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[5,-5] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[6,-6] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[0,-4] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[0,-5] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[0,-6] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[-4,-4] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[-5,-5] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[-6,-6] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[-4,0] < eudem_osttirol , 1, 0 ) \ + if(eudem_osttirol[-5,0] < eudem_osttirol , 1, 0 ) + if(eudem_osttirol[-6,0] < eudem_osttirol , 1, 0 ))" any idea/hint to simplify and/or accelerate such a python script with such a large moving window? thanks ----- best regards Helmut -- View this message in context: http://osgeo-org.1560.x6.nabble.com/grass7-python-script-moving-window-how-to-simplify-accelerate-r-mapcalc-tp5143161.html Sent from the Grass - Dev mailing list archive at Nabble.com. _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev