- Install git for Windows
- Install Miniconda
- Install VSCode
- (Optional) Install Windows Terminal for a nicer command line experience in Windows
Open the following link in a web browser: https://github.com/felio92/python-workshop
Copy the HTTPS link to clone the repository to your machine:
Open a terminal (e.g. Windows Terminal or Git Bash or Anaconda Prompt)
Change into the directory where you would like to clone this repository (using the cd C:\...\your-directory command within the terminal)
Clone the github repository to your local machine:
git clone https://github.com/felio92/python-workshop.git
If the cloning was successful, the output in the terminal should look something like:
In another terminal (e.g. Windows Terminal or Anaconda Prompt), create a new conda environment using the following command (confirm by typing 'Y' when prompted):
conda create -n python-workshop -c conda-forge python=3.9 jupyter matplotlib seaborn numpy scipy pandas geopandas cartopy
The command above will create a conda environment with the name "python-workshop", using the channel "conda-forge" to look up the list of packages:
Python=3.9Install the latest Python 3 version inside the environment.JupyterEngine to run web-based Jupyter notebooksMatplotlibPlotting library to create static and dynamic plotsSeabornData visualization library based on matplotlib, but adds some extra functionality, especially useful for creating statistical graphics.NumPyA library that adds support for large, multi-dimensional arrays to Python. A dependency for many scientific computing Python libraries.SciPyA widely used library for scientific computing. Contains modules for interpolation, linear alebra, signal and image processing, among many others.pandasA library for data analysis and manipulation. Offers data structures and operations, such as dataframes, for manipulating numerical tables and time series.geopandasA library based on pandas that extends its datatypes to make working with geospatial data easier, by allowing spatial operations on geometric types.
Install mamba which allows for a much smoother experience when installing python packages via conda on an ad-hoc basis, which we will do in the next step for a number of packages.
conda install -n base conda-forge::mamba
Lets activate the environment that we just created:
conda activate python-workshop
Let us now install a number of packages using the just installed mamba utility:
mamba install -c conda-forge -c pytorch earthengine-api geemap xarray xesmf cartopy pytorch torchvision
earthengine-apiA Python API to Google's proprietary Planetary-scale geospatial analysis engine.geemapA Python package for interactive geospatial analysis and visualization with Google Earth Engine.xarrayA library that offers data types and operations to make working with multi-dimension, labelled data, such as climate data, easier.xesmfA library that can be used to regrid xarray arrays / datasets in a number of ways.cartopyA library to easily create maps and other geospatial data analyses.PyTorchA machine learning library for Python based on Tensors.torchvisionA library that adds a number of classes and datatypes to use / transform images for use in PyTorch.
Further reading:
- Python Resource for Earth Sciences
- Earth Engine Python Notebook Examples
- A curated list of GEE resources (includes section for the GEE API for Python)
Open Visual Studio Code and open the workshop directory, where you previously cloned this repository to:
After navigating to the project directory and opening it, the resulting window should look something like this:
Visual Studio Code is a general purpose code editor. We'll want to install some Python-specific extensions to make working with Python within VS Code easier. To install the extensions, click (shortcut Ctrl+Shift+X) the extensions icon on the toolbar on the left:
We'll want to search and install the following extensions:
ms-python.pythonPython extension for Visual Studio Codems-toolsai.jupyterAdds support for jupyter notebooks within VS Code
Open the 01_getting_started.ipynb notebook in VS Code, which is found in the notebooks directory. You should be prompted to select a Python Environment:
Select the python-workshop environment, where we have installed all packages that we'll be using in this workshop.