Hello,
i have a script for ArcGIS Pro (2.4.3) which essentially does this:
1. arcpy.env.workspace = "in_memory"
2. arcpy.CopyFeatures_management("fc", "copy")
3. Stuff with copy
4. arcpy.Contour_3d("dem", "contour_lines", 10)
5. More Stuff with copy
While the stuff in before Contour_3d works fine, the code after throws an exception, that "copy" doesn't exist.
After some testing, it seems, that contour_3d makes arcpy somehow 'forget' where to look for fc. I used Describe to find out, what was going on, and couldn't find any of the fc that where used and created during run anymore, including the just created "contour_lines".
What I noticed was, that doing anything not fc-related with the workspace fixed the issue.
arcpy.AddMessage(arcpy.env.workspace)
arcpy.AddMessage(arcpy.ListFeatureClasses())
arcpy.env.workspace = "in_memory"
All of those made the rest of the script work like a charm.
Another interesting Issue I noticed while searching for the error, is the interaction between Contour_3d and the new memory-workspace.
The reason I used the old in_memory-workspace was, that I created the dem with arcpy.MakeImageServerLayer_management() (which doesn't work with the new memory-workspace).
So, thinking the problem might lie within in_memory, I replaced in_memory with memory and used some pre-created dem instead.
So, strangly enough, the first error I got was:
ERROR 000880: Output feature class: 's extension is empty for the output feature class.
And I had to fix ".shp" to the name of the fc ("contour_lines.shp"), which surprised me, since I can't usually create fc with Extension in the memory-workspace.
Just to be sure I tried some other functions, all of which threw the expected Error:
ERROR 000354: The name contains invalid characters
Next strange thing is, running the tool a second time got me this Error:
ERROR 000287: Fail to create output feature class.
Apparently Contour_3d can't overwrite it's output. (why does the memory result even persist between script runs?)
Oh. and the first Problem wasn't fixed by changing to the new version neither.
So what is going on with Contour_3d, it seems like some serious Bugs to me, or am I doing something completly wrong?
Cheers