Skip to content

Commit

Permalink
clean up the r and python installation
Browse files Browse the repository at this point in the history
  • Loading branch information
eeholmes committed May 24, 2024
1 parent 937b77d commit e857ce1
Show file tree
Hide file tree
Showing 9 changed files with 972 additions and 2,162 deletions.
9 changes: 8 additions & 1 deletion content/01-intro-to-cloud.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ title: Intro the Cloud
---

![](../images/cloud-overview.png)
Today we are working with a JupyterHub in Azure, while the data we are accessing is on AWS us-west-2. This means we cannot really do the lower right option of 'cloud native' computing. If our JupyterHub were on AWS us-west-2, then we could direct connect to the S3 buckets and it would be as if we had downloaded the data. We can effectively "attach" a cloud drive with petabytes of data to our virtual machine.

Today we will be showing how to "stream cloud data without downloads". Because we are on Azure and the data are in S3 us-west-2 buckets, we have to use "https" access. Be aware that *https access without downloads is painfully slow on cloud-ignorant netCDF files*. Of course, downloads of large datasets is also painfully slow. This is one of the reasons why providing cloud-optimized data formats is so important.

JupyterHubs (and virtual machines) can be easily spun up on any cloud provider and computing is cheap (storage is expensive). You do not need to install the compute environments. The common workflow is to run a provided docker image with `docker run`.

---

