Skip to content

Commit 11d9a0c

Browse files
author
Ray Bell
committed
setup data in 03
1 parent 3ccaad3 commit 11d9a0c

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

03_array.ipynb

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,29 @@
3636
"* [Array examples](https://examples.dask.org/array.html)"
3737
]
3838
},
39+
{
40+
"cell_type": "markdown",
41+
"metadata": {},
42+
"source": [
43+
"## Create data"
44+
]
45+
},
46+
{
47+
"cell_type": "code",
48+
"execution_count": null,
49+
"metadata": {},
50+
"outputs": [],
51+
"source": [
52+
"%run prep.py -d random"
53+
]
54+
},
55+
{
56+
"cell_type": "markdown",
57+
"metadata": {},
58+
"source": [
59+
"## Setup"
60+
]
61+
},
3962
{
4063
"cell_type": "code",
4164
"execution_count": null,
@@ -67,23 +90,12 @@
6790
"We do exactly this with Python and NumPy in the following example:"
6891
]
6992
},
70-
{
71-
"cell_type": "markdown",
72-
"metadata": {},
73-
"source": [
74-
"**Create random dataset**"
75-
]
76-
},
7793
{
7894
"cell_type": "code",
7995
"execution_count": null,
8096
"metadata": {},
8197
"outputs": [],
8298
"source": [
83-
"# create data if it doesn't already exist\n",
84-
"from prep import random_array\n",
85-
"random_array() \n",
86-
"\n",
8799
"# Load data with h5py\n",
88100
"# this creates a pointer to the data, but does not actually load\n",
89101
"import h5py\n",
@@ -155,15 +167,7 @@
155167
"metadata": {},
156168
"outputs": [],
157169
"source": [
158-
"# Compute the mean of the array"
159-
]
160-
},
161-
{
162-
"cell_type": "code",
163-
"execution_count": null,
164-
"metadata": {},
165-
"outputs": [],
166-
"source": [
170+
"# Compute the mean of the array\n",
167171
"sums = []\n",
168172
"lengths = []\n",
169173
"for i in range(0, 1000000000, 1000000):\n",
@@ -173,7 +177,7 @@
173177
"\n",
174178
"total = sum(sums)\n",
175179
"length = sum(lengths)\n",
176-
"print(total / length)\n"
180+
"print(total / length)"
177181
]
178182
},
179183
{
@@ -510,8 +514,7 @@
510514
"metadata": {},
511515
"outputs": [],
512516
"source": [
513-
"from prep import create_weather # Prep data if it doesn't exist\n",
514-
"create_weather()"
517+
"%run prep.py -d weather"
515518
]
516519
},
517520
{
@@ -637,7 +640,7 @@
637640
},
638641
"outputs": [],
639642
"source": [
640-
"# complete the following\n",
643+
"# complete the following:\n",
641644
"fig = plt.figure(figsize=(16, 8))\n",
642645
"plt.imshow(..., cmap='RdBu_r')"
643646
]
@@ -755,7 +758,7 @@
755758
"\n",
756759
"result = x[:, ::2, ::2]\n",
757760
"\n",
758-
"da.to_zarr(result, os.path.join('data', 'myfile.zarr'), overwrite=True)\n"
761+
"da.to_zarr(result, os.path.join('data', 'myfile.zarr'), overwrite=True)"
759762
]
760763
},
761764
{
@@ -830,7 +833,7 @@
830833
"cell_type": "markdown",
831834
"metadata": {},
832835
"source": [
833-
"Notice that the most time consuming function is `distances`."
836+
"Notice that the most time consuming function is `distances`:"
834837
]
835838
},
836839
{
@@ -973,7 +976,7 @@
973976
"name": "python",
974977
"nbconvert_exporter": "python",
975978
"pygments_lexer": "ipython3",
976-
"version": "3.7.3"
979+
"version": "3.7.6"
977980
}
978981
},
979982
"nbformat": 4,

0 commit comments

Comments
 (0)