1

According to Esri:

There are four levels of environment settings: application, tool, model, and model process.

https://pro.arcgis.com/en/pro-app/latest/tool-reference/environment-settings/what-is-a-geoprocessing-environment.htm

Is there a way and if so how can I evaluate the environment level within a Python toolbox? I would like to find out if the tool is run outside of a model or model process, i.e. if the tool is run as an individual tool.

1 Answer 1

1

"environment" here is gp environment like outputCoordinateSystem or cellSize. As stated the application has a set of gp environments, as does a gp tool, as does a model or script, model process. These have clear hierarchy, the "parent" passes it's environment values to the "child" (as a default set of environments), the "child" can modify it's environments settings, but they those changes do not affect the "parent".

When it comes to execution time, that hierarchy doesn't matter, the execution logic will receive 1 set of parameters and 1 set of gpenvironment values.

This is an intentional design decision of the gp framework. It should not matter to the tool which context (tool dialog in app, script, model, service) it is being run in, the tool should perform it's operation based on the set of input parameters + environment settings it receives.

Sounds like there's something specific you're trying to achieve, maybe post that in a comment.

2
  • Thank you for this valuable insight which answers my question perfectly! Yes, I was hoping to achieve something specific. I was looking for a workaround for this question: gis.stackexchange.com/questions/416238/…. The idea (for the workaround) would have been to not set the derived output parameter value if the tool was run outside of a model.
    – Thomas
    Commented Nov 13, 2021 at 4:27
  • gotcha, yeah the framework comes with behaviors, one of them is that upon completion of tool execution the out parameter's values are added to the active map. as per other question if you remove that output parameter it will not get added to the map, but you'll lose other behaviors (user choosing output name & path, chaining in mb, etc...)
    – gotchula
    Commented Nov 15, 2021 at 17:41

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.