You’ve been lucky enough to get a shiny, new install of ArcGIS Pro. After spending some time getting used to the new user interface, it’s time to start looking at the various processes you undertake on a regular basis in ArcMap. What are the impacts of migrating your workflow to ArcGIS Pro?
I’m sure I left that tool around here somewhere
Most tools which were available in ArcMap are also available in ArcGIS Pro. There are some that have not (yet?) been migrated to ArcGIS Pro. Check Esri’s documentation for a full list of ArcMap tools not available in ArcGIS Pro. Some of these missing tools may be a work in progress, which will appear in future ArcGIS Pro releases. There are some tools which have likely been retired for good.
Old models, new models
Just like ArcMap, you can build and use models in ArcGIS Pro. It’s recommended to make a copy of your existing models when bringing them into ArcGIS Pro. The simplest way is to make a copy of the toolbox. This can then only be used in ArcGIS Pro as models created/edited/renamed in ArcGIS Pro are not backward compatible with ArcMap – i.e., once you change a model in a toolbox in Pro, none of the models in that toolbox will be accessible in ArcMap.
It is possible to port models back to ArcGIS Desktop using ‘Save As’ to a specific version (for example, 10.4). Of course, if the model uses tools which are only available in ArcGIS Pro, they are unlikely to work in ArcGIS Desktop.
Do you feel lucky? Well do you, script?
Well, you will need to be lucky, or at least forward thinking, for your existing Python scripts to work first time in ArcGIS Pro. This is because ArcGIS Pro makes the long-awaited jump from Python 2.7 to Python 3. There are some fundamental changes when moving from 2.7 to 3. The one which may be most common is regarding the print statement becoming the print function. This means any message to be printed needs to be in parenthesis, as shown below. More detail on changes between Python 2.x and 3.x can be found in the Python website documentation.
Analyze to the rescue!
Fear not – help is at hand. The good folk at Esri have included a tool which can check your existing toolboxes/models/script for ArcGIS Pro compatibility. The tool in question is Analyze Tools for Pro. This can be found in the ArcGIS Pro Toolbox under Data Management Tools > General. Simply run this tool against your toolbox (the Pro copy!). This will output a text report identifying issues with your scripts. There is an inevitable “but” in this process. It is considered to catch around 95% of Python 2.x to 3.x migration issues – so, while it should catch most issues, some may yet remain.
When the Analyze Tools for Pro detects an issue with a Python script in a toolbox, it will display a warning, like the one seen here. This is also written to a log file. The result will give the following information on the issue:
• Line number
• Code with issue
• Suggested fix
The line report will look as follows:
Line 1: old python 2 code -> new python 3 code suggestion
It should be noted, the suggested code fix may not always have the most elegant syntax, but it should work!
In a similar manner, a model which has tools that no longer exist, will display something along these lines:
An important point when checking your scripts. Discontinued tools which are written into a Python script are not detected by the Analyze Tools for Pro tool. For this reason, it’s important to check through the Esri page listing those tools are not available – this will help you to have a good understanding of potential impacts on your scripts.
As far as the effort involved in migrating your workflows, the more complex the processes, the more work will likely be involved. The Analyze Tools for Pro will help eliminate some of the pain of migration. While ArcMap will still be around for some time, it is important to at least be prepared for the jump to ArcGIS Pro. Even if you are sticking to ArcMap for now, you can still adjust your current Python writing to make the move to Python 3.x easier.
Do simple things like wrapping your print statements in parenthesis. Also, investigate the later version of the module. It lets you bring some functionality from 3.x back to 2.x.
While it is true that ArcGIS Pro is demanding in terms of computing power, there are many advantages to making the move. It has Conda integrated. This allows you much more control over your Python environments. Yes, you can have multiple Python environments and switch between them from within ArcGIS Pro. The new ArcGIS API for Python requires Python 3.5. If you use ArcGIS Online or ArcGIS Portal, this API will grant you massive time savings!
If you take away one thing from this blog, let it be the importance performing the migration process on a separate copy of your toolboxes. Backup, backup, backup! Finally, if you need help migrating your workflows, check out our new ArcGIS Pro services – we’d be happy to lend a hand.
Posted by Ben Holmes, GIS Consultant, Exprodat.
Those Useful Links Again
• Tools that are not available in ArcGIS Pro – http://pro.arcgis.com/en/pro-app/tool-reference/appendices/unavailable-tools.htm
• What’s New In Python 3.0 – https://docs.python.org/3/whatsnew/3.0.html