When you’re starting out with remote sensing and Python, one of the first decisions you’ll need to make is choosing the right development environment. While there are many options available, I’ve found that using a good IDE (Integrated Development Environment) makes coding much easier and more efficient.
Why Use an IDE?
An IDE is more than just a text editor. It provides features like code completion, syntax highlighting, debugging tools, and integrated terminals that make writing and testing Python code much smoother. For remote sensing work, where you’re often working with large datasets and complex libraries, these features are invaluable.
Popular Python IDEs
There are several great options for Python development:
- Visual Studio Code – A lightweight, free, and highly customizable editor with excellent Python support
- PyCharm – A full-featured IDE specifically designed for Python, with both free and paid versions
- Jupyter Notebook – Great for interactive data analysis and visualization
- Spyder – Popular in the scientific Python community, comes bundled with Anaconda
My Choice: Visual Studio Code
After trying several options, I settled on Visual Studio Code (VS Code). It strikes the perfect balance between being lightweight and feature-rich. It’s free, works on all operating systems, and has excellent support for Python and Jupyter notebooks.
Here’s why I like VS Code for remote sensing work:
- Fast and responsive, even when working with large files
- Excellent Python extension with IntelliSense and debugging
- Built-in terminal so I can run conda commands without switching windows
- Git integration for version control
- Support for Jupyter notebooks directly in the editor
- Tons of extensions for additional functionality
Setting Up Visual Studio Code for Python
Step 1: Download and Install VS Code
Head to code.visualstudio.com and download the installer for your operating system. The installation is straightforward – just follow the prompts.
Step 2: Install the Python Extension
Once VS Code is installed, you need to add Python support:
- Open VS Code
- Click on the Extensions icon in the left sidebar (or press
Cmd+Shift+Xon Mac,Ctrl+Shift+Xon Windows) - Search for “Python”
- Install the official Python extension by Microsoft
Step 3: Install the Jupyter Extension
For working with Jupyter notebooks, you’ll also need the Jupyter extension:
- In the Extensions sidebar, search for “Jupyter”
- Install the official Jupyter extension by Microsoft
This extension allows you to create and run Jupyter notebooks (.ipynb files) directly in VS Code, which is incredibly useful for exploratory data analysis and visualizing satellite imagery.
Step 4: Select Your Conda Environment for Python Files
After installing the Python extension, you need to tell VS Code which Python interpreter to use. This is where you’ll select the conda environment you created earlier.
- Open a Python file (or create a new one with a
.pyextension) - Click on the Python version in the bottom right corner of the window
- Select your conda environment from the list (it should show something like
Python 3.x.x ('remote_sensing'))
Alternatively, you can press Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows) and type “Python: Select Interpreter” to choose your environment.
Step 5: Select Your Conda Environment for Jupyter Notebooks
Working with Jupyter notebooks in VS Code is one of my favorite features. Here’s how to make sure your notebook uses the correct conda environment:
- Create a new Jupyter notebook by creating a file with a
.ipynbextension, or pressCmd+Shift+Pand select “Create: New Jupyter Notebook” - Look at the top right corner of the notebook – you’ll see a “Select Kernel” button
- Click on “Select Kernel”
- Choose “Python Environments…”
- Select your conda environment from the list (e.g.,
Python 3.x.x ('remote_sensing'))
The kernel selection is important because it determines which Python environment and packages are available when you run cells in your notebook. If you don’t see your conda environment listed, try these steps:
- Make sure your conda environment is activated in the VS Code terminal
- Install
ipykernelin your conda environment by running:conda install ipykernel - Restart VS Code and try selecting the kernel again
Once your kernel is selected, you’ll see the environment name displayed in the top right corner of the notebook. You can click this at any time to switch to a different environment.
Step 6: Install Additional Useful Extensions
Here are some additional extensions I recommend for remote sensing work:
- Python Indent – Helps with proper Python indentation
- autoDocstring – Generates documentation strings automatically
- GitLens – Enhanced Git integration
Step 7: Configure Your Terminal
Make sure VS Code uses your conda environment in the integrated terminal. Open the terminal in VS Code (Ctrl+` or Cmd+`) and verify that your conda environment is activated. You should see the environment name in parentheses at the beginning of your terminal prompt.
If it’s not activated by default, you can add this to your VS Code settings:
{
"python.terminal.activateEnvironment": true
}
Testing Your Setup
Let’s make sure everything is working correctly. Create a new file called test_setup.py and add this code:
import numpy as np
import rasterio
import geopandas as gpd
print("NumPy version:", np.__version__)
print("Rasterio version:", rasterio.__version__)
print("GeoPandas version:", gpd.__version__)
print("\nSetup successful! You're ready to start working with remote sensing data.")
Run this file by clicking the play button in the top right corner or by pressing Cmd+Shift+P and selecting “Python: Run Python File in Terminal”. If you see the version numbers printed without errors, your setup is complete!
Testing Jupyter Notebooks
You should also test that your Jupyter notebook setup is working:
- Create a new Jupyter notebook (
.ipynbfile) - Make sure your conda environment is selected as the kernel (check the top right corner)
- In the first cell, type the same test code from above
- Run the cell by clicking the play button next to the cell or pressing
Shift+Enter
If everything is set up correctly, you’ll see the version numbers output below the cell. Jupyter notebooks are great for remote sensing work because you can mix code, visualizations, and markdown notes all in one document.
Next Steps
Now that you have your IDE set up for both Python scripts and Jupyter notebooks, you’re ready to start working with remote sensing data. In future posts, I’ll walk through loading satellite imagery, performing basic image analysis, and creating visualizations.
VS Code has a bit of a learning curve, but once you get comfortable with it, you’ll wonder how you ever worked without it. Take some time to explore the features, customize your settings, and learn the keyboard shortcuts – it’ll pay off in the long run!