-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logistic Regression Errors #103
Comments
Which version and what inputs?
…On Tue, Jul 3, 2018, 11:25 cugxiaofan ***@***.***> wrote:
Caught ExecuteError in logistic regression. Details:
ERROR 010328: Syntax error at or near symbol ,.
ERROR 010267: Syntax error in parsing grid expression.
Failed to execute (Combine).
Traceback
File "G:\360Downloads\ArcSDM\Toolbox\arcsdm\logisticregression.py", line
162, in Execute
gp.Combine_sa(Input_Combine_rasters, thmUC)
Error Info:
ERROR 010328: Syntax error at or near symbol ,.
ERROR 010267: Syntax error in parsing grid expression.
Failed to execute (Combine).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#103>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKV5eexDkianp23p83qBQS2wHMESsE3Uks5uCypbgaJpZM4VAgKM>
.
|
Executing: LogisticRegressionTool bwof_gch1;bwof_ghy1;bwof_int1;bwof_sta1;bwof_str1 f;f;f;f;f F:\data_processed\ltemp\bwof_gch1_Weights.dbf;F:\data_processed\ltemp\bwof_ghy1_Weights.dbf;F:\data_processed\ltemp\bwof_int1_Weights.dbf;F:\data_processed\ltemp\bwof_sta1_Weights.dbf;F:\data_processed\ltemp\bwof_str1_Weights.dbf cumo -99 4 F:\data_processed\temp\blr_ply.dbf F:\data_processed\temp\blr_coef.dbf F:\data_processed\temp\blr_post.tif F:\data_processed\temp\blr_poststd.tif F:\data_processed\temp\blr_conf.tif ========== arcsdm values ========== Arcgis environment: Desktop (10.2) Training Sites: 12Unit Cell Area: 4.0km^2, Cells in area: 13074.0 Caught ExecuteError in logistic regression. Details: Traceback Traceback (most recent call last): Failed to execute (LogisticRegressionTool). |
ArcGIS 10.2, five WofE layers. |
Ok, please create empty text file called DEBUG into toolbox\arcsdm\ directory and rerun the project for more detailed output. It could be some error in parameters or perhaps incompatibility with 10.2. |
I modified the following codes: Traceback Error Info: Traceback (most recent call last): Failed to execute (LogisticRegressionTool). |
And, I have tried to short the file name (tmp_UCras0, e.g. UCr), but the erros still exists. |
I have referenced the ArcGIS help, but I don't think my new codes have any problem. Combine_sample.py Set local variablesoutRaster = "C:/data/final_1" Check out Spatial Analyst extension licensegp.CheckOutExtension("Spatial") Process: Combine...gp.Combine_sa("'C:/data/ras_1';'C:/data/ras_2'", outRaster) If an error occurred while running a tool, then print the messages.print gp.GetMessages() |
What is the output of this (print it after it is set): |
Input_Combine_rasters ="r'F:\data_processed\ltemp\bwof_gch1_G1'; r'F:\data_processed\ltemp\bwof_ghy1_G1'; r'F:\data_processed\ltemp\bwof_int1_G1'; r'F:\data_processed\ltemp\bwof_sta1_G1'; r'F:\data_processed\ltemp\bwof_str1_G1'" gp.Combine_sa("'C:/data/ras_1';'C:/data/ras_2'", outRaster) |
using r to make \t or \r not work. |
and thmUC=r"F:\data_processed\ltemp\tmp_UCras0" |
You tried also without r? I think it could be the problem... You can also
try replacing \ with / as iirc they are replaceable.
…On Wed, Jul 4, 2018 at 3:28 PM cugxiaofan ***@***.***> wrote:
Input_Combine_rasters ="r'F:\data_processed\ltemp\bwof_gch1_G1';
r'F:\data_processed\ltemp\bwof_ghy1_G1';
r'F:\data_processed\ltemp\bwof_int1_G1';
r'F:\data_processed\ltemp\bwof_sta1_G1';
r'F:\data_processed\ltemp\bwof_str1_G1'"
gp.Combine_sa("'C:/data/ras_1';'C:/data/ras_2'", outRaster)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#103 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AKV5eUoDbLicRiOZHoxtCRpNx9v_Qn2Gks5uDLTVgaJpZM4VAgKM>
.
|
Caught ExecuteError in logistic regression. Details: Traceback Error Info: Traceback (most recent call last): Failed to execute (LogisticRegressionTool). |
Okay, perhaps there is something wrong with 10.2.
Could you try something in this manner:
outCombine = Combine(["filter", "zone", "source.img", "dec.tif"])
outCombine.save("C:/sapyexamples/output/outcombine2")
So in this case it would be just
outCombine = arcpy.Combine( Wts_Rasters);
outCombine.save( outRaster )
…On Wed, Jul 4, 2018 at 5:23 PM cugxiaofan ***@***.***> wrote:
Caught ExecuteError in logistic regression. Details:
ERROR 010328: Syntax error at or near symbol ,.
ERROR 010267: Syntax error in parsing grid expression.
Failed to execute (Combine).
Traceback
File "G:\360Downloads\ArcSDM\Toolbox\arcsdm\logisticregression.py", line
165, in Execute
gp.Combine_sa("'F:/data_processed/ltemp/bwof_gch1_G0';'F:/data_processed/ltemp/bwof_ghy1_G0';'F:/data_processed/ltemp/bwof_int1_G0';'F:/data_processed/ltemp/bwof_sta1_G0';'F:/data_processed/ltemp/bwof_str1_G0'",
"F:/data_processed/ltemp/tmp_UCras0") # Xiao Fan modified
Error Info:
ERROR 010328: Syntax error at or near symbol ,.
ERROR 010267: Syntax error in parsing grid expression.
Failed to execute (Combine).
Traceback (most recent call last):
File "", line 1562, in execute
File "G:\360Downloads\ArcSDM\Toolbox\arcsdm\logisticregression.py", line
165, in Execute
gp.Combine_sa("'F:/data_processed/ltemp/bwof_gch1_G0';'F:/data_processed/ltemp/bwof_ghy1_G0';'F:/data_processed/ltemp/bwof_int1_G0';'F:/data_processed/ltemp/bwof_sta1_G0';'F:/data_processed/ltemp/bwof_str1_G0'",
"F:/data_processed/ltemp/tmp_UCras0") # Xiao Fan modified
ExecuteError: ERROR 010328: Syntax error at or near symbol ,.
ERROR 010267: Syntax error in parsing grid expression.
Failed to execute (Combine).
Failed to execute (LogisticRegressionTool).
Failed at Wed Jul 04 22:22:06 2018 (Elapsed Time: 13.32 seconds)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#103 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AKV5eeLwIUjT9AqrAaKtv3s-a-pVk4gMks5uDM_WgaJpZM4VAgKM>
.
|
I had a hard time running the logistiregression.py script. The main problems were:
some of these problems have already been reported in this post. Here are the script modifications i need to do:
Running on ArcMap 10.5.1 |
Thank you for your thorough analysis and debugging on this issue! I will
try this out ASAP and hopefully incorporate this fix into next version.
…On Wed, Jul 18, 2018 at 5:42 PM Elias Martins Guerra Prado < ***@***.***> wrote:
I had a hard time running the logistiregression.py script.
The main problems were:
- Arcmap crashes when running AddJoin_management function
- Files are not correctly identified
- Some unecessary lines giving error
- con_sa () function giving error
some of these problems have already been reported in this post.
after a lot of work, I was able to solve the problems and finally run the
script successfully.
Here are the script modifications i need to do:
- added on line 25 the import of spatial analyst functions
from arcpy.sa import *
- modified the lines 94 and 95:
Input_Rasters[i] = s.strip("'"); if
arcsdm.common.testandwarn_filegeodatabase_source(s.strip("'")):
- modified lines 141 to 148 :
Temp_Raster = gp.CreateScratchName('tmp_rst', '', 'rst',
gp.scratchworkspace) gp.copyraster_management(Input_Raster, Temp_Raster)
gp.JoinField_management(Temp_Raster, 'Value', Wts_Table, 'CLASS')
gp.AddMessage('Temp_Raster: %s'%(str(Temp_Raster)))
gp.Lookup_sa(Temp_Raster, "GEN_CLASS", Output_Raster)
- commented the lines 461, 462, 464, 466
strLine = fLR.readline() #vTabUCrows =
workarounds_93.rowgen(gp.SearchCursor(vTabUC)) #vTabUCrow =
vTabUCrows.Next() #ttl = 0 #while vTabUCrow: #for vTabUCrow in vTabUCrows:
ttl += 1
- comment line 582:
#gp.makerasterlayer_management(cmb, cmbrl)
- modified lines 587 to 589:
cmb_cpy = gp.createscratchname("cmb_cpy", '', 'raster',
arcpy.env.scratchFolder) gp.copyraster_management(cmb, cmb_cpy)
gp.JoinField_management(cmb_cpy, 'Value', tbltv, 'ID')
- modified lines 607 to 609:
outcon1 = Con(cmb_cpy, Lookup(cmb_cpy,"LRPOSTPROB"),"0","LRPOSTPROB >
0") outcon1.save(outRaster1) outcon2 =
Con(cmb_cpy,Lookup(cmb_cpy,"LR_STD_DEV"),"0","LR_STD_DEV > 0")
outcon2.save(outRaster2) outcon3 =
Con(cmb_cpy,Lookup(cmb_cpy,"LRTVALUE"),"0","LRTVALUE > 0")
outcon3.save(outRaster3)
Running on ArcMap 10.5.1
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#103 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AKV5eRrLHSGl1bXEnwGscyatI_HsG1G3ks5uH0k3gaJpZM4VAgKM>
.
|
Could you send me the fixed .py file here as attachement? Others could benefit from your valuable work! |
Here is the file, code needs cleaning of some unecessary commented lines. |
Update on this issue: I think I haven't yet merged the code - we had summer holidays and some computer related problems. Will need to check and do when smoke clears. |
Hi, merged these changes - if you have time, please test if it went correctly. |
Hello, |
Can you help me please to solve this problem |
What inputs are you using? |
Executing: LogisticRegression pnt;rh;ocp;lth;frc;exp;elv f;f;f;f;f;f;f pnt_ct;rh_ct;ocp_ct;lth_ct;frc_ct;exp_ct;elv_ct TP -99 1 C:\Data\LR_logpol.dbf C:\Data\LR_Coeff.dbf C:\Data\LR_pprb C:\Data\LR_std C:\Data\LR_conf PYTHON ERRORS: Error Info: Failed script LogisticRegression... Traceback (most recent call last): Failed to execute (LogisticRegression). |
This was the error message. I Have used Arsdm many times before with no problem. and when I bring the old data and run logistic regression with those old data it works.. I wonder if there is any restriction on the study area surface? |
Executing: LogisticRegression pnt;rh;ocp;lth;frc;exp;elv c;c;c;c;c;c;c pnt_ct;rh_ct;ocp_ct;lth_ct;frc_ct;exp_ct;elv_ct TP -99 1 C:\Data\LR_logpol.dbf C:\Data\LR_Coeff.dbf C:\Data\LR_pprb C:\Data\LR_std C:\Data\LR_conf PYTHON ERRORS: Error Info: Failed script LogisticRegression... Traceback (most recent call last): Failed to execute (LogisticRegression). |
Sometimes it gives this 2nd error |
There is no restriction that I know of, but the tools seemed to be picky sometimes. Can you do operations fine on them manually? Unfortunately I have no clue on the cause. Anyone else? |
Hello, try to set workspace and scratch workspace to same folder. |
Load the newest version of ArcSDM (V5.02) and test again. If the problem persists, reopen this issue. |
Caught ExecuteError in logistic regression. Details:
ERROR 010328: Syntax error at or near symbol ,.
ERROR 010267: Syntax error in parsing grid expression.
Failed to execute (Combine).
Traceback
File "G:\360Downloads\ArcSDM\Toolbox\arcsdm\logisticregression.py", line 162, in Execute
gp.Combine_sa(Input_Combine_rasters, thmUC)
Error Info:
ERROR 010328: Syntax error at or near symbol ,.
ERROR 010267: Syntax error in parsing grid expression.
Failed to execute (Combine).
The text was updated successfully, but these errors were encountered: