<?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 wrong results using a python script in Transportation Questions</title>
    <link>https://community.esri.com/t5/transportation-questions/wrong-results-using-a-python-script/m-p/140410#M458</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Nancititla&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello everybody!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm working with a model that I´ve exported to python scripts, I had some problems with my model (I don't know why) because when I execute it, sometimes fail in some process and throws a fatal error and arcmap is closed, the rare thing is when I run the process individually, it works very well. So, I decided work with python, but in the reclassbytable process it throws a wrong result. Why? I don't have any ideas, because the result of the simple tool, it's ok.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here, is my script&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Se importan los módulos del sistema para poder ejecutar las herramientas
import sys, string, os, arcgisscripting, win32com.client
import arcpy
from arcpy import env
from arcpy.sa import *

arcpy.CheckOutExtension("Spatial")

# Se valida el área de trabajo establecida por el usuario
env.workspace = arcpy.GetParameterAsText(0)

# Se establecen las variables y nombres de salida de los productos del proceso
smoothsalida = "smooth"
slopesalida = "slope"
slope_recSalida = "pend_fin"
#curvatura_Salida = "curva_smo"
#perfilSalida = "profile"
#planSalida = "Plan"
geol_recSalida = "geol_rec"
isoy_recSalida = "isoy_rec"
suelo_recSalida = "suelo_rec"

# Se valida los datos de entrada seleccionados por el usuario
dem = arcpy.GetParameterAsText(1)&amp;nbsp; # Modelo Digital de Elevación
usosuelo = arcpy.GetParameterAsText(2) # Uso de suelo y vegetación
precipitacion = arcpy.GetParameterAsText(3) # Precipitación
geologia = arcpy.GetParameterAsText(2) # Geología

#---------------------------------------------------------
# Se inicializa el proceso del modelo
#---------------------------------------------------------
# Procedimientos para el Modelo Digital de Elevación (MDE)
#---------------------------------------------------------
# Proceso para determinar las estadísticas focalizadas, se establecen los parámetros
TipoVecindad = NbrCircle(5, "CELL")
smooth = FocalStatistics(dem, TipoVecindad, "MEAN", "DATA")
smooth.save(smoothsalida)

# Proceso para determinar la pendiente
slope = Slope(smooth, "DEGREE", "1")
slope.save(slopesalida)

# Proceso para reclasificar la Pendiente
slope_rec = Reclassify(slope, "VALUE", "0 5 1;5 9 2;9 14 3;14 18 4;18 23 5;23 28 6;28 32 7;32 37 8;37 42 9;42 86 10", "DATA")
slope_rec.save(slope_recSalida)

# Proceso para Determinar la curvatura del MDE
#arcpy.Curvature_3d("C:/data/smooth", "C:/data/curvatu", 1)


#---------------------------------------------------------
# Procedimientos para la Geología
#---------------------------------------------------------
# Proceso para reclasificar la cobertura de Geología
TablaRecGeol = "geologia_rec"
geol_rec = ReclassByTable(geologia, TablaRecGeol, "FROM", "TO", "OUT1", "DATA")
#geol_rec = Reclassify(geologia, "PESO", "1 2;2 1;3 2;4 1;5 4;6 5;7 5;8 3;9 1;10 2;11 4;12 3;13 2;14 2;15 4;16 4;17 4;18 4;19 4;20 3;21 2;22 1;23 5;24 5;25 2;26 2;27 1;28 1;29 1;30 1;31 2;32 5;33 3;34 2;35 4;36 1;37 1;38 1;39 1;40 1;41 1;42 2;43 2;44 2;45 1;46 1;47 1;48 2;49 5;50 5;51 5;52 2;53 1;54 2;55 2;56 2;57 2;58 2;59 0;60 0;61 3;62 2;63 2;64 1;65 1;66 3;67 1;68 2;69 2;70 3;71 3;72 3;73 2;74 2;75 4", "DATA")
geol_rec.save(geol_recSalida)

#---------------------------------------------------------
# Procedimientos para la Precipitación
#---------------------------------------------------------
# Proceso para reclasificar la cobertura de Precipitación
TablaRecIsoy = "isoyetas_rec"
isoy_rec = ReclassByTable(precipitacion, TablaRecIsoy, "FROM", "TO", "OUT", "DATA")
isoy_rec1 = ReclassByTable(precipitacion, TablaRecIsoy, "FROM", "TO", "OUT", "DATA")
isoy_suma = Plus(isoy_rec, isoy_rec1)
salida_isoy = Divide(isoy_suma, 2)
#isoy_rec = Reclassify(precipitacion, "PESO", RemapValue([[1,1],[2,1],[3,1],[4,2],[5,2],[6,2],[7,2],[8,3],[9,3],[10,3],[11,4],[12,4],[13,4],[14,5],[15,6],[16,7],[17,8],[18,9],[19,10]]), "DATA")
salida_isoy.save(isoy_recSalida)

