arcpy.Contour_3d does not generate contours for decimated values ArcPro 2.6.2

414
8
11-05-2020 01:36 PM
Darius
by
New Contributor II

Hi, I have a problem with generating contours for decimal values eg. 0.1, 0.5 when using arcpy.Contour_3d in ArcPro 2.6.2. I have a larger script which is generating these contours and loading it to the particular feature class in geodatabase. After troubleshooting it appears that the arcpy.Contour_3d method is failing every time when suing decimal values. At the end created simple script embedded in toolbox, the script is:

C:\Temp\Bathy_Contours\Contour_Testing\Testscript_edited.PY

import arcpy
arcpy.CheckInExtension("3D")
arcpy.Contour_3d(r"C:\Temp\Bathy_Contours\Contour_Testing\SSDM2_FNAS_v1_ED50Z31.gdb\P133982_EQ20321_4m3i5s", r"C:\Temp\Bathy_Contours\Contour_Testing\SSDM2_FNAS_v1_ED50Z31.gdb\Contour_2128_DZ", 0.5)

For testing purposes the tool is simple and don't have any parameters

After running the script

I tried as well with ArcGIS Pro 2.5, changing the windows regional settings for comma or dot, changing language settings, changing settings in ArcPro, changing script extension from .py to .PY, setting up new ArcPro project from scratch, configuring new toolbox & new script, working with different input bathymetry rasters, different geodatabases, different disk/network locations, different pc's  and even replacing the

C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\ddd.py file, but nothing helped.

If you runned on the same problem or have any tips, please advice. Thank you!

0 Kudos
8 Replies
DavidPike
MVP Frequent Contributor

Have you always used a file geodatabase raster as input? exporting a subset as a TIFF and using that as input/output might narrow down some potential issues, as you mentioned you may have regional (,) encoding of decimals.

0 Kudos
Darius
by
New Contributor II

Hi David, thanks for prompt advice! I always used file geodatabase for this calculations. Anyway I gave a shot and tested with exporting input raster to TIFF but looks like the issue is the same.

Here is just with input as TIFF

And here is with input and output as TIF

0 Kudos
DavidPike
MVP Frequent Contributor

That's a strange one.  I previously said output as tif also - when obviously the output is a vector (duh) so ignore that please.

The input for countour interval has an error recorded against it when input is double, of which 0.5 is a member so that's weird Maybe try an integer just to see if the documentation is wrong?

the Input for the tool is identified as raster layer also - maybe try 

MakeRasterLayer(in_raster, out_rasterlayer, {where_clause}, {envelope}, {band_index})

but why the error doesn't jump to that I'm not sure

0 Kudos
Darius
by
New Contributor II

Hi again, it is working fine with integer numbers and producing output.

However it is working fine when running the same commands directly from python window in ArcPro! The result is fine and output is generated

So there must be some bug when creating toolbox or adding the script to the toolbox. My steps to create a toolbox are as following:

0 Kudos
DavidPike
MVP Frequent Contributor

It would be referencing a raster layer in the Pro window right?

0 Kudos
Darius
by
New Contributor II

Yes, it is correct, taking as input the raster which is added to Contents window in ArcPro as well visible in the Map window.

0 Kudos
Darius
by
New Contributor II

Thank you David for all your tips! It looks like complete deinstallation and installing ArcPro from scratch solved the problem!

We will probably never find the solution for that problem, looks like something was corrupted / bug or other thing. Strange that it happened at the the other pc. That could as well related to some windows updates or other software which messed up settings / environments or python related stuff.

Thanks again, this is really great place to share things!

Do I need to somehow mark that issues as closed / solved here?

0 Kudos
DavidPike
MVP Frequent Contributor

One of life's mysteries I think .  You can mark your own answer as correct I believe, or also mark your original question as 'assumed answered'.