jeffreyevans / GradientMetrics

ArcGIS Geomorphometry & Gradient Metrics toolbox
GNU General Public License v3.0
20 stars 10 forks source link

Pro compatiblity #1

Closed scw closed 6 years ago

scw commented 6 years ago

This PR adds compatibility with Python 3 and ArcGIS Pro. mostly very minor changes, just tweaks to how Python 3 handles certain kinds of input. The TBX has been updated, but this was performed in ArcMap, and the resulting binary should retain its original compatibility. Most of the files were just updated to get tabs -> spaces more consistent, which Python 3 is more picky about.

I've also done another pass on the Sobel script, it looked like it was missing a few things to work in the current version. I've confirmed that it computes, but not that the results are what are expected, so that should be confirmed prior to merging this.

One behavior change is that 3 / 2will now produce 1.5, that is it will automatically convert to float and produce the result, and not perform floor calculations by default. I looked over the existing uses of /, and I think they all (or almost all) expect at least one float input, so it should continue working as before, but this may need further confirmation.

I also made some small tweaks to let this code run when there isn't a defined spatial reference (e.g. with a blank map, within ArcCatalog, or when executing from Python directly).

This version works fine in both Python 2.7 (e.g. 10.x) and Python 3 (e.g. Pro).