3

I have just come across the WRF Hydro GIS Pre-Processing Tools for the first time. The version I am looking at is 2.2 and its documentation says:

The processing workflow for creating WRF-Hydro routing grids is available to users as an ArcGIS Python Toolbox. Python toolboxes were implemented in ArcGIS Desktop version 10.1 as a way to create custom geoprocessing tools directly from Python scripts.

Unfortunately, the people wanting to use these tools only have access to ArcGIS Desktop 10.0 which means that they will not "just work" because Python toolboxes did not exist until 10.1.

I am considering trying to downgrade the tools to 10.0 by creating a standard toolbox of Python script tools that calls the same functions that the tools in the Python toolbox do.

Before doing that I am wondering if anyone knows the history of these tools, to be able to tell me whether there was an earlier version of them that were designed to use with ArcGIS Desktop 10.0? If so, I may be able to try and source that version instead but my Google searches so far have been unsuccessful in finding such a version.

If I need to proceed with the creation of an equivalent standard toolbox for 10.0 then I plan to check that no critical tools/parameters that they use were added at 10.1 and keep my fingers crossed that I have not missed any gotchas.

2
  • If you do end up using the 10.1 version, you can import it as a Python module (toolbox = imp.load_source('toolbox', '/path/to/python_toolbox.pyt')), which means you could just setup a wrapper script that sets up the Parameter objects and passes them to the tool, rather than trying to re-write the existing code (assuming nothing else from 10.1 is missing). Then you can just swap out the .pyt if there's an update Commented Sep 1, 2015 at 11:03
  • @EvilGenius That's a good idea, which I think I follow. However, in this case "The toolbox is split into two Python scripts. The ‘GEOGRID_STANDALONE.pyt’ script is the python toolbox that contains code that ArcGIS uses to handle and validate parameters. This tool calls functions in the ‘wrf_hydro_functions.py’ script.". My plan would be to not touch wrf_hydro_functions.py and to simply handle and validate parameters using Python script tools instead of the Python Toolbox (GEOGRID_STANDALONE.pyt).
    – PolyGeo
    Commented Sep 1, 2015 at 21:52

1 Answer 1

1
+100

This is a comment rather that an answer. Due to its length, I post it as an answer.

In their website, it says "for use with ArcGIS v10.2 and higher", so there maybe some obstacles in the way of downgrading (dependencies on new tools).

There are 2 options:

  1. First is suggested by @EvilGenius in the comments. This approach has the benefit of using the latest version of "WRF Hydro GIS Pre-Processing" without doing any further work. So if a new version of the toolbox releases then you have to just replace the old pyt and py file.

  2. Instead of sourcing the original python toolbox, creating python script tools from scratch and copy and paste from pyt toolbox. If there exists any dependency on a newer arcgis feature, then you have to opt this choice and edit the python script source.

Either way, you have to create a standard toolbox with python script tools and You should take care of parameters and validation in the toolbox (tbx). and you don't have to touch "wrf_hydro_functions.py", just import the module.

There is a tbx to pyt translater on GitHub. But unfortunatelly one doesn't exist for the reverse for backward compatibility. e.g. pyt to tbx translator.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.