edgi-govdata-archiving / ECHO-by-Zip-Code

A Jupyter Notebook-based exploration of emissions permits, compliance, and enforcement designed for localization by zip code
https://colab.research.google.com/github/edgi-govdata-archiving/ECHO-by-Zip-Code/blob/main/echo-by-zip.ipynb
GNU General Public License v3.0
1 stars 2 forks source link

ECHO by Zip Code

A Jupyter Notebook-based exploration of emissions permits, compliance, and enforcement designed for localization by zip code

Code of Conduct


Try it out!

See a static sample report here. This demo won't let you look at different locations, it's just a quick sample!

Link to Jupyter Notebook

Here's the demo where you can modify the location & see new results. Follow the instructions for Google Colab below:

Running the notebook in Google CoLab

Running the notebook locally

Quickstart

You need:

Run jupyter notebook in the project repo to start the notebook.

Setup for beginners

Getting set up with the programming tools

In this section, we will install the programming language Python, and use its package manager "pip" to install Jupyter Notebook.

Hopefully, you should now be able to run jupyter notebook in the command line. If it's working, it will open your browser and show you all the files in your current directory.

Screen Shot 2020-02-06 at 3 39 26 PM

Getting this repo onto your computer

You will need to install git, which is a version control system that's designed for multiple people to be able to work with the same repo: Git download page. You can test whether it worked by running the command git in the command line.

Screen Shot 2020-02-06 at 3 38 32 PM

Choose where on your computer you want this project to go (Documents, for example). In your command line, use cd to navigate to the folder where you want to save the project.

Now "clone" the repo (copy all of the files from the online repository to your computer) by running:

git clone https://github.com/edgi-govdata-archiving/ECHO-by-Zip-Code.git

Once the process completes, navigate into the cloned repo folder:

cd echo-by-zip-code

If you run jupyter notebook from here, it should open your browser and there should be a file called echo-by-zip.ipynb. Click to open!

Screen Shot 2020-02-06 at 3 33 53 PM

Screen Shot 2020-02-06 at 3 34 07 PM

Getting the data

The data we are using is not a part of the repo. (It could be, but isn't in order to keep the repo small.) You will need to download it separately.

Download the ZIP file from ECHO Exporter on the ECHO Data Downloads page.

Screen Shot 2020-02-06 at 3 34 41 PM

Unzip the file and move its contents into the data folder of your local copy of this repo. It should look like:

echo-by-zip-code/data/ECHO_EXPORTER.csv

(You can put the xlsx file there too, but the code doesn't depend on it. It's a useful file to keep around.)

Installing libraries

When you open the Jupyter notebook, there will be a little code block near the top with the comment # Import libraries.

This code block names the different libraries (packages of many specialized functions for e.g. mapping things or manipulating data) that the notebook is using:

Screen Shot 2020-02-06 at 3 34 19 PM

For each line with an import in front of it, you will need to install a library using the command line.

Open a new window of your terminal, then for each library, install with:

pip install <library>.

For example, since there is a line that says import pandas as pd in the notebook, enter

pip install pandas

into the command line.

Using the notebook

Now that the notebook is running and you have the data & libraries installed, you should be able to run it!

Back in the notebook, you can either click the button that says "Run" to run one cell at a time, or hit "Run All" in the "Cell" menu to run the whole notebook.

Screen Shot 2020-02-06 at 3 49 56 PM

It might take a minute to process all that data! When it's done, you should see some maps and graphs about the ECHO permits in the specified zip code area.

Change the zip code in the code as my_zip to your own zip code and run the notebook again to see a report for your area:

Screen Shot 2020-02-06 at 3 52 03 PM

Default branch - 'main'

The 'master' branch is no longer the repo's primary branch in line with EDGI's policy decided here: https://github.com/edgi-govdata-archiving/overview/issues/241

If someone has a local clone, they can update their locals like this:

$ git checkout master
$ git branch -m master main
$ git fetch
$ git branch --unset-upstream
$ git branch -u origin/main
$ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

The above steps accomplish:

  • Go to the master branch
  • Rename master to main locally
  • Get the latest commits from the server
  • Remove the link to origin/master
  • Add a link to origin/main
  • Update the default branch to be origin/main

(From @jywarren at Public Lab: https://github.com/publiclab/plots2/issues/8077)


License & Copyright

Copyright (C) Environmental Data and Governance Initiative (EDGI) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.0.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the LICENSE file for details.