<?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: Updating Python Script arcgisscripting $$rowmap, $$colmap // Generating a random pattern raster in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updating-python-script-arcgisscripting-rowmap/m-p/1231097#M66058</link>
    <description>&lt;P&gt;Here's a version (of just the Scripts, the rest of the tool you need from &lt;A href="http://downloads.esri.com/MappingCenter2007/arcGISResources/tools_models_scripts/BumpMapTools.zip" target="_self"&gt;here&lt;/A&gt;) that works in ArcMap 10.8. Note the model doesn't work in ArcGIS Pro as it doesn't iterate.&lt;/P&gt;</description>
    <pubDate>Sun, 13 Nov 2022 22:08:18 GMT</pubDate>
    <dc:creator>Luke_Pinner</dc:creator>
    <dc:date>2022-11-13T22:08:18Z</dc:date>
    <item>
      <title>Updating Python Script arcgisscripting $$rowmap, $$colmap // Generating a random pattern raster</title>
      <link>https://community.esri.com/t5/python-questions/updating-python-script-arcgisscripting-rowmap/m-p/1226846#M65971</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'd like to update an Esri toolbox Python script that calls on ArcGIS 9.3 geoprocessor GRID variables $$rowmap and $$colmap to create a random raster within specific parameters.&lt;/P&gt;&lt;P&gt;I hope to update the existing Python script do something such as:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;create a cell every 10 meters of X and Y with a randomness of 10 (Standard Deviation of 10) which would have looked similar to the text below:&lt;/P&gt;&lt;P&gt;pattern = focalmax(con( ($$rowmap mod int(normal() * 10 + 10) eq 0)and ($$colmap mod int(normal() * 10 + 10) eq 0),255,0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akmapplications_0-1667028223326.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/54761iCE962B08FC0356B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akmapplications_0-1667028223326.png" alt="akmapplications_0-1667028223326.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What is the the alternative to $$rowmap and $$colmap?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Context&lt;/STRONG&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;I want to create bump maps in Arc using the &lt;A href="https://www.esri.com/arcgis-blog/products/product/imagery/introducing-the-arcgis-bump-map-tools/?rmedium=redirect&amp;amp;rsource=blogs.esri.com/esri/arcgis/2010/01/21/introducing-the-arcgis-bump-map-tools" target="_self"&gt;Esri&amp;nbsp;bump map toolbox, released in 2010&lt;/A&gt;.&amp;nbsp;&amp;nbsp;Further explanation on the bump map can also be found from an early &lt;A href="https://proceedings.esri.com/library/userconf/proc03/p0137.pdf" target="_blank" rel="noopener"&gt;Esri UC proceeding&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;The scripts used the ArcGIS 9.3 geoprocessor GRID variables $$rowmap and $$colmap within a Python script that was used in ModelBuilder. Support for these commands was removed starting in ArcGIS 10.0 (so I've read). Although I can import the arcgisscripting geoprocessor 9.3 object without issue and the rest of the script still functions, the offending line 47 in BumpMapPart1.py is below (entire script attached as text file). I don't need a GRID file, I'd be happy with other raster formats.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1066"&gt;@DanPatterson_Retired&lt;/a&gt;&amp;nbsp; - Perhaps this is best solved with NumPy? I think your solution on &lt;A href="https://community.esri.com/t5/arcgis-spatial-analyst-questions/internal-grids-rowmap-colmap-xmap-ymap/m-p/7761" target="_self"&gt;this thread&lt;/A&gt; may be the answer, but you link to another thread that is now broken.&lt;/P&gt;&lt;P&gt;I read a decade old post about &lt;A href="https://community.esri.com/t5/arcgis-spatial-analyst-questions/ncols-rowmap/m-p/272287" target="_self"&gt;Flow Accumulator&lt;/A&gt;, but that seems quite complicated to replace just one line of code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# BumpMapPart1.py
# Description: 
# This script generates point patterns 
# based on the user inputs in a given area (extent)  
# Requirements: Spatial Analyst Extension
# Author: Rajinder Nagi, ESRI
# Date: July 20, 2009
# Revised date: Oct 9, 2009

# Import sys,system modules
import sys, string, os, arcgisscripting
import locale as LOCALE

# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = 1

ws = gp.workspace
scratch = gp.ScratchWorkspace


# Check out Spatial Analyst extension license
    
gp.CheckOutExtension("Spatial")

VegMask = gp.GetParameterAsText(0)
ConeOrDome = gp.GetParameterAsText(1)
Density = gp.GetParameterAsText(2)
Radius = gp.GetParameter(3)
ht = gp.GetParameterAsText(4)
PointPattern = gp.GetParameterAsText(5)

Randomness = "10" # standard deviation

# if you provide density as 20m and randomness of 1, then it will create a point(randomness = 1) 
# at every 20 m of x and y.

try:
    # this will generate random points based on density in a given extent 
    InputCellSize = ""
    if InputCellSize == "":
        cellsize = (Radius*2/11.0)
    else:
        cellsize = InputCellSize
    # Set local variables
    gp.AddMessage ("Generating point pattern...")
    InExpression = "con($$rowmap mod int(normal() * "+ Randomness +" + "+ Density +") == 0 and $$colmap mod int(normal() * "+ Randomness +" + "+ Density +")  == 0,255)"
  
    # Process: MapAlgebraStatement
    gp.CellSize = cellsize
    gp.Mask = VegMask
    #gp.Extent = VegMask
    gp.Extent = "'"+VegMask+"'" ## to deal with spaces in workspace
    gp.SingleOutputMapAlgebra_sa(InExpression, PointPattern)
    gp.AddMessage ("Point pattern generated...")

except Exception as e:
    # If an error occurred while running a tool, then raise the error.
    gp.AddError(e.message)
    raise arcgisscripting.ExecuteError&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Oct 2022 07:52:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-python-script-arcgisscripting-rowmap/m-p/1226846#M65971</guid>
      <dc:creator>AK_Mapplications</dc:creator>
      <dc:date>2022-10-29T07:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Updating Python Script arcgisscripting $$rowmap, $$colmap // Generating a random pattern raster</title>
      <link>https://community.esri.com/t5/python-questions/updating-python-script-arcgisscripting-rowmap/m-p/1230804#M66055</link>
      <description>&lt;P&gt;You can replace&amp;nbsp;&lt;FONT face="courier new,courier" size="2"&gt;gp.SingleOutputMapAlgebra_sa(InExpression, PointPattern) &lt;/FONT&gt;with &lt;FONT face="courier new,courier" size="2"&gt;arcpy.gp.SingleOutputMapAlgebra_sa(InExpression, PointPattern) &lt;/FONT&gt;but you also have to change all the other &lt;FONT face="courier new,courier" size="2"&gt;gp.etc...&lt;/FONT&gt; to the appropriate &lt;FONT face="courier new,courier" size="2"&gt;arcpy.&lt;/FONT&gt; or &lt;FONT face="courier new,courier" size="2"&gt;arcpy.env&lt;/FONT&gt; or &lt;FONT face="courier new,courier" size="2"&gt;arcpy.management&lt;/FONT&gt; etc... and there's a lot of correcting case required as the arcgisscripting gp object wasn't case sensitive but arcpy is.&amp;nbsp; e.g. &lt;FONT face="courier new,courier" size="2"&gt;gp.CellSize&lt;/FONT&gt; or&lt;FONT face="courier new,courier" size="2"&gt; gp.cellsize &lt;/FONT&gt;needs to become &lt;FONT face="courier new,courier" size="2"&gt;arcpy.env.cellSize&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 08:52:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-python-script-arcgisscripting-rowmap/m-p/1230804#M66055</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2022-11-11T08:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Updating Python Script arcgisscripting $$rowmap, $$colmap // Generating a random pattern raster</title>
      <link>https://community.esri.com/t5/python-questions/updating-python-script-arcgisscripting-rowmap/m-p/1231097#M66058</link>
      <description>&lt;P&gt;Here's a version (of just the Scripts, the rest of the tool you need from &lt;A href="http://downloads.esri.com/MappingCenter2007/arcGISResources/tools_models_scripts/BumpMapTools.zip" target="_self"&gt;here&lt;/A&gt;) that works in ArcMap 10.8. Note the model doesn't work in ArcGIS Pro as it doesn't iterate.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2022 22:08:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-python-script-arcgisscripting-rowmap/m-p/1231097#M66058</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2022-11-13T22:08:18Z</dc:date>
    </item>
  </channel>
</rss>

