Getting Started
We provide below a brief introduction to the project and how to get started using Jupyter @ NERSC
The Intro to Unix page from the Earth and Environmental Data Science book is an excellent resource for those just getting started or who are unfamiliar with the basics of Linux.
Similarly for their reference on Intro to Git for Version Control
Our project directory can be found at:
/global/cfs/cdirs/m4388/Project2-ClimRR/All of the data needed for this project has already been copied to the filesystem on NERSC.
In addition, we provide a pre-built (hpc-bootcamp) python kernel which we will use for running our code in Jupyter @ NERSC.
This hpc-bootcamp kernel has everything we will need for this project, including the ClimRR Python package.
Overview of Python
Material below modified from1: Python Fundamentals
Invoking Python
There are three main ways to use Python:
- Running / executing a Python file, e.g.
python filename.py- this will launch python, execute (line by line) the contents of
filename.py, and return
- this will launch python, execute (line by line) the contents of
- Interactively, either through:
- a console (e.g. the Python interpreter
pythonor an IPython shellipython) - a notebook (e.g. Jupyter notebook)*
- a console (e.g. the Python interpreter
*we will (mostly) focus on using Jupyter notebooks for this project.
Modules and Packages in Python
As an illustrative example for how to use and work with Python, weβve included a simple Python package (ClimRR) in our climate-analysis/ repo.
This Python package, CLimRR, is located in src/ClimRR/ and contains the following2:
- climate-analysis/
- π src/
- π ClimRR/
- π __about__.py
- π __init__.py
- π data.py
- π ClimRR/
- π src/
In particular, the Python package3 that we will use for this project, ClimRR is located inside our src/ClimRR directory.
This is a simple example just to
__init__.py: Any folder containing an__init__.pyfile is considered a Python library.Oftentimes they are empty4, but ours contains some (not terribly important) functions for specifying where our data lives, setting up logging, etc.
__about__.py: A strictly informational (metadata!) file that can be used to (dynamically!) specify a package version. Again, this isnβt important for our purposes but incase youβre wondering what it does5.data.py: Contains some simple (but useful!) functions for loading our Shapefile, loading US County data, and loadingClimRRclimate data from*.CSVs
The data needed for this project has already been copied to the NERSC systems and can be found at:
For those curious, the ClimRR data we will be working with looks something like:
$ tree /global/cfs/cdirs/m4388/Project2-ClimRR/data/ClimRR/
/global/cfs/cdirs/m4388/Project2-ClimRR/data/ClimRR/
βββ AnnualTemperatureMaximum.csv
βββ AnnualTemperatureMinimum.csv
βββ ClimRR Metadata and Data Dictionary.pdf
βββ ConsecutiveDayswithNoPrecipitation.csv
βββ FireWeatherIndex_Wildfire.csv
βββ GridCells2Shapefile.zip
βββ GridCellsShapefile.zip
βββ HeatingDegreeDays.csv
βββ Precipitation_inches_AnnualTotal.csv
βββ README.txt
βββ SeasonalTemperatureMaximum.csv
βββ SeasonalTemperatureMinimum.csv
βββ WindSpeed.csvthe data is also available online and can be downloaded from ClimRR Data Download (ANL)
Setup
To get started, we will need to:
Create a symlink from the project directory,
/global/cfs/cdirs/m4388/Project2-ClimRR/into your$HOMEdirectoryln -s /global/cfs/cdirs/m4388/Project2-ClimRR/ $HOME/Project2-ClimRRNavigate into here and create your personal directory (where you will store and work on your project):
cd $HOME/Project2-ClimRR/ mkdir $USER cd $USERClone the GitHub repo
git clone https://github.com/saforem2/climate-analysisNavigate to
jupyter.nersc.govand login.Navigate into your personal directory in our
/global/cfs/cdirs/m4388/Project2-ClimRR/project space:

Figure 1: Screenshots of the Jupyter interface at NERSC
Footnotes
Which itself is modified from the official python tutorialβ©οΈ
Recall, a Python module is an individual file
.pycontaining some Python code. A Python library is then a collection of these modules, organized around some central idea or purpose.β©οΈRoughly,
package\simeqlibraryfor our purposesβ©οΈMore information on
__init__.pyand Python packages can be found hereβ©οΈAdditional information here. Again, understanding the details of python packaging is well beyond the scope of this project, but Iβve included some details here for those curious.β©οΈ
Citation
@online{foreman2023,
author = {Foreman, Sam},
title = {Energy {Justice} {Analysis} of {Climate} {Data} with
{ClimRR}},
date = {2023-08-08},
url = {https://saforem2.github.io/climate-analysis},
langid = {en}
}