Skip to content

Commit

Permalink
ADD: Adding more notebooks to the tutorial with also added piechart
Browse files Browse the repository at this point in the history
code.
  • Loading branch information
zssherman committed Aug 6, 2024
1 parent 1d5cd5c commit 0c9276c
Show file tree
Hide file tree
Showing 9 changed files with 4,081 additions and 0 deletions.
632 changes: 632 additions & 0 deletions Tutorials/ACT-Python-Tutorial/2-jupyter_intro.ipynb

Large diffs are not rendered by default.

450 changes: 450 additions & 0 deletions Tutorials/ACT-Python-Tutorial/3-Python-Basics.ipynb

Large diffs are not rendered by default.

832 changes: 832 additions & 0 deletions Tutorials/ACT-Python-Tutorial/3a-scientific_libraries_numpy.ipynb

Large diffs are not rendered by default.

523 changes: 523 additions & 0 deletions Tutorials/ACT-Python-Tutorial/3b-scientific_libraries_pandas.ipynb

Large diffs are not rendered by default.

663 changes: 663 additions & 0 deletions Tutorials/ACT-Python-Tutorial/3c-scientific_libraries_xarray.ipynb

Large diffs are not rendered by default.

693 changes: 693 additions & 0 deletions Tutorials/ACT-Python-Tutorial/5-ACT-Basics-2024.ipynb

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions Tutorials/ACT-Python-Tutorial/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# These notebooks and presentations are from a tutorial session for the PNNL Atmospheric Intrumentation Course. These tutorials covered ARM's JupyterHub resources, basic python, and the [Atmospheric data Community Toolkit (ACT)](https://github.com/ARM-DOE/ACT). The ACT tutorials were focused around exploring aerosol and lidar data from a dust event during TRacking Aerosol Convection interations ExpeRiment (TRACER) that occurred from July 16-19, 2022.

