Python setup
Here we provide instructions for one approach to creating a new python environment for automating WindFarmer using the SDK. It is also possible to use the SDK in other languages (e.g. .NET) but we have focussed on providing examples in Python.
Install Miniconda Python
Our demonstrations are built on top of miniconda. This is a minimal, free distribution of python: Install for Windows from: https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe
Setup your python IDE: Visual studio code
Feel free to use the IDE of your choice, we have used Visual studio Code in our examples.
Install VS Code for free from: https://code.visualstudio.com/
Next, install the Python extension for VS Code from the Visual Studio Marketplace. The Python extension is named "Python" and it's published by Microsoft.
You may also wish to install the "Jupyter" extension to allow you to work with Jupyter notebooks.
Create the WindFarmer automation python environment
We will use a conda environment to ensure that you have all the necessary dependencies to run examples in the WindFarmer automation examples repository.
- Open "Anaconda prompt (Miniconda 3)" from the start menu.
- Type
cd "C:\Repos\WindFarmer-automation-examples\Source"
and hit return. Change the path to match where you cloned the repository. - Now we are in the source folder, create the conda environement defined in the
environment.yml
file with the following command:conda env create -f environment.yml
- Several packages should be installed
- You should now be able to activate the new conda environment
conda activate wf_auto
Choose the Python environment
In VS code use Ctrl+Shift+P to open the Command Pallete they type "Python: Select Interpreter". Select wf_auto to activate it for demos.
For Jupyter notebooks you may be asked what environment to use first time you run, or you can select in the top right of the interpreter.
For python scripts, the environment is shown bottom right of the UI.
Set a default python environment
If you'd like to set up a default interpreter in VS code to use at start-up, you can edit the entry for python.defaultInterpreterPath
manually inside your User Settings. To do so, open the Command Palette (Ctrl+Shift+P) and enter Preferences: Open User Settings. Find then set python.defaultInterpreterPath to the location of your preferred interpreter.