Lecture on NASA earth data in the cloud by Michele Thornton (NASA Openscapes) [Video](https://www.youtube.com/watch?v=E5Dpeap16hU)

{{< video https://www.youtube.com/watch?v=E5Dpeap16hU width="250" >}}
{{< video https://www.youtube.com/watch?v=E5Dpeap16hU width="400" >}}
7 changes: 5 additions & 2 deletions docs/content/01-intro-to-cloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,12 @@ <h1 class="title">Intro the Cloud</h1>
</header>


<p><img src="../images/cloud-overview.png" class="img-fluid"></p>
<p><img src="../images/cloud-overview.png" class="img-fluid"> Today we are working with a JupyterHub in Azure, while the data we are accessing is on AWS us-west-2. This means we cannot really do the lower right option of ‘cloud native’ computing. If our JupyterHub were on AWS us-west-2, then we could direct connect to the S3 buckets and it would be as if we had downloaded the data. We can effectively “attach” a cloud drive with petabytes of data to our virtual machine.</p>
<p>Today we will be showing how to “stream cloud data without downloads”. Because we are on Azure and the data are in S3 us-west-2 buckets, we have to use “https” access. Be aware that <em>https access without downloads is painfully slow on cloud-ignorant netCDF files</em>. Of course, downloads of large datasets is also painfully slow. This is one of the reasons why providing cloud-optimized data formats is so important.</p>
<p>JupyterHubs (and virtual machines) can be easily spun up on any cloud provider and computing is cheap (storage is expensive). You do not need to install the compute environments. The common workflow is to run a provided docker image with <code>docker run</code>.</p>
<hr>
<p>Lecture on NASA earth data in the cloud by Michele Thornton (NASA Openscapes) <a href="https://www.youtube.com/watch?v=E5Dpeap16hU">Video</a></p>
<div class="quarto-video"><iframe data-external="1" src="https://www.youtube.com/embed/E5Dpeap16hU" width="250" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
<div class="quarto-video"><iframe data-external="1" src="https://www.youtube.com/embed/E5Dpeap16hU" width="400" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>



Expand Down
16 changes: 14 additions & 2 deletions docs/content/02-local-setup-python.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,14 @@
<h2 id="toc-title">On this page</h2>

<ul class="collapse">
<li><a href="#start-the-docker-image" id="toc-start-the-docker-image" class="nav-link active" data-scroll-target="#start-the-docker-image">Start the docker image</a></li>
<li><a href="#running-from-google-colab" id="toc-running-from-google-colab" class="nav-link active" data-scroll-target="#running-from-google-colab">Running from Google Colab</a></li>
<li><a href="#running-from-a-docker-file" id="toc-running-from-a-docker-file" class="nav-link" data-scroll-target="#running-from-a-docker-file">Running from a Docker file</a>
<ul class="collapse">
<li><a href="#start-the-docker-image" id="toc-start-the-docker-image" class="nav-link" data-scroll-target="#start-the-docker-image">Start the docker image</a></li>
<li><a href="#clone-the-tutorials" id="toc-clone-the-tutorials" class="nav-link" data-scroll-target="#clone-the-tutorials">Clone the tutorials</a></li>
<li><a href="#running-r" id="toc-running-r" class="nav-link" data-scroll-target="#running-r">Running R</a></li>
<li><a href="#connect-your-local-files-to-image" id="toc-connect-your-local-files-to-image" class="nav-link" data-scroll-target="#connect-your-local-files-to-image">Connect your local files to image</a></li>
</ul></li>
</ul>
<div class="toc-actions"><ul class="collapse"><li><a href="https://github.com/nmfs-opensci/EDMW-EarthData-Workshop-2024/edit/main/content/02-local-setup-python.qmd" class="toc-action"><i class="bi bi-github"></i>Edit this page</a></li><li><a href="https://github.com/nmfs-opensci/EDMW-EarthData-Workshop-2024/issues/new" class="toc-action"><i class="bi empty"></i>Report an issue</a></li><li><a href="https://github.com/nmfs-opensci/EDMW-EarthData-Workshop-2024/blob/main/content/02-local-setup-python.qmd" class="toc-action"><i class="bi empty"></i>View source</a></li></ul></div></nav>
</div>
Expand Down Expand Up @@ -424,7 +428,14 @@ <h1 class="title">Setting up on your computer - Python users</h1>
</header>


<p>The easiest way to run the Python tutorials locally is to use the Docker container <code>py-rocket-geospatial</code>; this is the environment that is being used in the JupyterHub. You’ll need containerization software such as <a href="https://www.docker.com/products/docker-desktop/">Docker Desktop</a> or <a href="https://podman.io/">Podman</a> installed.</p>
<section id="running-from-google-colab" class="level1">
<h1>Running from Google Colab</h1>
<p>The standard <a href="https://colab.research.google.com/">Google Colab</a> has most of the packages you will need. For most of the tutorials, you only need to install <code>earthaccess</code> with</p>
<p><code>!pip install earthaccess</code></p>
</section>
<section id="running-from-a-docker-file" class="level1">
<h1>Running from a Docker file</h1>
<p>The easiest way to run the Python tutorials locally is to use the Docker container <code>py-rocket-geospatial</code>; this has JupyterLab and the conda environment that is being used in the JupyterHub. You’ll need containerization software such as <a href="https://www.docker.com/products/docker-desktop/">Docker Desktop</a> or <a href="https://podman.io/">Podman</a> installed.</p>
<section id="start-the-docker-image" class="level2">
<h2 class="anchored" data-anchor-id="start-the-docker-image">Start the docker image</h2>
<p>Make sure Docker or Podman is running (open the Desktop application), then run the container:</p>
Expand Down Expand Up @@ -467,6 +478,7 @@ <h2 class="anchored" data-anchor-id="connect-your-local-files-to-image">Connect
<div class="sourceCode" id="cb5"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">docker</span> run <span class="at">-p</span> 8888:8888 <span class="at">-v</span> /<span class="va">$(</span><span class="bu">pwd</span><span class="va">)</span>:/home/jovyan/ ghcr.io/nmfs-opensci/container-images/py-rocket-geospatial:latest</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>


</section>
</section>

</main> <!-- /main -->
Expand Down
39 changes: 30 additions & 9 deletions docs/content/02-local-setup-r.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,14 @@
<h2 id="toc-title">On this page</h2>

<ul class="collapse">
<li><a href="#start-the-docker-image" id="toc-start-the-docker-image" class="nav-link active" data-scroll-target="#start-the-docker-image">Start the docker image</a></li>
<li><a href="#running-locally" id="toc-running-locally" class="nav-link active" data-scroll-target="#running-locally">Running locally</a></li>
<li><a href="#running-from-posit-cloud" id="toc-running-from-posit-cloud" class="nav-link" data-scroll-target="#running-from-posit-cloud">Running from Posit Cloud</a></li>
<li><a href="#running-from-a-docker-file" id="toc-running-from-a-docker-file" class="nav-link" data-scroll-target="#running-from-a-docker-file">Running from a Docker file</a>
<ul class="collapse">
<li><a href="#start-the-docker-image" id="toc-start-the-docker-image" class="nav-link" data-scroll-target="#start-the-docker-image">Start the docker image</a></li>
<li><a href="#clone-the-tutorials" id="toc-clone-the-tutorials" class="nav-link" data-scroll-target="#clone-the-tutorials">Clone the tutorials</a></li>
<li><a href="#connect-your-local-files-to-image" id="toc-connect-your-local-files-to-image" class="nav-link" data-scroll-target="#connect-your-local-files-to-image">Connect your local files to image</a></li>
</ul></li>
</ul>
<div class="toc-actions"><ul class="collapse"><li><a href="https://github.com/nmfs-opensci/EDMW-EarthData-Workshop-2024/edit/main/content/02-local-setup-r.qmd" class="toc-action"><i class="bi bi-github"></i>Edit this page</a></li><li><a href="https://github.com/nmfs-opensci/EDMW-EarthData-Workshop-2024/issues/new" class="toc-action"><i class="bi empty"></i>Report an issue</a></li><li><a href="https://github.com/nmfs-opensci/EDMW-EarthData-Workshop-2024/blob/main/content/02-local-setup-r.qmd" class="toc-action"><i class="bi empty"></i>View source</a></li></ul></div></nav>
</div>
Expand Down Expand Up @@ -423,14 +428,29 @@ <h1 class="title">Setting up on your computer - R users</h1>
</header>


<p>The easiest way to run the R tutorials locally is to use the Docker container <code>py-rocket-geospatial</code>; this is the environment that is being used in the JupyterHub. You’ll need containerization software such as <a href="https://www.docker.com/products/docker-desktop/">Docker Desktop</a> or <a href="https://podman.io/">Podman</a> installed.</p>
<section id="running-locally" class="level1">
<h1>Running locally</h1>
<p>If you are set up locally to run R and have tidyverse installed, then for most of the tutorials, you only need to install <code>earthdatalogin</code> and <code>terra</code> with</p>
<pre><code>devtools::install_github("boettiger-lab/earthdatalogin")
install.packages("terra")</code></pre>
<p>RStudio should alert you if there are other packages that you need to install.</p>
</section>
<section id="running-from-posit-cloud" class="level1">
<h1>Running from Posit Cloud</h1>
<p>The standard <a href="https://posit.cloud/">Posit Cloud</a> has most of the packages you will need. For most of the tutorials, you only need to install <code>earthdatalogin</code> and <code>terra</code> with</p>
<pre><code>devtools::install_github("boettiger-lab/earthdatalogin")
install.packages("terra")</code></pre>
</section>
<section id="running-from-a-docker-file" class="level1">
<h1>Running from a Docker file</h1>
<p>If you don’t have RStudio or R installed, the easiest way to run the R tutorials locally is to use the Docker container <code>py-rocket-geospatial</code>; this is the environment that is being used in the JupyterHub. You’ll need containerization software such as <a href="https://www.docker.com/products/docker-desktop/">Docker Desktop</a> or <a href="https://podman.io/">Podman</a> installed.</p>
<section id="start-the-docker-image" class="level2">
<h2 class="anchored" data-anchor-id="start-the-docker-image">Start the docker image</h2>
<p>Make sure Docker or Podman is running (open the Desktop application), then run the container:</p>
<p>Windows, Linux or Intel-chip Mac:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">docker</span> run <span class="at">-p</span> 8888:8888 <span class="at">--cap-add</span> SYS_PTRACE <span class="at">--security-opt</span> seccomp=unconfined ghcr.io/nmfs-opensci/container-images/py-rocket-geospatial:latest</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="sourceCode" id="cb3"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">docker</span> run <span class="at">-p</span> 8888:8888 <span class="at">--cap-add</span> SYS_PTRACE <span class="at">--security-opt</span> seccomp=unconfined ghcr.io/nmfs-opensci/container-images/py-rocket-geospatial:latest</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>Apple-chip Mac (probably will not work):</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">docker</span> run <span class="at">-p</span> 8888:8888 <span class="at">--platform</span> linux/amd64 <span class="at">--cap-add</span> SYS_PTRACE <span class="at">--security-opt</span> seccomp=unconfined ghcr.io/nmfs-opensci/container-images/py-rocket-geospatial:latest</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="sourceCode" id="cb4"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">docker</span> run <span class="at">-p</span> 8888:8888 <span class="at">--platform</span> linux/amd64 <span class="at">--cap-add</span> SYS_PTRACE <span class="at">--security-opt</span> seccomp=unconfined ghcr.io/nmfs-opensci/container-images/py-rocket-geospatial:latest</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
Expand All @@ -449,19 +469,20 @@ <h2 class="anchored" data-anchor-id="start-the-docker-image">Start the docker im
<section id="clone-the-tutorials" class="level2">
<h2 class="anchored" data-anchor-id="clone-the-tutorials">Clone the tutorials</h2>
<p>Clone and then cd into the repo. Open a terminal and run</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> ~</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="fu">git</span> clone https://github.com/nmfs-opensci/EDMW-3B-tutorials</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="sourceCode" id="cb5"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> ~</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="fu">git</span> clone https://github.com/nmfs-opensci/EDMW-3B-tutorials</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>The Python tutorials are in the <code>tutorials/python</code> directory.</p>
</section>
<section id="connect-your-local-files-to-image" class="level2">
<h2 class="anchored" data-anchor-id="connect-your-local-files-to-image">Connect your local files to image</h2>
<p>Clone and then cd into the repo. Open a terminal and run</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">git</span> clone https://github.com/nmfs-opensci/EDMW-3B-tutorials</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> EDMW-3B-tutorials</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="sourceCode" id="cb6"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">git</span> clone https://github.com/nmfs-opensci/EDMW-3B-tutorials</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> EDMW-3B-tutorials</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>Windows, Linux or Intel-chip Mac:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">docker</span> run <span class="at">-p</span> 8888:8888 <span class="at">--cap-add</span> SYS_PTRACE <span class="at">--security-opt</span> seccomp=unconfined <span class="at">-v</span> /<span class="va">$(</span><span class="bu">pwd</span><span class="va">)</span>:/home/jovyan/ ghcr.io/nmfs-opensci/container-images/py-rocket-geospatial:latest</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="sourceCode" id="cb7"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">docker</span> run <span class="at">-p</span> 8888:8888 <span class="at">--cap-add</span> SYS_PTRACE <span class="at">--security-opt</span> seccomp=unconfined <span class="at">-v</span> /<span class="va">$(</span><span class="bu">pwd</span><span class="va">)</span>:/home/jovyan/ ghcr.io/nmfs-opensci/container-images/py-rocket-geospatial:latest</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>


</section>
</section>

</main> <!-- /main -->
Expand Down
Loading

0 comments on commit e857ce1

Please sign in to comment.