I am working on the Predict Seagrass habitats with machine learning module by esri, I am working in ArcPro, when I get to the python code its gives me this error. 

1704
11
Jump to solution
11-02-2018 09:57 AM
OliviaSwientisky1
New Contributor

I am working on the Predict Seagrass habitats with machine learning module by esri, I am working in ArcPro, when I am coding in python to bring the ArcGIS feature classes in python as an array its gives me this error. 

from sklearn.ensemble import RandomForestClassifier
import numpy as NUM
import arcpy as ARCPY
import arcpy.da as DA
import pandas as PD
import seaborn as SEA
import matplotlib.pyplot as PLOT
import arcgisscripting as ARC
import SSUtilities as UTILS
import os as OS
inputFC = r'USA_Train'
globalFC = r'EMU_Global_90m_Filled'
predictVars = ['DISSO2', 'NITRATE', 'PHOSPHATE', 'SALINITY', 'SILICATE', 'SRTM30', 'TEMP']
classVar = ['PRESENT']
allVars = predictVars + classVar
trainFC = DA.FeatureClassToNumPyArray(inputFC, ["SHAPE@XY"] + allVars)
spatRef = ARCPY.Describe(inputFC).spatialReference
Traceback (most recent call last):
File "<string>", line 1, in <module>
RuntimeError: The table was not found. [VAT_temp]
trainFC = ARCPY.da.FeatureClassToNumPyArray(inputFC, ["SHAPE@XY"] + allVars)
Traceback (most recent call last):
File "<string>", line 1, in <module>
RuntimeError: The table was not found. [VAT_temp]

0 Kudos
1 Solution

Accepted Solutions
KathyCappelli
Esri Contributor

I was able to reproduce the issue, and the first, most simple fix is to make sure that the dissO2 attribute is correct- the reason the script was returning that same error for me was that I had named the field diss02 (with a zero instead of a capital letter O). Because the script calls dissO2, the field wasn't found. 

If this doesn't solve your issue, please let me know and I'll keep working on it

View solution in original post

11 Replies
DanPatterson_Retired
MVP Emeritus

inputFC = r'USA_Train'

perhaps you need to specify the whole path to the geodatabase and/or folder since there is no 'workspace' set in the script, so it probably can't find it 

DanPatterson_Retired
MVP Emeritus

found your 'bug' it was in the instructions from the previous lesson

Create a training dataset—Predict Seagrass Habitats with Machine Learning | ArcGIS 

Note:

It is important to save the file to your Documents folder because you'll need to use the exact file path in the Python script. If the file doesn't have the right path, the script will fail.

OliviaSwientisky1
New Contributor

I have done that step and I am still receiving this error

0 Kudos
DanPatterson_Retired
MVP Emeritus

Olivia, if it isn't that bug... tech support, so they can check with the people that wrote the module to see if there is something else at issue with it, or some other environment parameter that is causing yours to fail

0 Kudos
KathyCappelli
Esri Contributor

Hi Olivia, I'm responsible for this tutorial at Esri. We're currently looking into this issue, and will get back to you asap with a solution. Thanks for your interest in Learn ArcGIS!

DanPatterson_Retired
MVP Emeritus

Thank you for leaping in!

0 Kudos
David_Kobbevik
New Contributor

Have you found any solution to this issue?

0 Kudos
KathyCappelli
Esri Contributor

I was able to reproduce the issue, and the first, most simple fix is to make sure that the dissO2 attribute is correct- the reason the script was returning that same error for me was that I had named the field diss02 (with a zero instead of a capital letter O). Because the script calls dissO2, the field wasn't found. 

If this doesn't solve your issue, please let me know and I'll keep working on it

David_Kobbevik
New Contributor

Thank you, that solved my problem 🙂

0 Kudos