This course teaches the fundamentals of programming in Python. Students will learn foundational skills and concepts including data structures, programming basics, and how to clean, subset, aggregate, transform and visualize data. Course materials demonstrate the application of these techniques for environmental data analysis and problem solving.
-
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.
Students will learn the principles of Python programming and environmental data science by working largely independently on daily course materials conducted in Python. Supplemental readings will be assigned for both programming and disciplinary content related to weekly themes.
-
Login to the EDS 217 JupyterHub Server.
-
The class server is located at https://taylor.bren.ucsb.edu/. You must be on campus or connected to the campus VPN to access this site.
-
Our server is running RStudio, which includes an installation of JupyterLab. JupyterLab 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)
-
-
Fork this repository to create a local copy in your github account. Do this by clicking the "Fork" button in the upper right corner of the repository home page.
-
Login to the class server using your Bren user ID.
Note: You will need to be on campus or connected to UCSB's VPN to access the server.
-
Once you have logged into RStudio, start a new session by clicking the
+New Session
button at the to of the browser window. -
In the dialog box that pops up, create a session name (recommended:
EDS 217
), and selectJupyterLab
as theEditor
. TheCluster
option should be left asLocal
(the default) -
Wait a moment for the JupyterLab instance to get initialized.
-
Clone the forked repository to your server instance.
-
Open a
Terminal
in your JupyterLab instance. (Instructions) -
Type
git clone
and the the url for your forked copy of this repository, which ishttps://github.com/<your username>/eds-217
, where is your github user id.The entire command will look like this:
$ git clone https://github.com/<your username>/eds-217
Note: In the line above, the
$
is your terminal prompt. On other systems, the command prompt is something like>
, or[username]$
. 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/<your username>/eds-217 > Cloning into eds-217... > 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
eds-217/
, 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.
-
-
Use the file browser in JupyterLab to open the
eds-217/
directory. -
Double-click the
test_environment.ipynb
file. This will open the file into a Jupyter notebook editing environment. -
Follow the instructions in the notebook to execute the cells and confirm that your installation is working correctly. If all goes well, you will get a message saying
You're all set!
, and some detailed information on the various packages installed ontaylor.bren.ucsb.edu
. Now you're ready to learn some python! Theindex.ipynb
notebook in theexercises
folder is a good place to start to navigate to exercises according to the course outline.
-
Install Conda & Git.
-
Mac OS: Use homebrew
$ brew install anaconda
$ brew install git
-
Windows: ??
-
Linux: Use homebrew??
-
-
Clone the repository to your local machine and
cd
into the class repo directory$ git clone https://github.com/environmental-data-science/eds-217
$ cd eds-217
-
Create a
conda
environment using theenvironment.yml
file included in the repository.$ conda env create --file environment.yml
Note: We are using python version 3.10.5 in this class. That may change in the future, but for now it matches the python that
taylor.bren.ucsb.edu
is using in RStudio's version of JupyterHub. -
Activate the
conda
envrionment$ conda activate eds-217
-
Install
pip
into the local conda environment.$ conda install pip
-
Add additional libaries to your conda environment using
pip
.$ pip install -r requirements.txt
Note: We are using
pip
to manage dependencies within this conda environment. The use ofpip
and therequirements.txt
file 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.txt
and push the new commit to our repo.Update