Python
RiskScape allows user defined Python code to be used for risk modelling. This allows RiskScape to be extended by scientists/risk modellers without needing software developers.
Note
To use packages like numpy
or scipy
in your Python function, you need
to configure RiskScape to use CPython.
There are two ways to use Python with RiskScape: Python functions, and the
python()
pipeline step. Python functions are simpler - you can use them the
same way you use built-in RiskScape Functions, as part of a RiskScape
expression. They process your data one row at a time, for
example, a Python loss function would typically be called repeatedly, once for
each building in your dataset.
The python()
step is more complex, and processes your entire dataset at once.
A Python step passes all your results to Python in one go.
This can be useful for post-processing, such as plotting the results as a graph,
or for network models, where damage to one asset can affect other assets.
If you’re not sure which approach you need, we recommend starting with a
Python function. The python()
step is only needed
for more advanced risk modelling.