EDS 221: Scientific programming essentials

Programming essentials for environmental data science

Honeycomb hex patterns. Photo by Shilo Labelle on Unsplash.

Instructor

Allison Horst (ahorst@ucsb.edu)

Course description

In EDS 221, students will build key scientific programming skills essential for environmental data analysis and problem solving. Topics include structured programming and algorithm development, iteration, conditionals, functions and objects, documentation, testing and troubleshooting, tidy data structure, and an introduction to data wrangling and visualization. The course will be taught in R and Python.

Learning objectives

By the end of EDS 221, students should be able to:

Predictable daily schedule

Course dates: Monday (2021-08-09) - Friday (2021-08-20)

EDS 221 is an intensive 2-week long 4-unit course. Students should plan to attend all scheduled sessions. All course requirements will be completed between 8am and 5pm PST (M - F), i.e. you are not expected to do additional work for EDS 221 outside of those hours, unless you are working with the Teaching Assistant in student hours.

Note: For EDS 212 and 221, we will start Wednesdays at 10:00am (instead of 8:00am).

Tentative daily schedule (subject to change):

Time (PST) Activity
9:00am - 10:00am Lecture 1 (60 min)
10:00am - 11:00am Interactive Session 1 (60 min)
11:00am - 11:10am Break (10 min)
11:10am - 12:00pm Flex time (50 min)
12:00pm - 1:15pm Lunch (75 min)
1:15pm - 2:15pm Lecture 2 (60 min)
2:15pm - 3:15pm Interactive Session 2 (45 min)
3:15pm - 5:00pm Group & individual tasks (90 min)

Expected sessions (subject to change)

Note: lectures and flex sessions will also often include interactive live-coding. You should bring your computer and charger to all sessions in EDS 221.

Day / session Lecture Interactive sessions Flex sessions Activities
Monday 8/9: morning
  1. “Hello, world”: course introduction, programming in EDS, meet our tools
Capstone Project Proposal Kickoff & Professional Bio with Jamie! (continued) N/A
Monday 8/9: afternoon
  1. Project oriented workflows, file paths, naming things,good habits from the tidyverse style guide
Meet here , project organization, adding data import to our workflow N/A Day 1 Activities - Handout
Tuesday 8/10: morning
  1. Data representation and types
Creating and indexing with different data types Continue updating your website in {distill}: add a blog, check out the distillery N/A
Tuesday 8/10: afternoon
  1. Common data types and structures in EDS
Data in Python and R, accessing / updating elements & casting continued Mini-flex: our first little Rmd customization with css (and inspecting an html) Day 2 Activities - Handout
Wednesday 8/11: morning (late start)
  1. Conditionals and logical operations, intro to for loops
Refresh logical operations, write basic for loops in R & Python No flex sessions - Wednesday late start N/A
Wednesday 8/11: afternoon
  1. Loops continued - and functions to help
For loops with conditions, apply() functions, and across()

No flex sessions - Wednesday late start Day 3 Activities - Handout
Thursday 8/12: morning
  1. Introduction to writing functions in R and Python
Functions 101: basics Customize your {distill} website N/A
Thursday 8/12: afternoon
  1. Functions continued: planning, adding useful messages, more advanced functions and outputs
Functions 102: beyond basics (functions with conditions, iteration, messages) N/A Day 4 Activities - Handout
Friday 8/13: morning
  1. Functions continued: testing, documentation, sharing
Functions 103: testing & documenting functions, making your first package Functions, continued N/A
Friday 8/13: afternoon
  1. Finding & using external packages
Find & explore packages, documentation, accessing from repos N/A Day 5 Activities - Handout
Monday 8/16: morning
  1. Tidy data: what, why, how?
Tidying data (pivot, separate) basics with tidyr and pandas Data wrangling continued N/A
Monday 8/16: afternoon
  1. Data tidying and wrangling continued: dplyr and pandas
Data wrangling continued - dplyr and pandas N/A Day 6 Activities - Handout
Tuesday 8/17: morning
  1. Data wrangling continued - more tidying, relational data & types of joins
Data wrangling continued: joins Group read & report back: An introduction to designing accessible data visualizations by Sarah L. Fossheim N/A
Tuesday 8/17: afternoon
  1. Data wrangling continued - working with dates & times, wrangling strings
Data wrangling continued: dates, times, strings Meet your next instructor: Welcome Dr. Julien Brun! Day 7 Activities - Handout
Wednesday 8/18: morning (late start)
  1. The grammar of graphics & basic graph considerations

Fork this repo to follow along with Data visualization in ggplot2

See also: Ced Scherer’s ggplot2 tutorial, and Yan Holtz’ From Data to Vis and R Graph Gallery

No flex session - Wednesday late start N/A
Wednesday 8/18: afternoon
  1. Data visualization basics - responsible, clear, awesome
Data viz continued No flex session - Wednesday late start Day 8 Activities - Handout
Thursday 8/19: morning
  1. Troubleshooting (exploring, Googling, getting help, helping yourself)
Data viz continued Reading: Read An Introduction to Accessible Data Visualization by Sarah Fossheim and this introduction to alt-text from Harvard University IT N/A
Thursday 8/19: afternoon
  1. reprex, kable tables, and alt-text
More wrangling tools and practice, kable tables Panel discussion with leaders from SB data science communities Day 9 Activities - Handout
Friday 8/20: morning R package revisited, tables in R, a taste of git collaboration N/A N/A Morning activity - handout
Friday 8/20: afternoon Course wrap-up N/A N/A Afternoon Activity - handout

Course requirements

Computing

About this website

This website was created with gratitude using distill from RStudio by JJ Allaire, Rich Iannone, Alison Presmanes Hill, and Yihui Xie.

This website is one piece of the EDS 221 course materials in addition to lectures, computational activities, discussions, and individual and group tasks, and important materials may exist partially or not at all on this site. While this website is public, it is not meant as a standalone online course.

Other packages used to create this website: