This course will provide an introduction to the principles of environmental physics and their application to ecological sciences, with a focus on programming and data analysis in Python. Course activities will use data analysis to quantify environmental patterns and processes. Emphasis will be placed developing coding skills in Python and applying these skills to environmental and biophysical problems.
-
To develop expertise in the Python programming language and the use of Python's data science stack to effectively store, manipulate, and gain insight into environmental data.
-
To be able to apply this understanding to characterize data on environmental patterns and processes at varying spatial and temporal scales.
-
To use data to model environmental processes of energy and mass transfer.
Students will learn the principles of Python programming and environmental data science by working largely independently on weekly course materials conducted in Python. Readings will be assigned for both programming and disciplinary content related to weekly themes. At least once a week, we will meet as a group to introduce and discuss concepts. In addition, students will have the opportunity to conduct weekly one-on-one check-ins with the instructional team.
-
Login to the G136 JupyterHub Server.
-
Our server is located at https://g136.lsit.ucsb.edu/
-
Our server is running JupyterLab, which is an interactive environment for executing python code. Here are a couple of tutorials that introduce JupyterLab:
- A Quick Intro (3 minutes)
- A Full Tutorial (25 minutes)
-
-
Clone this repository to your server instance.
-
Open a
Terminalin your JupyterLab instance. (Instructions) -
Type
git cloneand the the url for this repository, which ishttps://github.com/environmental-data-science/envdatasci.git.The entire command will look like this:
jovyan@jupyter-USERNAME:~$ git clone https://github.com/environmental-data-science/envdatasciNote: In the line above, the
jovyan@jupyter-USERNAME:~$is your terminal prompt, where USERNAME is your ucsb id. On other systems, the command prompt is something like>, or$. To keep these directions more general, I will just use$to represent the command prompt throughout our docs. The key point is that you don't need to type this as part of the command. -
Press Enter. A local clone of the class repository will be created in your JupyterLab instance.
$ git clone https://github.com/environmental-data-science/envdatasci > Cloning into envdatasci... > remote: Counting objects: 10, done. > remote: Compressing objects: 100% (8/8), done. > remove: Total 10 (delta 1), reused 10 (delta 1) > Unpacking objects: 100% (10/10), done.You will now have a new local directory in your instance called
envdatasci/, which contains all of the course materials. Before proceeding, we need to make sure that your instance has all the necessary python libraries that the course materials require. We will use a python installation utility called pip to update your instance with the required libraries.
-
-
Use
pipto install required libraries.-
In your open terminal, change directory into the newly-created
envdatascifolder.$ cd envdatasci -
There is a text file called
requirements.txtin this folder. You page through this file using themorecommand.$ more requirements.txt -
The file contains a list of python modules. We will be using these various modules in the course, and so we need to make sure they are installed in your JupyterLab instance. This is easy to do with the
pipcommand:$ pip install -r requirements.txt -
Type the above command and press Enter. You will see a ton of output as the
pipcommand reads each line of therequirements.txtfile, determines what library (and library version) is on each line, and then installs the specific version of that library if is needed. The command also tracks down any dependencies that each new library might require and installs those too.Note: Most of the libraries in
requirements.txtshould already be installed, in which casepipwill report backRequirement already satisfiedfor almost every line.
-
-
Install Conda & Git.
-
Mac OS: Use homebrew
$ brew install anaconda$ brew install git -
Windows: ??
-
Linux: Use homebrew??
-
-
Create a
condaenvironment.$ conda create -n envdatasci python=3.7.3Note: We are using python version 3.7.3 in this class. That may change in the future, but for now it matches the python that LSIT is using in their docker images that they use to build JupyterHub deployments.
-
Activate the
condaenvrionment$ conda activate envdatasci -
Install
pipinto the local conda environment.$ conda install pip -
Clone the repository to your local machine and
cdinto the class repo directory$ git clone https://github.com/environmental-data-science/envdatasci$ cd envdatasci -
Add additional libaries to your conda environment using
pip.$ pip install -r requirements.txtNote: We are using
pipto manage dependencies within this conda environment. The use ofpipand therequirements.txtfile ensures consistency with our insallations on the JupyterHub server. This allows us to make sure that the working environment on our local machines matches exactly the working environment on JupyterHub.Note: If you add a package to your local environment that is used in any of the course materials, you must use
pip freeze > requirements.txtand push the new commit to our repo.