#---------------------------------------------------------
# Procedimientos para el Uso de Suelo y Vegetación
#---------------------------------------------------------
# Proceso para reclasificar la cobertura de Uso de Suelo y Vegetación 2010
TablaRec = "usv_rec"
suelo_rec = ReclassByTable(usosuelo, TablaRec, "FROM", "TO", "OUT", "DATA")
#suelo_rec = Reclassify(usosuelo, "PESO", RemapValue([[1,1],[2,8],[3,9],[4,1],[5,0],[6,6],[7,1],[8,0],[9,5],[10,10],[11,2]]), "DATA")
suelo_rec.save(suelo_recSalida)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I load the images to ilustrate that I said, I hope someone can help me. Thanks a lot!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first image is my model.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The second image is the result of the python script, it have some white spaces (nodata) and thats wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The third image is the result of the individually tool (reclassify), and It's ok&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 07:44:41 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-11T07:44:41Z</dc:date>
    <item>
      <title>wrong results using a python script</title>
      <link>https://community.esri.com/t5/transportation-questions/wrong-results-using-a-python-script/m-p/140410#M458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Nancititla&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello everybody!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm working with a model that I´ve exported to python scripts, I had some problems with my model (I don't know why) because when I execute it, sometimes fail in some process and throws a fatal error and arcmap is closed, the rare thing is when I run the process individually, it works very well. So, I decided work with python, but in the reclassbytable process it throws a wrong result. Why? I don't have any ideas, because the result of the simple tool, it's ok.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here, is my script&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Se importan los módulos del sistema para poder ejecutar las herramientas
import sys, string, os, arcgisscripting, win32com.client
import arcpy
from arcpy import env
from arcpy.sa import *

arcpy.CheckOutExtension("Spatial")

# Se valida el área de trabajo establecida por el usuario
env.workspace = arcpy.GetParameterAsText(0)

# Se establecen las variables y nombres de salida de los productos del proceso
smoothsalida = "smooth"
slopesalida = "slope"
slope_recSalida = "pend_fin"
#curvatura_Salida = "curva_smo"
#perfilSalida = "profile"
#planSalida = "Plan"
geol_recSalida = "geol_rec"
isoy_recSalida = "isoy_rec"
suelo_recSalida = "suelo_rec"

# Se valida los datos de entrada seleccionados por el usuario
dem = arcpy.GetParameterAsText(1)&amp;nbsp; # Modelo Digital de Elevación
usosuelo = arcpy.GetParameterAsText(2) # Uso de suelo y vegetación
precipitacion = arcpy.GetParameterAsText(3) # Precipitación
geologia = arcpy.GetParameterAsText(2) # Geología

#---------------------------------------------------------
# Se inicializa el proceso del modelo
#---------------------------------------------------------
# Procedimientos para el Modelo Digital de Elevación (MDE)
#---------------------------------------------------------
# Proceso para determinar las estadísticas focalizadas, se establecen los parámetros
TipoVecindad = NbrCircle(5, "CELL")
smooth = FocalStatistics(dem, TipoVecindad, "MEAN", "DATA")
smooth.save(smoothsalida)

# Proceso para determinar la pendiente
slope = Slope(smooth, "DEGREE", "1")
slope.save(slopesalida)

# Proceso para reclasificar la Pendiente
slope_rec = Reclassify(slope, "VALUE", "0 5 1;5 9 2;9 14 3;14 18 4;18 23 5;23 28 6;28 32 7;32 37 8;37 42 9;42 86 10", "DATA")
slope_rec.save(slope_recSalida)

# Proceso para Determinar la curvatura del MDE
#arcpy.Curvature_3d("C:/data/smooth", "C:/data/curvatu", 1)


#---------------------------------------------------------
# Procedimientos para la Geología
#---------------------------------------------------------
# Proceso para reclasificar la cobertura de Geología
TablaRecGeol = "geologia_rec"
geol_rec = ReclassByTable(geologia, TablaRecGeol, "FROM", "TO", "OUT1", "DATA")
#geol_rec = Reclassify(geologia, "PESO", "1 2;2 1;3 2;4 1;5 4;6 5;7 5;8 3;9 1;10 2;11 4;12 3;13 2;14 2;15 4;16 4;17 4;18 4;19 4;20 3;21 2;22 1;23 5;24 5;25 2;26 2;27 1;28 1;29 1;30 1;31 2;32 5;33 3;34 2;35 4;36 1;37 1;38 1;39 1;40 1;41 1;42 2;43 2;44 2;45 1;46 1;47 1;48 2;49 5;50 5;51 5;52 2;53 1;54 2;55 2;56 2;57 2;58 2;59 0;60 0;61 3;62 2;63 2;64 1;65 1;66 3;67 1;68 2;69 2;70 3;71 3;72 3;73 2;74 2;75 4", "DATA")
geol_rec.save(geol_recSalida)

#---------------------------------------------------------
# Procedimientos para la Precipitación
#---------------------------------------------------------
# Proceso para reclasificar la cobertura de Precipitación
TablaRecIsoy = "isoyetas_rec"
isoy_rec = ReclassByTable(precipitacion, TablaRecIsoy, "FROM", "TO", "OUT", "DATA")
isoy_rec1 = ReclassByTable(precipitacion, TablaRecIsoy, "FROM", "TO", "OUT", "DATA")
isoy_suma = Plus(isoy_rec, isoy_rec1)
salida_isoy = Divide(isoy_suma, 2)
#isoy_rec = Reclassify(precipitacion, "PESO", RemapValue([[1,1],[2,1],[3,1],[4,2],[5,2],[6,2],[7,2],[8,3],[9,3],[10,3],[11,4],[12,4],[13,4],[14,5],[15,6],[16,7],[17,8],[18,9],[19,10]]), "DATA")
salida_isoy.save(isoy_recSalida)

#---------------------------------------------------------
# Procedimientos para el Uso de Suelo y Vegetación
#---------------------------------------------------------
# Proceso para reclasificar la cobertura de Uso de Suelo y Vegetación 2010
TablaRec = "usv_rec"
suelo_rec = ReclassByTable(usosuelo, TablaRec, "FROM", "TO", "OUT", "DATA")
#suelo_rec = Reclassify(usosuelo, "PESO", RemapValue([[1,1],[2,8],[3,9],[4,1],[5,0],[6,6],[7,1],[8,0],[9,5],[10,10],[11,2]]), "DATA")
suelo_rec.save(suelo_recSalida)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I load the images to ilustrate that I said, I hope someone can help me. Thanks a lot!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first image is my model.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The second image is the result of the python script, it have some white spaces (nodata) and thats wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The third image is the result of the individually tool (reclassify), and It's ok&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:44:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/wrong-results-using-a-python-script/m-p/140410#M458</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T07:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: wrong results using a python script</title>
      <link>https://community.esri.com/t5/transportation-questions/wrong-results-using-a-python-script/m-p/140411#M459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&lt;BLOCKQUOTE&gt;Nancititla;135527 wrote:&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Se valida los datos de entrada seleccionados por el usuario
dem = arcpy.GetParameterAsText(1)&amp;nbsp; # Modelo Digital de Elevación
usosuelo = arcpy.GetParameterAsText(2) # Uso de suelo y vegetación
precipitacion = arcpy.GetParameterAsText(3) # Precipitación
geologia = arcpy.GetParameterAsText(2) # Geología&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you noticed that you are assigning precip and geology to the same input argument??&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:44:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/wrong-results-using-a-python-script/m-p/140411#M459</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T07:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: wrong results using a python script</title>
      <link>https://community.esri.com/t5/transportation-questions/wrong-results-using-a-python-script/m-p/140412#M460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Nancititla&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply!! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Have you noticed that you are assigning precip and geology to the same input argument??&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No, I don't had notice of this detail, thanks for the observation. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, I did the necesary changes but my problem still happend, I don't know why &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 18:34:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/wrong-results-using-a-python-script/m-p/140412#M460</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-09-22T18:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: wrong results using a python script</title>
      <link>https://community.esri.com/t5/transportation-questions/wrong-results-using-a-python-script/m-p/140413#M461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks!! I found the mistake. I hadn't done my table in a correct way, I did it manualy (that's wrong). In reclassify tool there is an option to save the table with parameters to use later (this is the correct way to do the table). And the format is *.rmp&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Atte.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nans&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2011 14:41:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/wrong-results-using-a-python-script/m-p/140413#M461</guid>
      <dc:creator>NancyHernandez</dc:creator>
      <dc:date>2011-10-06T14:41:25Z</dc:date>
    </item>
  </channel>
</rss>

