Skip to content

Commit 272faa0

Browse files
Update documentation
1 parent 5a5cea4 commit 272faa0

3 files changed

Lines changed: 67 additions & 4 deletions

File tree

_sources/notebooks/xarray_extracting_time_series_multiple.ipynb

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
},
4646
{
4747
"cell_type": "code",
48-
"execution_count": 1,
48+
"execution_count": null,
4949
"id": "6058b268-9e94-416c-9698-4888111c9b10",
5050
"metadata": {
5151
"id": "6058b268-9e94-416c-9698-4888111c9b10"
@@ -54,7 +54,7 @@
5454
"source": [
5555
"%%capture\n",
5656
"if 'google.colab' in str(get_ipython()):\n",
57-
" !pip install rioxarray"
57+
" !pip install rioxarray dask[distributed]"
5858
]
5959
},
6060
{
@@ -79,6 +79,48 @@
7979
"import zipfile"
8080
]
8181
},
82+
{
83+
"cell_type": "markdown",
84+
"id": "81bb22c2",
85+
"metadata": {},
86+
"source": [
87+
"Setup a local Dask cluster. This distributes the computation across multiple workers on your computer."
88+
]
89+
},
90+
{
91+
"cell_type": "code",
92+
"execution_count": null,
93+
"id": "c7a705ac",
94+
"metadata": {},
95+
"outputs": [],
96+
"source": [
97+
"from dask.distributed import Client\n",
98+
"client = Client() # set up local cluster on the machine\n",
99+
"client"
100+
]
101+
},
102+
{
103+
"cell_type": "markdown",
104+
"id": "8bc0a693",
105+
"metadata": {},
106+
"source": [
107+
"If you are running this notebook in Colab, you will need to create and use a proxy URL to see the dashboard running on the local server.\n",
108+
"\n"
109+
]
110+
},
111+
{
112+
"cell_type": "code",
113+
"execution_count": null,
114+
"id": "3733a3ec",
115+
"metadata": {},
116+
"outputs": [],
117+
"source": [
118+
"if 'google.colab' in str(get_ipython()):\n",
119+
" from google.colab import output\n",
120+
" port_to_expose = 8787 # This is the default port for Dask dashboard\n",
121+
" print(output.eval_js(f'google.colab.kernel.proxyPort({port_to_expose})'))"
122+
]
123+
},
82124
{
83125
"cell_type": "code",
84126
"execution_count": 3,

notebooks/xarray_extracting_time_series_multiple.html

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ <h2>Setup and Data Download<a class="headerlink" href="#setup-and-data-download"
506506
<div class="cell_input docutils container">
507507
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="o">%%capture</span>
508508
<span class="k">if</span> <span class="s1">&#39;google.colab&#39;</span> <span class="ow">in</span> <span class="nb">str</span><span class="p">(</span><span class="n">get_ipython</span><span class="p">()):</span>
509-
<span class="err">!</span><span class="n">pip</span> <span class="n">install</span> <span class="n">rioxarray</span>
509+
<span class="err">!</span><span class="n">pip</span> <span class="n">install</span> <span class="n">rioxarray</span> <span class="n">dask</span><span class="p">[</span><span class="n">distributed</span><span class="p">]</span>
510510
</pre></div>
511511
</div>
512512
</div>
@@ -528,6 +528,27 @@ <h2>Setup and Data Download<a class="headerlink" href="#setup-and-data-download"
528528
</div>
529529
</div>
530530
</div>
531+
<p>Setup a local Dask cluster. This distributes the computation across multiple workers on your computer.</p>
532+
<div class="cell docutils container">
533+
<div class="cell_input docutils container">
534+
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">dask.distributed</span><span class="w"> </span><span class="kn">import</span> <span class="n">Client</span>
535+
<span class="n">client</span> <span class="o">=</span> <span class="n">Client</span><span class="p">()</span> <span class="c1"># set up local cluster on the machine</span>
536+
<span class="n">client</span>
537+
</pre></div>
538+
</div>
539+
</div>
540+
</div>
541+
<p>If you are running this notebook in Colab, you will need to create and use a proxy URL to see the dashboard running on the local server.</p>
542+
<div class="cell docutils container">
543+
<div class="cell_input docutils container">
544+
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="s1">&#39;google.colab&#39;</span> <span class="ow">in</span> <span class="nb">str</span><span class="p">(</span><span class="n">get_ipython</span><span class="p">()):</span>
545+
<span class="kn">from</span><span class="w"> </span><span class="nn">google.colab</span><span class="w"> </span><span class="kn">import</span> <span class="n">output</span>
546+
<span class="n">port_to_expose</span> <span class="o">=</span> <span class="mi">8787</span> <span class="c1"># This is the default port for Dask dashboard</span>
547+
<span class="nb">print</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">eval_js</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;google.colab.kernel.proxyPort(</span><span class="si">{</span><span class="n">port_to_expose</span><span class="si">}</span><span class="s1">)&#39;</span><span class="p">))</span>
548+
</pre></div>
549+
</div>
550+
</div>
551+
</div>
531552
<div class="cell docutils container">
532553
<div class="cell_input docutils container">
533554
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">data_folder</span> <span class="o">=</span> <span class="s1">&#39;data&#39;</span>

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)