Skip to content

Commit c27564a

Browse files
committed
Initial commit
0 parents  commit c27564a

10 files changed

+367
-0
lines changed

.github/workflows/deploy.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: deploy
2+
3+
on:
4+
# Trigger the workflow on push to main branch
5+
push:
6+
branches:
7+
- main
8+
9+
# This job installs dependencies, build the book, and pushes it to `gh-pages`
10+
jobs:
11+
build-and-deploy-book:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
python-version: [3.8]
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
# Install dependencies
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v1
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
pip install -r requirements.txt
28+
# Build the book
29+
- name: Build the book
30+
run: |
31+
jupyter-book build notebooks
32+
# Deploy the book's HTML to gh-pages branch
33+
- name: GitHub Pages action
34+
uses: peaceiris/[email protected]
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: notebooks/_build/html

.gitignore

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 National Center for Atmospheric Research
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# analysis_project_template
2+
This is a sample template meant to be used for workflows centered around notebooks
3+
4+
## Why you should use this template
5+
This template is meant to give you the basic setup of an "analysis" repository, focused on storing notebooks or other pieces of scientific code/documentation. This repository is not meant to be a "one size fits all" repository, but rather, a starting point from which the user can build upon.
6+
7+
## Essential checklist for your repository
8+
- [ ] Software license
9+
- [ ] Detailed readme
10+
- [ ] Update the environment.yml file in include the required libraries/packages
11+
- [ ] Your analysis code/notebooks!
12+
13+
## Choosing a license for this repository
14+
There are a variety of software licenses to choose from. The default for this
15+
repository is the [MIT License](https://opensource.org/licenses/MIT) which is short
16+
and to the point. If you are interested in learning more about which license is
17+
best for you, check out [this resource](https://choosealicense.com/) to help you
18+
determine which is best for your specific needs, or consult [UCAR Legal](https://internal.ucar.edu/counsel/about)
19+
20+
## What to include in your README (README.md)
21+
Once you copy over this template and choose your license, you should populate your README file. This file serves as a landing page for your repository and should provide the following:
22+
- Title of the project
23+
- Introduction and overview of what the analysis covers
24+
- How to contribute
25+
- How to reproduce the conda environment
26+
27+
An example of this is given below
28+
```
29+
# Climate-Analysis
30+
This is a repository meant to show how to do climate analysis.
31+
32+
## Contributing
33+
Clone this repository to your account, then create your own branch to work in
34+
35+
"git checkout -b <nameofyourbranch>"
36+
37+
38+
## Reproducing the environment
39+
40+
"conda env create -f envs/environment.yml"
41+
"conda activate environment_name"
42+
43+
44+
```
45+
46+
## The importance of software citation and minting a DOI
47+
Once your repository is built and you have added your analysis, you may want to mint a DOI for your project, so you can share your work with the community AND receive credit for doing so.
48+
49+
Directions on how to mint a DOI for your project can be found on the [NCAR Software Citation Documentation](https://ncar.github.io/software-citation/pages/recommendation/mint-doi.html)

envs/environment.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: analysis
2+
channels:
3+
- conda-forge
4+
- nodefaults
5+
dependencies:
6+
- numpy
7+
- xarray
8+
- matplotlib
9+
- cartopy
10+
- dask
11+
- jupyter
12+
- jupyterlab
13+
- netCDF4

notebooks/Notebook_Template.ipynb

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Sample Notebook\n",
8+
"\n",
9+
"Once you copy this repository, feel free to delete this notebook!"
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"### Imports"
17+
]
18+
},
19+
{
20+
"cell_type": "code",
21+
"execution_count": null,
22+
"metadata": {},
23+
"outputs": [],
24+
"source": [
25+
"#Import something here\n",
26+
"import xarray as xr\n",
27+
"import matplotlib.pyplot as plt"
28+
]
29+
},
30+
{
31+
"cell_type": "markdown",
32+
"metadata": {},
33+
"source": [
34+
"### Data Ingest"
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": null,
40+
"metadata": {},
41+
"outputs": [],
42+
"source": [
43+
"# Read in the data using xarray or some other package\n",
44+
"ds = xr.open_dataset('some_file.nc')"
45+
]
46+
},
47+
{
48+
"cell_type": "markdown",
49+
"metadata": {},
50+
"source": [
51+
"### Data Operation"
52+
]
53+
},
54+
{
55+
"cell_type": "code",
56+
"execution_count": null,
57+
"metadata": {},
58+
"outputs": [],
59+
"source": [
60+
"# Do some sort of calculation on the data\n",
61+
"some_calc = ds.temp * some_equation"
62+
]
63+
},
64+
{
65+
"cell_type": "markdown",
66+
"metadata": {},
67+
"source": [
68+
"### Data Visualization"
69+
]
70+
},
71+
{
72+
"cell_type": "code",
73+
"execution_count": null,
74+
"metadata": {},
75+
"outputs": [],
76+
"source": [
77+
"# Plot the data\n",
78+
"plt.plot(x, y)"
79+
]
80+
}
81+
],
82+
"metadata": {
83+
"kernelspec": {
84+
"display_name": "Python 3",
85+
"language": "python",
86+
"name": "python3"
87+
},
88+
"language_info": {
89+
"codemirror_mode": {
90+
"name": "ipython",
91+
"version": 3
92+
},
93+
"file_extension": ".py",
94+
"mimetype": "text/x-python",
95+
"name": "python",
96+
"nbconvert_exporter": "python",
97+
"pygments_lexer": "ipython3",
98+
"version": "3.8.5"
99+
}
100+
},
101+
"nbformat": 4,
102+
"nbformat_minor": 4
103+
}

notebooks/_config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
title: Analysis Project Template
2+
author: NCAR ESDS Team
3+
execute:
4+
execute_notebooks: "off"

notebooks/_toc.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
format: jb-book
2+
root: intro
3+
chapters:
4+
- file: Notebook_Template

notebooks/intro.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Introduction
2+
3+
This is an overview of your project. Feel free to update accordingly!

requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
jupyter-book
2+
matplotlib
3+
numpy
4+
ghp-import

0 commit comments

Comments
 (0)