### JupyterHub and Jupyter Notebooks
[2-jupter_intro.ipynb](https://github.com/ARM-Development/ARM-Notebooks/blob/main/Tutorials/ACT-Python-Tutorial/2-jupyter_intro.ipynb) is a notebook to get started with ARM's JupyterHub resources and navigate what JupyterHub notebooks are and some useful shortcuts.

### Python Tutorials
[3-Python-Basics.ipynb](https://github.com/ARM-Development/ARM-Notebooks/blob/main/Tutorials/ACT-Python-Tutorial/3-Python-Basics.ipynb) is a what it seems, a notebook to go over beginner Python skills. For those wanting to explore some more complex libraries in Python, checkout the other notebooks
- [3a-scientific_libraries_numpy.ipynb](https://github.com/ARM-Development/ARM-Notebooks/blob/main/Tutorials/ACT-Python-Tutorial/3a-scientific_libraries_numpy.ipynb)
- [3b-scientific_libraries_pandas.ipynb](https://github.com/ARM-Development/ARM-Notebooks/blob/main/Tutorials/ACT-Python-Tutorial/3b-scientific_libraries_pandas.ipynb)
- [3c-scientific_libraries_xarray.ipynb](https://github.com/ARM-Development/ARM-Notebooks/blob/main/Tutorials/ACT-Python-Tutorial/3c-scientific_libraries_xarray.ipynb)

### Atmospheric data Community Toolkit (ACT) Tutorials
- [5-ACT-Basics-2023.ipynb](https://github.com/ARM-Development/ARM-Notebooks/blob/main/Tutorials/ACT-Python-Tutorial/5-ACT-Basics-2023.ipynb) is a base tutorial using data from the TRACER Particle Soot Absorption Photometer (PSAP) to explore some of the base functionality of ACT including visualizations and working with quality control information.

- [6-ACT-TRACER-Dust.ipyn](https://github.com/ARM-Development/ARM-Notebooks/blob/main/Tutorials/ACT-Python-Tutorial/6-ACT-TRACER-Dust.ipynb) is a notebook to bring a variety of datasets together for visualization and performing some of the more complex operations in ACT to produce a figure like the below.

![Output from the advanced ACT tutorial](https://github.com/ARM-Development/ARM-Notebooks/blob/main/Tutorials/ACT-Python-Tutorial/images/output.png)
Figure 1. From the top, micropulse lidar linear depolarization ratio, aerodynamic particle sizer concentration, scanning mobility particle sizer concentration, aerosol chemical speciation monitor chemical compositions, single particle soot photometer black carbon concentration, PSAP aerosol absorption coefficient in the blue channel, and the surface meteorology station wind direction.

### Additional Tutorials
There are two additional tutorials for an [Introduction to GitHub and git](https://github.com/ARM-Development/ARM-Notebooks/blob/main/Tutorials/ACT-Python-Tutorial/optional_github_intro.md) and how to perform [Branching and Pull Requests](https://github.com/ARM-Development/ARM-Notebooks/blob/main/Tutorials/ACT-Python-Tutorial/optional_github_branching.md) which are all very important when contributing work back into these open-source packages.
132 changes: 132 additions & 0 deletions Tutorials/ACT-Python-Tutorial/optional_github_branching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Branching and Pull Requests on the Github Website

## Overview:

1. Creating a Branch Using the Github Web Interface
1. Making Changes to Our Branch
1. Submitting a Pull Request Using the Github Web Interface

## Prerequisites

| Concepts | Importance | Notes |
| --------------------------------------------- | ---------- | --------------------- |
| [Intro to Github](introduction) | Necessary | Need an account |
| [Cloning and Forking a Repo](forking_cloning) | Necessary | Need forked repo |
| [Branches and PRs](branching_pull_request) | Helpful | Terminology helpful |

- **Time to learn**: 15 minutes

---

## Creating a Branch Using the Github Web Interface

### Make sure your `main` branch is up to date

A good rule of thumb is to make sure that you **never** add a feature/change on your `main` branch. Another rule to keep in mind is that you **always** want to keep your fork of the repository up to date with the ***upstream*** repository (in this case, this is [Aerosol Mentors Processing Routines](https://github.com/ARM-Development/Aerosol-Mentors-Processing-Routines)).

For example, if you had a different project (for example `CO`) you wanted to make changes to, you would not want to include those changes from `CCN` as well!

Fortunately, Github makes this easy! From **_your fork of the repository_**, you will see a "Fetch upstream" dropdown!

<img src="images/fetch-upstream-github.png" alt="Fetch Upstream">

It is important to do this **early and often** and be sure that when you make changes, you follow the process of:

### Creating your Branch

Now that our main branch is in-sync, the first step to contributing is to create a **branch** of your repository!

On the left side of the screen, you will see a box that says "`main`", indicating you are on the `main` branch. You will need to click on `main`, as shown below:

<img src="images/locate-github-branches-web.png" alt="Fetch Upstream">

Once you click on `main`, a new window will pop up with the title "Switch branches/tags"

At this point, go ahead and type in the name of your new branch! In this example, we are adding new Python code related to CO processing, so we title our new branch `co-python-code`!

You will also see a button toward the bottom of the window "**Create branch: co-python-code** from main"

<img src="images/create-new-branch-github-ui.png" alt="Fetch Upstream">

If we click on "**Create branch: co-python-code** from main", we create that new branch!

You'll notice that instead of `main` in the top left-hand corner of the screen, we see our new branch name `co-python-code`

<img src="images/on-new-branch-github-ui.png" alt="Fetch Upstream">

We have successfully created a new branch! 🎉

## Making Changes to Our Branch

Now that we have a new branch, we can make changes!

### Move into the `CO/Python` directory

Let's migrate into into the CO directory, which can be accessed by clicking through the web interface.

First, we click on the `CO` folder.

<img src="images/move-to-co-directory.png" alt="Fetch Upstream">

You'll see there are now three folders/directories in here! We are interested in adding Python code, so we select Python by clicking on it.

<img src="images/move-to-python-directory.png" alt="Fetch Upstream">

The only file currently in `CO/Python` is a `.gitignore` file... we would like to change that!

### Adding a new Python file

We would like to add a `.py` file to this directory, which can do by selecting add file.

<img src="images/move-to-python-directory.png" alt="Fetch Upstream">

You could also add files from your computer using the "Upload files" option.

We will add a file using the "Create new file" option, which results in the following text editory interface.

We need to add the name of the file, which in this case is `myprocessing.py`

We also add some Python code, which is a `print()` statement

<img src="images/add-analysis-script.png" alt="Fetch Upstream">

Once we have our changes ready, scroll to the bottom screen where you can add a title to your changes, along with any additional information.

In our example, we add a title of "Add processing script"

<img src="images/commit-python-script-github-ui.png" alt="Fetch Upstream">

Now, click the green button that says "Commit new file" which will commit these changes to your branch (`co-python-code`)!

Once we do that, we are ready to submit our Pull Request.

## Submitting a Pull Request Using the Github Web Interface

When you move back to your fork of the repository, which is the page that should show up after clicking that "Commit new file" button in the previous step, you should see the following screen with a yellow box stating "**co-python-code** had recent pushes less than a minute ago" and a green button stating "Compare & pull request"!

<img src="images/view-compare-pull-request-github-ui.png" alt="Fetch Upstream">

If we click on "Compare & pull request", we can prepare to submit our pull request, requesting that **our new features** be merged with the **upstream ARM-Development** copy of the repository (making these changes useful to the wider community)!

We can add a title to this pull request, as shown below:

<img src="images/open-pull-request-github-ui.png" alt="Fetch Upstream">

Once we are ready to submit these changes, we click on the green button stating "Create Pull Request", which will result in the following:

<img src="images/submit-pull-request-github-ui.png" alt="Fetch Upstream">

Our changes have been suggested, and the various code-checkers are running. At this point, the code will be reviewed, you will receive feedback, and once it is approved, it will be merged!

You have now successfully created your first branch, and submitted your first pull request! If you have more questions about the terminology, I encourage you to read through the [Branches and PRs](branching_pull_request) content, in addition to the Github content on [Project Pythia](https://foundations.projectpythia.org/foundations/getting-started-github.html).

---

## Summary
* It is important to keep your fork in-sync with the upstream repository!
* A Pull Request (PR) is a formal mechanism for requesting that changes that you have made to one repository are integrated (merged) into another repository.
* You can create a branch, make changes, then submit a PR with those changes.

### What's Next?
Submitting your code to the [Aerosol-Mentors-Processing-Routines
Repository](https://github.com/ARM-Development/Aerosol-Mentors-Processing-Routines)!
135 changes: 135 additions & 0 deletions Tutorials/ACT-Python-Tutorial/optional_github_intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<img src="images/GitHub-logo.png" alt="Github Logo" width="600px">

# An Introduction to Github

* 02-28-2022 (Windows Users)
* 03-01-2022 (Mac/Linux Users)

## Overview:

1. What is GitHub?
1. No experience necessary!
1. Free- and open-source software (FOSS)
1. Version control systems (VCS)
1. GitHub = FOSS + VCS + Web
1. Register for a free GitHub account

## Prerequisites

If on a **Windows** Machine, make sure to install [Git for Windows](https://gitforwindows.org/)
* [Download Page](https://github.com/git-for-windows/git/releases/tag/v2.35.1.windows.2)
* Choose the appropriate download based on your operating system
* [32 Bit](https://github.com/git-for-windows/git/releases/download/v2.35.1.windows.2/Git-2.35.1.2-32-bit.exe)
* [64 Bit](https://github.com/git-for-windows/git/releases/download/v2.35.1.windows.2/Git-2.35.1.2-64-bit.exe)

---

## What is GitHub?

[GitHub](https://github.com) is a web-based platform for the dissemination of free- and open-source software.

If you are reading this lesson, you are already using GitHub, as that is where Project Pythia hosts its content!

GitHub provides the following:

1. _Version control_ for free- and open-source software and other digital assets
1. Project _discussion forums_
1. _DevOps_ to facilitate building and testing software
1. _Bug_ reporting, patching, and tracking
1. _Documentation_ hosting
1. An environment that fosters _collaboration_

Although GitHub can host any digital asset, the most common use case for GitHub is for individuals or organizations to house _repositories_ of _free-_ and _open-source software_:

## No experience necessary!

You do not need to be an experienced software developer or be proficient in version control to make use of GitHub! Perhaps, though, you have used a particular package (e.g., Xarray or Matplotlib) and have had questions about its usage, noticed a bug, or had an idea for a new feature for the package! You can participate in a project's development via GitHub the same way you might have interacted with its developers via email in the past.

## Free- and open-source software (FOSS)

Much of what we term the _scientific Python software ecosystem_ consists of _free- and open-source software_. Often abbreviated as **FOSS**, this means:

1. The software is free-of-charge, and
1. The various files which contain the _software code_ are publicly available.

```{admonition} Did you know?
:class: info
The [Python language](https://python.org) itself is an example of *FOSS*!
```

FOSS is nothing new. For example, the [Linux kernel source code](https://kernel.org) has been available to download for many years.

```{admonition} Free $\neq$ open source!
:class: tip
Just because a software package may be free does not mean that its source code is open! For example, although Nvidia makes its video drivers available for free download, the source code for those drivers is proprietary.
```

Arguably, the greatest advantage of open-source software is that it enables _collaborative sharing_, and thus community feedback.

Types of community input may include the following:

1. _Issues_: usage questions, bug reports, feature requests
1. _Pull requests_: a user can ask that that their changes/additions be incorporated into the project
1. _Discussions_: a community forum on the open source project

## Version control systems (VCS)

We will discuss version control in more detail later in this series, but the need to track and manage changes to a project, especially one that involves software, has long been known. Over the years, FOSS developers have used VCS such as _cvs_, _svn_, and most recently, _git_. All of these systems are _command-line tools_.

## FOSS and VCS on the Internet

A successful FOSS project needs to be accessible via the web. As mentioned before, the Linux kernel and the Python language have long been available using first-generation remote access protocols such as FTP and HTTP, and SSH. Later, VCS tools such as cvs and svn established their own TCP protocols for remote access. With the advent of _git_, web-based services that supported HTTP(S) and SSH sprung up. Each of these VCS leverages the concept of a particular FOSS project as a <i>code repository</i>.

```{admonition} Did you know?
:class: info
Linus Torvalds, the original developer (and still the lead maintainer) of **Linux**, is also the original developer of [Git](https://git-scm.com)!
```

```{admonition} Stay tuned!
:class: tip
We will discuss version control and the use of **Git** via the command line later in this session!
```

## FOSS + VCS + Web = GitHub

Perhaps the most popular web-based platform that uses Git for FOSS VCS is [GitHub](https://github.com). GitHub hosts all of the Python software packages that Project Pythia covers as code repositories (we'll use the term <i>Git repo</i>, or more generally just <i>repo</i> henceforth to represent a GitHub code repository).

For example, here is a screenshot from [ARM-Development's Aerosol-Mentors-Processing-Routines Repo](https://github.com/ARM-Development/Aerosol-Mentors-Processing-Routines) Git repo:

<img src="images/aerosol-mentors-repo-screenshot.png" alt="ARM GitHub">

```{note}
The above screenshot is from <i>one moment in time</i>. When you visit the Aerosol-Mentors-Processing-Routines link above, it will no doubt look different!
```

## Register for a free GitHub account

While one can freely browse GitHub repositories such as Aerosol-Mentors-Processing-Routines anonymously, it's necessary to log into a unique (and free) user account in order to take advantage of GitHub's full capabilities, such as:

1. Opening issues and pull requests
1. Participate in discussions
1. Host your own repository

Your next step (if you haven't already) should be to register for your free GitHub account. As with many online services, you will choose a user id, password, and specify an email address to use with your account.

To do so, simply point your browser to the [GitHub sign-up page](https://github.com/join):

<img src="images/GitHubJoin.png" alt="GitHub Signup">

While GitHub offers paid options, a free account is typically all that is needed!

---

## Summary

- GitHub serves as a web-based platform for digital assets, particularly FOSS.
- GitHub uses Git as its version control system.
- You can set up a free user account on GitHub.

### What's Next?

In the next lesson, we will explore **Forking and Cloning** a Github Repository

## References

1. [GitHub (Wikipedia)](https://en.wikipedia.org/wiki/GitHub)

0 comments on commit 0c9276c

Please sign in to comment.