Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/build-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: build-env
channels:
- conda-forge
dependencies:
- python
- pip
- jupyter_server
- jupyterlite-core >=0.7
- jupyterlite-xeus >=4.3
- notebook >=7.5
56 changes: 56 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and Deploy

on:
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and all other actions) is outdated, and should use SHA hashes instead of rolling tags.


- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install mamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.8-0'
environment-file: .github/build-environment.yml
cache-environment: true

- name: Build the JupyterLite site
shell: bash -l {0}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should keep the error check

Suggested change
shell: bash -l {0}
shell: bash -e -l {0}

run: |
cp README.md content
jupyter lite build --contents content --output-dir dist

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist

deploy:
needs: build
if: github.ref == 'refs/heads/main'
permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use GitHub Pages, so this deployment is not necessary. You should push the results to the gh-pages branch instead (probably overwriting any existing commit.)

id: deployment
uses: actions/deploy-pages@v4
119 changes: 119 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
*.bundle.*
lib/
node_modules/
.yarn-packages/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# OS X stuff
*.DS_Store

# End of https://www.gitignore.io/api/python

# jupyterlite
*.doit.db
_output

# virtual environment
.venv/
Empty file added .nojekyll
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this added? This branch isn't published on GitHub Pages.

Empty file.
2 changes: 1 addition & 1 deletion MatplotlibExample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
"outputs": [],
"source": [
"dat = np.genfromtxt('data/MOD_LSTD_E_2021-08-29_gs_720x360.CSV', delimiter=',')\n",
"dat = np.where(dat<1000, dat, np.NaN)\n",
"dat = np.where(dat<1000, dat, np.nan)\n",
"dat = dat[::-1, :]\n",
"lon = np.arange(-180.0, 180.1, 0.5)\n",
"lat = np.arange(-90.0, 90.1, 0.5)\n",
Expand Down
2 changes: 1 addition & 1 deletion MatplotlibExample.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Matplotlib can also plot two-dimensional data as in this example of land surface

```python
dat = np.genfromtxt('data/MOD_LSTD_E_2021-08-29_gs_720x360.CSV', delimiter=',')
dat = np.where(dat<1000, dat, np.NaN)
dat = np.where(dat<1000, dat, np.nan)
dat = dat[::-1, :]
lon = np.arange(-180.0, 180.1, 0.5)
lat = np.arange(-90.0, 90.1, 0.5)
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# mpl-brochure-binder

See binder at https://mybinder.org/v2/gh/matplotlib/mpl-brochure-binder/main?labpath=MatplotlibExample.ipynb
Interactive Matplotlib visualization examples.

Note that we use jupytext to synchronize with a markdown file; if we edit the markdown file, be sure to run jupyterlab with jupytext enabled to get the actual notebook synchronized before committing. (Note not 100% sure this works across different installs, but lets try it and see).
## JupyterLite

Try it in your browser (no installation required):

[![JupyterLite](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://matplotlib.github.io/mpl-brochure-binder/lab/index.html?path=MatplotlibExample.ipynb)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use GitHub Pages URLs; this link is broken.


## Binder

Launch with Binder:

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/matplotlib/mpl-brochure-binder/main?labpath=MatplotlibExample.ipynb)

## Development

We use jupytext to synchronize notebooks with markdown files. If editing the markdown file, be sure to run JupyterLab with jupytext enabled to synchronize the notebook before committing.
6 changes: 3 additions & 3 deletions _PreProcess.ipynb
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we still need these files if you've moved them to content? Or do we even need content?

Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@
" datetime += [np.datetime64(st)] \n",
"datetime = np.asarray(datetime)\n",
"temp = data[:, 9]\n",
"temperature = np.where(temp>-1000, temp, np.NaN)\n",
"temperature = np.where(temp>-1000, temp, np.nan)\n",
"\n",
"solar = data[:, 13]\n",
"solar = np.where(solar>-1000, solar, np.NaN)\n",
"solar = np.where(solar>-1000, solar, np.nan)\n",
"\n",
"\n",
"fig, (ax0, ax1) = plt.subplots(2, 1, sharex=True, constrained_layout=True)\n",
Expand Down Expand Up @@ -249,7 +249,7 @@
"outputs": [],
"source": [
"dat = np.genfromtxt('data/MOD_LSTD_E_2021-08-29_gs_720x360.CSV', delimiter=',')\n",
"dat = np.where(dat<1000, dat, np.NaN)\n",
"dat = np.where(dat<1000, dat, np.nan)\n",
"dat = dat[::-1, :]\n",
"lon = np.arange(0, 360, 0.5)\n",
"lat = np.arange(-90, 90, 0.5)\n"
Expand Down
6 changes: 3 additions & 3 deletions _PreProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ for d, t in zip(date, time):
datetime += [np.datetime64(st)]
datetime = np.asarray(datetime)
temp = data[:, 9]
temperature = np.where(temp>-1000, temp, np.NaN)
temperature = np.where(temp>-1000, temp, np.nan)

solar = data[:, 13]
solar = np.where(solar>-1000, solar, np.NaN)
solar = np.where(solar>-1000, solar, np.nan)


fig, (ax0, ax1) = plt.subplots(2, 1, sharex=True, constrained_layout=True)
Expand Down Expand Up @@ -135,7 +135,7 @@ a = 10

```python
dat = np.genfromtxt('data/MOD_LSTD_E_2021-08-29_gs_720x360.CSV', delimiter=',')
dat = np.where(dat<1000, dat, np.NaN)
dat = np.where(dat<1000, dat, np.nan)
dat = dat[::-1, :]
lon = np.arange(0, 360, 0.5)
lat = np.arange(-90, 90, 0.5)
Expand Down
297 changes: 297 additions & 0 deletions content/MatplotlibExample.ipynb

Large diffs are not rendered by default.

Loading