Spyder IDE Set-up
Spyder IDE Set-up
Using the Spyder IDE requires kernels that allow for interactive or file-based execution of Python code in Spyder. This requires a one-time setup.
1) Open the Anaconda command prompt by typing “Anaconda Prompt" into your search bar and selecting the Anaconda Prompt application which may be labeled 'Anaconda Prompt (anaconda3)', or 'Anaconda Prompt (miniconda3)' if using a Miniconda distribution.
2) Activate the gdal environment by typing activate pygdal_36 and hitting enter. Notice that “base” on the left side of the prompt changes to pygdal_36 as shown below.
3) Type conda install spyder‑kernels=2.1 and hit enter. Type 'y' and then enter when prompted. Once this installs successfully, close the Anaconda Prompt.
Determine the path to your gdal environment, e.g. pygdal_36. This will likely be in the following folder: C:\Users\****\anaconda3\envs\pygdal_36\python.exe.
Note: The **** will be your specific user profile on your computer.
Now open Spyder by going to your search bar on your computer and typing “Spyder”. Select the Spyder App, which may be labeled “Spyder (anaconda3)”.
4) Set the Python interpreter to your gdal python environment.
Go to Tools->Preferences->Python interpreter
Click the button next to “Use the following Python interpreter:”
Type in the path to your gdal environment.
Click OK.
Load the Diversion-Runoff Calculator python code into Spyder.
5) Go to File-->Open and then navigate to your working directory that contains the DRC python code (e.g. DiversionRunoffCalculator.py), select it, then click “Open”.
Now you are ready to run the DRC.