Skip to content

Commit b3e0d83

Browse files
authored
add ARM JupyerHub badges to README and example notebook (+ adding header pip-pinstall code blocks) (#331)
1 parent a7d5f8d commit b3e0d83

File tree

6 files changed

+52
-18
lines changed

6 files changed

+52
-18
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,29 @@ import PyPartMC
3232
```
3333

3434
#### Jupyter notebooks with examples
35+
Note: clicking the badges below redirects to cloud-computing platforms. The mybinder.org links allow anonymous execution, Google Colab requires logging in with a Google account, ARM JupyerHub requires logging in with an ARM account (and directing Jupyter to a particular notebook within the `examples` folder).
3536

3637
- Urban plume scenario demo (as in [PartMC](https://github.com/compdyn/partmc/tree/master/scenarios/1_urban_plume)):
3738
[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/particle_simulation.ipynb)
3839
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/particle_simulation.ipynb)
39-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/particle_simulation.ipynb)
40+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/particle_simulation.ipynb)
41+
[![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=)
4042
- Dry-Wet Particle Size Equilibration with PartMC and PySDM:
4143
[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/lognorm_ex.ipynb)
4244
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/lognorm_ex.ipynb)
4345
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/lognorm_ex.ipynb)
46+
[![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=)
4447
[![Voila](https://img.shields.io/static/v1?label=Voil%C3%A0&logo=jupyter&color=teal&message=web+app)](https://mybinder.org/v2/gh/open-atmos/PyPartMC/main?urlpath=voila%2Frender%2Fexamples%2Flognorm_ex.ipynb)
4548
- Simulation output processing example (loading from netCDF files using PyPartMC):
4649
[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/process_simulation_output.ipynb)
4750
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/process_simulation_output.ipynb)
4851
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/process_simulation_output.ipynb)
52+
[![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=)
4953
- Optical properties calculation using external Python package ([PyMieScatt](https://pymiescatt.readthedocs.io/en/latest/)):
5054
[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/mie_optical.ipynb)
5155
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/mie_optical.ipynb)
5256
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/mie_optical.ipynb)
53-
57+
[![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=)
5458

5559
## Features
5660

examples/hello_world.ipynb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
"metadata": {},
66
"source": [
77
"[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/hello_world.ipynb) \n",
8-
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/hello_world.ipynb) \n",
9-
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/hello_world.ipynb)"
8+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/hello_world.ipynb) (requires logging in with a Google account) \n",
9+
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/hello_world.ipynb) \n",
10+
"[![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=) (requires [logging in with ARM account](https://www.arm.gov/capabilities/computing-resources) and directing Jupyter to a notebook within the cloned repo)"
1011
]
1112
},
1213
{
@@ -18,8 +19,15 @@
1819
"outputs": [],
1920
"source": [
2021
"import sys\n",
22+
"import os\n",
2123
"if 'google.colab' in sys.modules:\n",
22-
" !pip --verbose install PyPartMC"
24+
" !pip --quiet install open-atmos-jupyter-utils\n",
25+
" from open_atmos_jupyter_utils import pip_install_on_colab\n",
26+
" pip_install_on_colab('PyPartMC')\n",
27+
"elif 'JUPYTER_IMAGE' in os.environ and '.arm.gov' in os.environ['JUPYTER_IMAGE']:\n",
28+
" !pip --quiet install PyPartMC\n",
29+
" _pypartmc_path = !pip show PyPartMC | fgrep Location | cut -f2 -d' '\n",
30+
" sys.path.extend(_pypartmc_path if _pypartmc_path[0] not in sys.path else [])"
2331
]
2432
},
2533
{

examples/lognorm_ex.ipynb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/lognorm_ex.ipynb) \n",
99
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/lognorm_ex.ipynb) \n",
1010
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/lognorm_ex.ipynb) \n",
11+
"[![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=) (requires [logging in with ARM account](https://www.arm.gov/capabilities/computing-resources) and directing Jupyter to a notebook within the cloned repo)\n",
1112
"[![Voila](https://img.shields.io/static/v1?label=Voil%C3%A0&logo=jupyter&color=teal&message=web+app)](https://mybinder.org/v2/gh/open-atmos/PyPartMC/main?urlpath=voila%2Frender%2Fexamples%2Flognorm_ex.ipynb)"
1213
]
1314
},
@@ -31,8 +32,15 @@
3132
"outputs": [],
3233
"source": [
3334
"import sys\n",
35+
"import os\n",
3436
"if 'google.colab' in sys.modules:\n",
35-
" !pip --quiet install PyPartMC open-atmos-jupyter-utils PySDM"
37+
" !pip --quiet install open-atmos-jupyter-utils\n",
38+
" from open_atmos_jupyter_utils import pip_install_on_colab\n",
39+
" pip_install_on_colab('PyPartMC', 'PySDM')\n",
40+
"elif 'JUPYTER_IMAGE' in os.environ and '.arm.gov' in os.environ['JUPYTER_IMAGE']:\n",
41+
" !pip --quiet install PyPartMC PySDM open-atmos-jupyter-utils\n",
42+
" _pypartmc_path = !pip show PyPartMC | fgrep Location | cut -f2 -d' '\n",
43+
" sys.path.extend(_pypartmc_path if _pypartmc_path[0] not in sys.path else [])"
3644
]
3745
},
3846
{

examples/mie_optical.ipynb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"source": [
88
"[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/mie_optical.ipynb) \n",
99
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/mie_optical.ipynb) \n",
10-
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/mie_optical.ipynb)"
10+
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/mie_optical.ipynb) \n",
11+
"[![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=) (requires [logging in with ARM account](https://www.arm.gov/capabilities/computing-resources) and directing Jupyter to a notebook within the cloned repo)"
1112
]
1213
},
1314
{
@@ -32,11 +33,15 @@
3233
"outputs": [],
3334
"source": [
3435
"import sys\n",
35-
"\n",
36+
"import os\n",
3637
"if \"google.colab\" in sys.modules:\n",
3738
" !pip --quiet install open-atmos-jupyter-utils\n",
3839
" from open_atmos_jupyter_utils import pip_install_on_colab\n",
39-
" pip_install_on_colab('PyPartMC', 'PyMieScatt')"
40+
" pip_install_on_colab('PyPartMC', 'PyMieScatt')\n",
41+
"elif 'JUPYTER_IMAGE' in os.environ and '.arm.gov' in os.environ['JUPYTER_IMAGE']:\n",
42+
" !pip --quiet install PyPartMC PyMieScatt open_atmos_jupyter_utils\n",
43+
" _pypartmc_path = !pip show PyPartMC | fgrep Location | cut -f2 -d' '\n",
44+
" sys.path.extend(_pypartmc_path if _pypartmc_path[0] not in sys.path else [])"
4045
]
4146
},
4247
{

examples/particle_simulation.ipynb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"source": [
88
"[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/particle_simulation.ipynb) \n",
99
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/particle_simulation.ipynb) \n",
10-
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/particle_simulation.ipynb)"
10+
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/particle_simulation.ipynb) \n",
11+
"[![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=) (requires [logging in with ARM account](https://www.arm.gov/capabilities/computing-resources) and directing Jupyter to a notebook within the cloned repo)"
1112
]
1213
},
1314
{
@@ -32,12 +33,15 @@
3233
"outputs": [],
3334
"source": [
3435
"import sys\n",
35-
"\n",
36-
"if \"google.colab\" in sys.modules:\n",
36+
"import os\n",
37+
"if 'google.colab' in sys.modules:\n",
3738
" !pip --quiet install open-atmos-jupyter-utils\n",
3839
" from open_atmos_jupyter_utils import pip_install_on_colab\n",
39-
" pip_install_on_colab('PyPartMC')"
40-
]
40+
" pip_install_on_colab('PyPartMC')\n",
41+
"elif 'JUPYTER_IMAGE' in os.environ and '.arm.gov' in os.environ['JUPYTER_IMAGE']:\n",
42+
" !pip --quiet install PyPartMC open_atmos_jupyter_utils\n",
43+
" _pypartmc_path = !pip show PyPartMC | fgrep Location | cut -f2 -d' '\n",
44+
" sys.path.extend(_pypartmc_path if _pypartmc_path[0] not in sys.path else [])" ]
4145
},
4246
{
4347
"cell_type": "code",

examples/process_simulation_output.ipynb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"source": [
88
"[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyPartMC/blob/main/examples/process_simulation_output.ipynb) \n",
99
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/process_simulation_output.ipynb) \n",
10-
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/process_simulation_output.ipynb)"
10+
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/process_simulation_output.ipynb) \n",
11+
"[![ARM JupyterHub](https://img.shields.io/static/v1?label=launch%20in&logo=jupyter&color=lightblue&message=ARM+JupyterHub)](https://jupyterhub.arm.gov/hub/user-redirect/git-pull?repo=https%3A//github.com/open-atmos/PyPartMC&branch=main&urlPath=) (requires [logging in with ARM account](https://www.arm.gov/capabilities/computing-resources) and directing Jupyter to a notebook within the cloned repo)"
1112
]
1213
},
1314
{
@@ -32,11 +33,15 @@
3233
"outputs": [],
3334
"source": [
3435
"import sys\n",
35-
"\n",
36-
"if \"google.colab\" in sys.modules:\n",
36+
"import os\n",
37+
"if 'google.colab' in sys.modules:\n",
3738
" !pip --quiet install open-atmos-jupyter-utils\n",
3839
" from open_atmos_jupyter_utils import pip_install_on_colab\n",
39-
" pip_install_on_colab('PyPartMC')"
40+
" pip_install_on_colab('PyPartMC')\n",
41+
"elif 'JUPYTER_IMAGE' in os.environ and '.arm.gov' in os.environ['JUPYTER_IMAGE']:\n",
42+
" !pip --quiet install PyPartMC open-atmos-jupyter-utils\n",
43+
" _pypartmc_path = !pip show PyPartMC | fgrep Location | cut -f2 -d' '\n",
44+
" sys.path.extend(_pypartmc_path if _pypartmc_path[0] not in sys.path else [])"
4045
]
4146
},
4247
{

0 commit comments

Comments
 (0)