pycon logo

PyCon 2011 Atlanta

March 9th–17th

Log in or Sign Up

Agile Business Forecasting and Decision Support Using CPython/C#/IronPython/ArcGIS

log in to bookmark this presentaton

Experienced / Poster
Sustainability and logistics are a deeply interconnected issue in business. Setting goals, monitoring progress and planning for the future are all dependent upon a myriad of factors, ranging from unit production to environmental and economic conditions. This poster demonstrates an agile approach to forecasting and modeling in support of strategic sustainability planning using Python.

Abstract

Arizona Public Service Company created a Water Resource Planning department to support the development and maintenance of a long-term water resource portfolio that provides both a secure supply of water and is environmentally responsible. Water use is a key illustration of the challenge of sustainability - how does a corporation effectively and responsibly use a limited resource when purely economic considerations drown out the issue?

We chose to focus on the interactively forecasting water usage and supply against various visions of the future and operational/logistic considerations.

Part of the challenge is that a lot of flexibility is required for this approach. There's no single way to model all of the relationships between variables (linear,polynomial,etc...) that would work in all circumstances. Further, part of the value is the ability to react to new circumstances quickly. Using Python to implement the modeling algorithms, and an XML data model, we were able to give analytical users complete freedom to use Python in any way they want to solve a problem, but provide enough stability to develop a GUI modeling application that would not be subject to agile development (a corporate requirement).

Analyitical users create small, algorithm "snippets" that relate one or more input variables to one or more output variables (using an easy library interface) that are stored with the modeling data in the database. These snippets, and the supporting data, may be developed ad hoc using any of Python's libraries or approaches and implemented in a simple, pure-Python snippet. This snippet may be used by the Python Analyst toolset to perform forecasts for specific models or composed into larger scenarios.

When a base scenario, or set of models and input data, is developed, it is stored to the database for interactive use in the Simulation Modeler GUI. This GUI is developed in C#.NET to meet corporate IT governance requirements, and followed a very traditional waterfall project approach. The GUI uses IronPython to natively execute the code snippets in an interactive fashion. Users may edit the Python code using an in-application editor, then dynamically save and re-run a single component or the entire scenario. Modeling data may be visualized in the chart GUI in 2 or 3 dimensional, configurable charts. If users make modifications, a new XML scenario is saved, referencing the parent scenario for all but the changed data.

Finally, modeling outputs are used as input to natural resource models. Some exist purely in Python and are executed in the workflow described above. Others, however, use GIS analytical tools to produce GIS visualization output. The particular example is groundwater modeling, where the forecast water consumption is used as an input for USGS MODFLOW, and the resulting groundwater flow information is transformed to raster format for visualization using the ArcGIS suite. All of this work is accomplished via CPython tools implemented using the ArcGIS arcpy site package.