diff --git a/README.md b/README.md index 795aba0..781b242 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Circuitscape Python Script Tool for ESRI Arc Pro +# Circuitscape Python Script Tool for ArcGIS Pro ## Installation and Usage @@ -28,18 +28,12 @@ and run via python using `subprocess.Popen`. ## Bugs and Caveats The limitations of Arc Pro Python script tools as well as Python <-> Julia interprocess communications necessitate -certain limitations. Among these - -1. There is no way to cancel running jobs. - Using the 'cancel' option in a running tool is typically ineffective (Arc Pro only cancels a python script between - lines). To cancel a running process, you will need to exit Arc Pro completely (or kill it in task manager). -1. Errors do not always show as failed runs in Arc Pro. To be sure, click "View Details". -1. The tool does not respect any environment settings in Arc Pro. +certain limitations. See [src/INSTALL.md](src/INSTALL.md) for more information. Please report other issues at https://github.com/jessjaco/circuitscape-arc-pro/issues. ## Acknowledgements -The tool was authored by Jesse Anderson and guided by Kimberly Hall with The Nature Conservancy. Funding for this +The tool was authored by Jesse Anderson as guided by Kimberly Hall with The Nature Conservancy. Funding for this project was provided by The Wilburforce Foundation. diff --git a/src/.gitignore b/src/.gitignore index 3254439..bf5b1b6 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1 +1,3 @@ julia* +config.ini +last_config.ini diff --git a/src/Circuitscape.pyt.xml b/src/Circuitscape.pyt.xml index 1f7cded..3caa50c 100644 --- a/src/Circuitscape.pyt.xml +++ b/src/Circuitscape.pyt.xml @@ -1,2 +1,2 @@ -20231024135206001.0TRUE20231024135206c:\program files\arcgis\pro\Resources\Help\gpCircuitscapeArcToolbox Toolbox +20231024135206001.0TRUE20240124133140c:\program files\arcgis\pro\Resources\Help\gpCircuitscapeArcToolbox Toolbox diff --git a/src/INSTALL.md b/src/INSTALL.md index 65e748c..60e058b 100644 --- a/src/INSTALL.md +++ b/src/INSTALL.md @@ -8,15 +8,38 @@ Navigate to the unzipped location and select "Circuitscape.pyt". ## Usage -The Circuitscape Toolbox shadows the full functionality of Circuitscape in Julia. -Simply parameterize and hit run. A blank black shell window will pop up, which -you can ignore. To monitor while running , select "View Details" at the bottom +The toolbox shadows the full functionality of Circuitscape and Omniscape in Julia. +Simply parameterize and hit run. To monitor while running , select "View Details" at the bottom of the Arc Pro Toolbox window. Please note the first model run will take longer than usual, as the tool is -downloading, installing and testing Circuitscape. +downloading, installing and testing Circuitscape and Omniscape. + +## Circuitscape tips +The parameterization of the output file is a bit clunky. If it's not clear by the help bubble, +you need to specify a new file with an ".out" extension. If using the file browser, navigate +to the folder you wish the place the output, and type a name ending in .out (e.g. "model.out") +and the bottom, then hit OK. + +## Omniscape tips +The output location for Omniscape (the "Project Name" dialog) is a folder. Otherwise it is best +to define it similarly to the Circuitscape instructions above. That is, navigate to a location +and type the name of the (new) folder at the bottom. If you use an existing folder, an +exclamation point will appear in the tool window, but it will still run. + +The JULIA_NUM_THREADS environment variable, which defines the number of parallel threads to use +is represented by the "Number of Threads" parameter under "Calculation Options". Just noting +as this (along with making sure "Parallelize" is checked) can speed up calculations immensely. +(See Omniscape documentation for more info). + ## Known Issues - Sometimes when you add the toolbox in Arc Pro, it doesn't appear. For now the best solution is to exit Arc Pro and try again. + +- There is no way to cancel running jobs. Using the 'cancel' option in a running tool is typically + ineffective (Arc Pro only cancels a python script between lines). To cancel a running process, + you will need to exit Arc Pro completely (or kill it in task manager). +- Errors do not always show as failed runs in Arc Pro. To be sure, click "View Details". +- The tool does not respect any environment settings in Arc Pro. \ No newline at end of file diff --git a/src/last_config.ini b/src/last_config.ini deleted file mode 100644 index df92367..0000000 --- a/src/last_config.ini +++ /dev/null @@ -1,26 +0,0 @@ -project_name = C:\Users\jesse\AppData\Local\Temp\ArcGISProTemp17320\Untitled\Untitled_index -resistance_file = C:\Users\jesse\OneDrive\Desktop\res1000x.asc -radius = 5 -block_size = 1 -resistance_is_conductance = False -source_from_resistance = True -r_cutoff = inf -reclassify_resistance = False -write_reclassified_resistance = False -allow_different_projections = False -buffer = 0.0 -source_threshold = 0.0 -connect_four_neighbors_only = False -mask_nodata = True -parallelize = True -parallel_batch_size = 10.0 -precision = double -solver = cg+amg -calc_normalized_current = False -calc_flow_potential = False -write_raw_currmap = True -write_as_tif = True -conditional = False -n_conditions = 1.0 -comparison1 = within -comparison2 = within diff --git a/src/runner.py b/src/runner.py index 6364e08..192ff51 100644 --- a/src/runner.py +++ b/src/runner.py @@ -10,14 +10,14 @@ def run_circuitscape(config_file: Path, command_args: dict, messages) -> None: - working_dir = Path(__file__).resolve().parent + working_dir = str(Path(__file__).resolve().parent).replace("\\", "/") config_file_fixed = str(config_file).replace("\\", "/") command = f'"using Pkg; Pkg.activate(realpath(\\"{working_dir}\\")); Pkg.instantiate(); using Circuitscape; compute(realpath(\\"{config_file_fixed}\\"))"' return run_julia_command(command, command_args, messages) def run_omniscape(config_file: Path, command_args: dict, messages) -> None: - working_dir = Path(__file__).resolve().parent + working_dir = str(Path(__file__).resolve().parent).replace("\\", "/") config_file_fixed = str(config_file).replace("\\", "/") command = f'"using Pkg; Pkg.activate(realpath(\\"{working_dir}\\")); Pkg.instantiate(); using Omniscape; run_omniscape(realpath(\\"{config_file_fixed}\\"))"'