This example provides not only C/C++ source code, but also ready-to-use 32- and 64-bit binaries for GSPy, a GoldSim/Python interface that enables you to define external functions in pure Python that can be called by GoldSim during a simulation. As the binaries can be used with minimal setup, the source code is included primarily for reference, if you are interested to see how the interface is implemented.
The following steps are recommended to get started:
1) Install the 32- or 64-bit Python 3.6 Anaconda distribution here: https://www.anaconda.com/download/. A significant advantage of installing the Anaconda distribution is that it comes already with several widely-used Python libraries such as NumPy, Pandas and SciPy. One of the examples that comes with GSPy uses NumPy to do matrix arithmetic.
2) Download and unzip GSPy.zip and follow the setup and testing instructions in the README.txt file. Binaries include GSPy.pyd and TestGSPy.exe (32- and 64-bit versions). The README provides simple instructions for setting an environment variable (GSPY) with the path to your Python installation and running TestGSPy.exe from a command line console to confirm that everything is set up correctly.
3) After you have confirmed that the GSPy environment is set up correctly, be sure to go through the three GoldSim model examples included in the zip file: GSPyScalarAddition.gsm, GSPyMatrixAddition.gsm and GSPySnowmelt.gsm. It is strongly recommended that you read through the detailed comments in the corresponding pure Python module files: GSPyModule_ScalarAddition.py, GSPyModule_MatrixAddition.py and GSPyModule_Snowmelt.py (note, as described in the README, you must change the name of the Python file to GSPyModule.py before running the example).
Have fun and please send us questions and feedback at firstname.lastname@example.org. Or better yet, come to our forum and post about it there where everyone can see it. We see great potential in combining the Monte Carlo simulation capabilities of GoldSim with the extensive well-supported and powerful scientific computing Python libraries that are freely available. The more chatter about this the better. So far, the topic has popped up in a couple places (here and here).
The following results were generated by GSPySnowmelt.gsm, which calls a pure Python implementation of the snow-17 snow accumulation and ablation model (Anderson, E. A. (1973), National Weather Service River Forecast System Snow Accumulation and Ablation Model, NOAA Tech. Memo. NWS HYDro-17, 217 pp., U.S. Dep. of Commer., Silver Spring, Md.).
Download the Model File: