Skip to content

Commit b1a1ab1

Browse files
authored
Merge pull request #5 from ProjectPythia/main
[pull] main from ProjectPythia:main
2 parents c23ec22 + ec613c6 commit b1a1ab1

26 files changed

+270
-730
lines changed

.github/workflows/nightly-build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
if: ${{ github.repository_owner == 'ProjectPythia' }}
1111
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main
1212
with:
13-
environment_name: dask-cookbook-dev
13+
environment_name: dask-cookbook
1414

1515
link-check:
1616
if: ${{ github.repository_owner == 'ProjectPythia' }}

.github/workflows/publish-book.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
build:
1212
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main
1313
with:
14-
environment_name: dask-cookbook-dev
14+
environment_name: dask-cookbook
1515

1616
deploy:
1717
needs: build

.github/workflows/trigger-book-build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ jobs:
66
build:
77
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main
88
with:
9-
environment_name: dask-cookbook-dev
9+
environment_name: dask-cookbook
1010
artifact_name: book-zip-${{ github.event.number }}
1111
# Other input options are possible, see ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,6 @@ dmypy.json
128128

129129
# Pyre type checker
130130
.pyre/
131+
132+
# data
133+
/data

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
<img src="notebooks/images/NCAR_CISL_NSF_banner.jpeg" alt="NCAR CISL logo" />
2-
3-
# NCAR Dask Tutorial
1+
# Dask Cookbook
42

53
[![nightly-build](https://github.com/ProjectPythia/cookbook-template/actions/workflows/nightly-build.yaml/badge.svg)](https://github.com/ProjectPythia/cookbook-template/actions/workflows/nightly-build.yaml)
64
[![Binder](https://mybinder.org/badge_logo.svg)](http://binder.projectpythia.org/v2/gh/ProjectPythia/dask-cookbook/main?labpath=notebooks)
@@ -25,17 +23,21 @@ The motivation behind this repository is to provide a clear and concise resource
2523
<a href="https://github.com/benkirk/demo_containers/graphs/contributors">
2624
<img src="https://contrib.rocks/image?repo=benkirk/demo_containers" />
2725
</a>
26+
<a href="https://github.com/ProjectPythia/dask-cookbook/graphs/contributors">
27+
<img src="https://contrib.rocks/image?repo=ProjectPythia/dask-cookbook" />
28+
</a>
2829

2930
## Note on Content Origin
3031

31-
This cookbook is part of the extensive material used in our NCAR tutorial, ["Using Dask on HPC systems"](https://github.com/NCAR/dask-tutorial.git), which was held in February 2023. The complete tutorial series also includes an in-depth exploration and practical use cases of Dask on HPC systems and best practices for Dask on HPC . For the complete set of materials, including these additional insights on Dask on HPC, please refer to the main tutorial content available [here](https://ncar.github.io/dask-tutorial/README.html).
32+
This cookbook is derived from the extensive material used in the NCAR tutorial, ["Using Dask on HPC systems"](https://github.com/NCAR/dask-tutorial.git), which was held in February 2023. The NCAR tutorial series also includes an in-depth exploration and practical use cases of Dask on HPC systems and best practices for Dask on HPC. For the complete set of NCAR tutorial materials, including these additional insights
33+
on Dask on HPC, please refer to the main NCAR tutorial content available [here](https://ncar.github.io/dask-tutorial/README.html).
3234

3335
## Structure
3436

3537
In the first chapter of this cookbook, we provide step-by-step tutorials on the basic concepts of Dask, including Dask arrays and Dask dataframes, which are powerful tools for parallel computing and distributed data processing. We explain the key differences between these Dask data structures and their counterparts in NumPy and Pandas.
3638

3739
In the second chapter of the repository, we move on to more advanced topics, such as distributed computing and Dask+Xarray integration. We provide examples of how to use Dask+Xarray to efficiently work with large, labelled multi-dimensional datasets.
38-
Finally, we will discuss some best practices regarding Dask + Xarray.
40+
Finally, we will discuss some best practices regarding Dask+Xarray.
3941

4042
## Running the Notebooks
4143

@@ -78,7 +80,7 @@ If you are interested in running this material locally on your computer, you wil
7880

7981
```bash
8082
conda env create -f environment.yml
81-
conda activate dask-cookbook-example
83+
conda activate dask-cookbook
8284
```
8385

8486
1. Move into the `notebooks` directory and start up Jupyterlab

_config.yml

+17-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
title: Dask Cookbook
55
author: Negin Sobhani, Brian Vanderwende, Deepak Cherian, and Ben Kirk
66
logo: notebooks/images/logos/pythia_logo-white-rtext.svg
7-
copyright: "2023"
7+
copyright: "2024"
88

99
execute:
1010
# To execute notebooks via a binder instead, replace 'cache' with 'binder'
@@ -14,7 +14,7 @@ execute:
1414

1515
# Add a few extensions to help with parsing content
1616
parse:
17-
myst_enable_extensions: # default extensions to enable in the myst parser. See https://myst-parser.readthedocs.io/en/latest/using/syntax-optional.html
17+
myst_enable_extensions: # default extensions to enable in the myst parser. See https://myst-parser.readthedocs.io/en/stable/using/syntax-optional.html
1818
- amsmath
1919
- colon_fence
2020
- deflist
@@ -33,12 +33,14 @@ sphinx:
3333
html_permalinks_icon: '<i class="fas fa-link"></i>'
3434
html_theme_options:
3535
home_page_in_toc: true
36-
repository_url: https://github.com/negin513/dask-cookbook.git # Online location of your book
36+
repository_url: https://github.com/ProjectPythia/dask-cookbook.git # Online location of your book
3737
repository_branch: main # Which branch of the repository should be used when creating links (optional)
3838
use_issues_button: true
3939
use_repository_button: true
4040
use_edit_page_button: true
41-
google_analytics_id: G-T52X8HNYE8
41+
use_fullscreen_button: true
42+
analytics:
43+
google_analytics_id: G-T52X8HNYE8
4244
github_url: https://github.com/ProjectPythia
4345
twitter_url: https://twitter.com/project_pythia
4446
icon_links:
@@ -47,12 +49,14 @@ sphinx:
4749
icon: fab fa-youtube-square
4850
type: fontawesome
4951
launch_buttons:
50-
binderhub_url: http://binder.mypythia.org
52+
binderhub_url: http://binder.projectpythia.org
5153
notebook_interface: jupyterlab
52-
extra_navbar: |
53-
Theme by <a href="https://projectpythia.org">Project Pythia</a>.<br><br>
54-
All code in Pythia Cookbooks is licensed under Apache 2.0. All other non-code content is licensed under <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons BY 4.0 (CC BY 4.0)</a>.<br><br>
55-
logo_link: https://projectpythia.org
54+
logo:
55+
link: https://projectpythia.org
56+
navbar_start:
57+
- navbar-logo
58+
navbar_end:
59+
- navbar-icon-links
5660
navbar_links:
5761
- name: Home
5862
url: https://projectpythia.org
@@ -65,6 +69,9 @@ sphinx:
6569
- name: Community
6670
url: https://projectpythia.org/index.html#join-us
6771
footer_logos:
68-
NCAR: notebooks/images/logos/NCAR-contemp-logo-blue.svg
72+
NCAR: notebooks/images/logos/NSF-NCAR_Lockup-UCAR-Dark_102523.svg
6973
Unidata: notebooks/images/logos/Unidata_logo_horizontal_1200x300.svg
7074
UAlbany: notebooks/images/logos/UAlbany-A2-logo-purple-gold.svg
75+
footer_start:
76+
- footer-logos
77+
- footer-info

_static/custom.css

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.bd-main .bd-content .bd-article-container {
2+
max-width: 100%; /* default is 60em */
3+
}
4+
.bd-page-width {
5+
max-width: 100%; /* default is 88rem */
6+
}

environment.yml

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: dask-cookbook-dev
1+
name: dask-cookbook
22
channels:
33
- conda-forge
44
- nodefaults
55

66
dependencies:
77
- jupyter-book
8-
- jupyterlab>=3
8+
- jupyterlab >=3
99
- jupyter_server
1010
- cfgrib
1111
- cftime
@@ -22,13 +22,9 @@ dependencies:
2222
- netcdf4
2323
- nodejs
2424
- pandas
25-
- pip
2625
- pre-commit
2726
- pydap
2827
- python-graphviz
29-
- python=3.9
3028
- scipy
31-
- xarray>=2022.3.0
32-
- pip
33-
- pip:
34-
- sphinx-pythia-theme
29+
- sphinx-pythia-theme
30+
- xarray

notebooks/00-dask-overview.ipynb

+12-32
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,18 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "4db5d14d-ee57-4791-9ab7-58cb2ff2cc3b",
5+
"id": "a1ccac1c-5d4e-47dc-9d5e-4f417126df94",
66
"metadata": {},
77
"source": [
8-
"<img src=\"https://raw.githubusercontent.com/NCAR/dask-tutorial/main/images/NCAR-contemp-logo-blue.png\"\n",
9-
" width=\"750px\"\n",
10-
" alt=\"NCAR logo\"\n",
11-
" style=\"vertical-align:middle;margin:30px 0px\"/>\n",
12-
"\n",
8+
"<img src=\"https://docs.dask.org/en/stable/_images/dask_horizontal.svg\"\n",
9+
" width=\"30%\"\n",
10+
" alt=\"Dask logo\"\n",
11+
" align=\"right\"\n",
12+
"/>\n",
1313
"\n",
1414
"# Dask Overview\n",
1515
"\n",
16-
"**ESDS Dask Tutorial | 06 February, 2023** \n",
17-
"\n",
18-
"Negin Sobhani, Brian Vanderwende, Deepak Cherian, Ben Kirk \n",
19-
"Computational & Information Systems Lab (CISL) \n",
20-
21-
"\n",
22-
"\n",
23-
"---------"
24-
]
25-
},
26-
{
27-
"cell_type": "markdown",
28-
"id": "5b6211a0-3762-41a2-8a45-6b19ce32f658",
29-
"metadata": {},
30-
"source": [
31-
"**In this tutorial, you learn:**\n",
16+
"### In this tutorial, you learn:\n",
3217
"\n",
3318
"* What is Dask?\n",
3419
"* Why Dask in Geosciences?\n",
@@ -54,11 +39,6 @@
5439
"\n",
5540
"## What is Dask?\n",
5641
"\n",
57-
"<img src=\"https://raw.githubusercontent.com/NCAR/dask-tutorial/main/images/dask_horizontal.svg\"\n",
58-
" width=\"500px\"\n",
59-
" alt=\"NCAR logo\"\n",
60-
" style=\"vertical-align:middle;margin:30px 0px\"/>\n",
61-
"\n",
6242
"* Dask is an open-source Python library for parallel and distributed computing that scales the existing Python ecosystem.\n",
6343
"\n",
6444
"* Dask was developed to scale Python packages such as Numpy, Pandas, and Xarray to multi-core machines and distributed clusters when datasets exceed memory.\n",
@@ -109,7 +89,7 @@
10989
"\n",
11090
"</ul>\n",
11191
"And keep in mind - all of the above steps improve your code whether you end up using Dask or not!</br></br>\n",
112-
"<img src=\"https://raw.githubusercontent.com/NCAR/dask-tutorial/main/images/dask_twitter.png\"\n",
92+
"<img src=\"https://raw.githubusercontent.com/ProjectPythia/dask-cookbook/main/notebooks/images/dask_twitter.png\"\n",
11393
" width=\"500px\"/>\n",
11494
"\n",
11595
"</div>\n",
@@ -166,11 +146,11 @@
166146
"\n",
167147
"These are very powerfull tools, but it is easy to write something using a delayed function that could be executed faster and more simply using a high-level collection \n",
168148
"\n",
169-
"<img src=\"https://raw.githubusercontent.com/NCAR/dask-tutorial/main/images/high_vs_low_level_coll_analogy.png\"\n",
149+
"<img src=\"https://raw.githubusercontent.com/ProjectPythia/dask-cookbook/main/notebooks/images/high_vs_low_level_coll_analogy.png\"\n",
170150
" width=\"83%\"\n",
171151
" alt=\"Dask Collections\"/>\n",
172152
" \n",
173-
"*Image credit: Anaconda, Inc. and contributors*\n",
153+
"*Image credit: Dask Contributors*\n",
174154
"\n",
175155
"\n",
176156
"### 2. Dynamic Task Scheduling\n",
@@ -190,7 +170,7 @@
190170
" width=\"75%\"\n",
191171
" alt=\"Dask Distributed Cluster\"/>\n",
192172
" \n",
193-
"*Image credit: Anaconda, Inc. and contributors*\n",
173+
"*Image credit: Dask Contributors*\n",
194174
"\n",
195175
"\n",
196176
"We will learn more about Dask Collections and Dynamic Task Scheduling in the next tutorials."
@@ -231,7 +211,7 @@
231211
"name": "python",
232212
"nbconvert_exporter": "python",
233213
"pygments_lexer": "ipython3",
234-
"version": "3.9.16"
214+
"version": "3.9.18"
235215
},
236216
"widgets": {
237217
"application/vnd.jupyter.widget-state+json": {

notebooks/01-dask-array.ipynb

+10-18
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,13 @@
77
"tags": []
88
},
99
"source": [
10-
"<img src=\"https://raw.githubusercontent.com/NCAR/dask-tutorial/main/images/NCAR-contemp-logo-blue.png\"\n",
11-
" width=\"750px\"\n",
12-
" alt=\"NCAR logo\"\n",
13-
" style=\"vertical-align:middle;margin:30px 0px\"/>\n",
10+
"<img src=\"https://docs.dask.org/en/stable/_images/dask_horizontal.svg\"\n",
11+
" width=\"30%\"\n",
12+
" alt=\"Dask logo\"\n",
13+
" align=\"right\"\n",
14+
"/>\n",
1415
"\n",
15-
"# Dask Arrays\n",
16-
"\n",
17-
"**ESDS Dask Tutorial | 06 February, 2023** \n",
18-
"\n",
19-
"Negin Sobhani, Brian Vanderwende, Deepak Cherian, Ben Kirk \n",
20-
"Computational & Information Systems Lab (CISL) \n",
21-
22-
"\n",
23-
"\n",
24-
"---------\n",
16+
"# Dask Array\n",
2517
"\n",
2618
"### In this tutorial, you learn:\n",
2719
"\n",
@@ -31,8 +23,8 @@
3123
"\n",
3224
"**Related Dask Array Documentation**\n",
3325
"\n",
34-
"* [Dask Array documentation](https://docs.dask.org/en/latest/array.html)\n",
35-
"* [Dask Array API](https://docs.dask.org/en/latest/array-api.html)\n",
26+
"* [Dask Array documentation](https://docs.dask.org/en/stable/array.html)\n",
27+
"* [Dask Array API](https://docs.dask.org/en/stable/array-api.html)\n",
3628
"* [Dask Array examples](https://examples.dask.org/array.html)\n",
3729
"\n",
3830
"\n",
@@ -41,7 +33,7 @@
4133
"\n",
4234
"<img src=\"https://docs.dask.org/en/stable/_images/dask-array.svg\" width=\"500px\" style=\"horizontal-align:middle\"/>\n",
4335
"\n",
44-
"*Image credit: Anaconda, Inc. and contributors*\n",
36+
"*Image credit: Dask Contributors*\n",
4537
"\n",
4638
"Dask Array can be used as a drop-in replacement for NumPy arrays, with a similar API and support for a subset of NumPy functions. \n",
4739
"\n",
@@ -1114,7 +1106,7 @@
11141106
"name": "python",
11151107
"nbconvert_exporter": "python",
11161108
"pygments_lexer": "ipython3",
1117-
"version": "3.9.12"
1109+
"version": "3.9.18"
11181110
},
11191111
"widgets": {
11201112
"application/vnd.jupyter.widget-state+json": {

0 commit comments

Comments
 (0)