[GRASS-dev] r.mapcalc - expression line to long

Helmut Kudrnovsky hellik at web.de
Wed Jul 2 10:28:29 PDT 2014


hi,

given in a pynthon script:


        offsets3 = [d
             for j in xrange(1,6+1)
             for i in [j,-j]
             for d in
[(i,0),(i,1),(i,2),(i,3),(i,4),(i,5),(i,6),(i,-1),(i,-2),(i,-3),(i,-4),(i,-5),(i,-6)]]	
		 
        terms3 = ["(DEM_smoothed_step3_coarsed[%d,%d] <
DEM_smoothed_step3_coarsed)" % d
             for d in offsets3]	
		 
        expr3 = "PCTL3 = (100.0 / 168.0) * (%s)" % " + ".join(terms3)

        grass.mapcalc( expr3 )

an attempt to build a r.mapcalc-expression with a 6x6 moving window.

the expression expands to:

PCTL3 = (100.0 / 168.0) * ((DEM_smoothed_step3_coarsed[1,0] <
DEM_smoothed_step3_coarsed) + (DEM_smoothed_step3_coarsed[1,1] <
DEM_smoothed_step3_coarsed) + (DEM_smoothed_step3_coarsed[1,2] <
DEM_smoothed_step3_coarsed) + (DEM_smoothed_step3_coarsed[1,3] <
DEM_smoothed_step3_coarsed) + (DEM_smoothed_step3_coarsed[1,4] <
DEM_smoothed_step3_coarsed) + (DEM_smoothed_step3_coarsed[1,5] <
DEM_smoothed_step3_coarsed) + (DEM_smoothed_step3_coarsed[1,6] <
DEM_smoothed_step3_coarsed) + (DEM_smoothed_step3_coarsed[1,-1] <
DEM_smoothed_step3_coarsed) + 
[...]

by running the python script, a r.mapcalc-error pops up that the expression
line is to long.

any ideas to build a so long expression for r.mapcalc which can finish?


GRASS Version: 7.0.0svn                                                         
GRASS SVN Revision: 60869                                                       
Erstellungsdatum: 2014-06-20                                                    
Build Platform: i686-pc-mingw32                                                 
GDAL/OGR: 1.11.0                                                                
PROJ.4: 4.8.0                                                                   
GEOS: 3.4.2                                                                     
SQLite: 3.7.17                                                                  
Python: 2.7.4                                                                   
wxPython: 2.8.12.1                                                              
Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)  



-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/r-mapcalc-expression-line-to-long-tp5149281.html
Sent from the Grass - Dev mailing list archive at Nabble.com.


More information about the grass-dev mailing list