Unidata Developer's BlogUnidata Developer's Bloghttps://www.unidata.ucar.edu/blogs/developer/en/feed/entries/atom2024-03-18T20:14:52-06:00Apache Rollerhttps://www.unidata.ucar.edu/blogs/developer/entry/metpy-mondays-290-calculating-andMetPy Mondays #290 - Calculating and Plotting Height Changes from the GFSJohn Leeman2023-06-26T17:25:46-06:002023-06-26T17:25:46-06:00<p>Sometimes it is really helpful to look at forecast height changes when predicting the movement of pressure systems and this week we'll show you how to do it in Python! Read data from the current GFS forecast and make a map in under 20 minutes!</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/uZIC8nAxSzY" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
https://www.unidata.ucar.edu/blogs/developer/entry/unidata-s-cloudidvUnidata's CloudIDVwfisher2015-11-20T09:20:12-07:002015-11-20T09:20:12-07:00<p>Unidata has developed a version of the IDV dubbed “CloudIDV.” CloudIDV is designed for application streaming, allowing an instance of the IDV to be accessed via tablet, mobile phone, or even via a browser. These features are enabled through a fairly new technology called <em>containerization</em>. There are several containerization technologies in use; for CloudIDV we are using <a href="http://docker.com/">Docker</a>.</p>
<p><link rel='stylesheet' type='text/css' href='/css/jquery/jquery.lightbox-0.5.css' media='screen' /></p>
<script type='text/javascript' src='/js/jquery/jquery.lightbox-0.5.min.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
$('a.lightbox').lightBox();
});
</script>
<div class='img_l' style='width: 200px;'>
<a class='lightbox' title='The IDV running in a Docker container, with a fully-interactive display in a web browser' href='/blog_content/images/2015/20151118_cloudIDV_windows.png'>
<img width='200' src='/blog_content/images/2015/20151118_cloudIDV_windows.png' alt='cloudIDV'/>
</a>
<div class='caption'>
A fully-interactive IDV in a web browser.<br/>(Click to enlarge.)
</div>
</div>
<p>'Future-Proofing' software is a common headache for software engineers and programmers. It is a resource-intensive process, and can only realistically accommodate slow, expected changes in computing technology. Sudden changes, such as the rise of tablet computing, can leave development teams scrambling to adapt their existing software for these new environments. Data analysis and visualization programs are particularly vulnerable to this problem, due in part to their inherent dependency on specialized hardware and computing environments. So, how can a developer bring a project to new platforms easily, without expending a lot of resources? The answer to this, as with so many other current technology problems, lies in <em>cloud computing</em>. </p>
<p>Cloud computing benefits different types of software in different ways. For example, server-based software might benefit from the <em>elasticity</em> of cloud computing environments. Analysis and visualization programs, on the other hand, might benefit from being data-proximate. How does moving a desktop application to the cloud solve the future-proofing problem? Essentially, the program runs on a server in the cloud rather than on a local computer, and is accessed using an interactive client — which might be a desktop application, a native app on a hand-held device, or a web app. This approach is often referred to as <em>Application Streaming</em>. </p>
<p>Enabled largely by the rapid rise and adoption of cloud computing platforms, application streaming technologies allow legacy software programs to be operated wholly from a client device (be it laptop, tablet, or smartphone) while retaining full functionality and interactivity. It mitigates much of the developer effort required by other more traditional methods of porting software from one environment to another, reducing the time it takes to bring the software to a new platform.</p>
<p>Unidata's Integrated Data Viewer (IDV) presented itself as a prime candidate for the application streaming treatment. To this end, we have developed a version of the IDV dubbed “CloudIDV.” CloudIDV is designed for application streaming, allowing an instance of the IDV to be accessed via tablet, mobile phone, or even via a browser. These features are enabled through a fairly new technology called <em>containerization</em>. There are several containerization technologies in use; for CloudIDV we are using <a href="http://docker.com/">Docker</a>.</p>
<p>In this article we will provide a brief overview of application streaming, with a focused discussion of the containerization technology which enables it. We will then discuss how to download and run CloudIDV in a local computing environment, and we will finally end with a discussion of the future of cloud-enabled software.</p>
<h2>Application Streaming</h2>
<p>Application streaming is a way to run software remotely but have it appear as though it were running locally. In a way, Application Streaming is an extension of more common media streaming services such as Netflix or Spotify. Whereas these services are largely one-way, however, application streaming provides a fully interactive environment.</p>
<p>Application streaming typically involves several components. </p>
<ol>
<li>A server to run the software. This includes the software itself and all the various software packages upon which it depends. The server may be a remote Virtual Machine (VM) instance in the cloud, or a physical server on a local network. <br /></li>
<li>Software to enable remote viewing and interaction. <br /></li>
<li>A client program which allows for viewing and interacting with the remote software. <br /></li>
</ol>
<p>The CloudIDV project makes use of many technologies to satisfy these requirements. The server includes a full IDV + Java installation, a linux-based windowed environment (X11) and a virtual frame buffer (xvfb) to allow for 3D visualization. There is also remote visualization software (vnc), as well as support software to allow for access through a web browser (noVNC). </p>
<p>Installing, configuring and maintaining this environment manually would quickly become a cumbersome chore for anybody who simply wants to use the IDV on their tablet computer. It can also be difficult to automate the process of deploying new instances (or cleaning up existing ones) on demand. This is where the benefits of containerization become fully apparent.</p>
<h2>Docker</h2>
<p>Using Docker, we are able to combine many of these individual technologies into a single monolithic <em>container</em>. This makes using CloudIDV a much more straightforward process. First, let’s examine Docker, what it is, and provide some resources for installing and using it.</p>
<p>Docker, as previously described, is a <em>containerization</em> technology. It is used create a self-contained, sandboxed environment (called an <em>image</em>)</p>
<table>
<thead>
<tr>
<th style='text-align:center'>Figure 1: CloudIDV Image Architecture</th>
</tr>
</thead>
<tbody>
<tr>
<td style='text-align:center'><img src='https://www.unidata.ucar.edu/blog_content/images/2015/20151119_cloudidv.png' width=250></td>
<td></td>
</tr>
<tr>
<td style='text-align:center'>The CloudIDV Docker image contains the standard IDV as well as all of the technology required to run it in the cloud, viewable via a web browser.</td>
<td></td>
</tr>
</tbody>
</table>
<p>So, what does Docker gain us? While it is possible to wholly duplicate the CloudIDV environment without Docker, doing so would require installing and configuring each of the above technologies for every environment or server on which you would want to run it! In a best-case scenario, this would merely be cumbersome and tedious. More likely, it would require the assistance of an IT administrator and, depending on the IT policies in place, may not be possible at all. </p>
<p>Fortunately, there is no need to duplicate this environment, as Unidata has already done it for you!</p>
<h2>Installing Docker</h2>
<p>Installing Docker is largely left as an exercise to the reader. Docker is available for Linux, OSX and Windows, although it requires a 64-bit operating system. Because Docker is a linux-native technology, the OSX and Windows versions incorporate the use of a Virtual Machine, handled transparently by the <code>docker</code> and <code>docker-machine</code> command-line tools. The Docker team has created comprehensive instructions for installing and using Docker, available from <a href="http://docs.docker.com">http://docs.docker.com.</a></p>
<ul>
<li>Linux Instructions: <a href="http://docs.docker.com/engine/installation/">http://docs.docker.com/engine/installation/</a></li>
<li>OSX Instructions: <a href="http://docs.docker.com/engine/installation/mac/">http://docs.docker.com/engine/installation/mac/</a></li>
<li>Windows Instructions: <a href="https://docs.docker.com/engine/installation/windows/">https://docs.docker.com/engine/installation/windows/</a></li>
</ul>
<p>If you are new to Docker, we suggest that after installation the software you run Docker’s “Hello World” container to verify that everything is working correctly. Instructions on how to do this are included on the pages listed above.</p>
<h2>CloudIDV</h2>
<p>Armed with this understanding of Docker and containerization, let us now examine CloudIDV. As we see in figure 1, CloudIDV relies on many different technologies running in concert. Because they exist in a single Docker <em>image</em>, a CloudIDV user can rely on the fact that these technologies are all present and have been properly configured to interact with each other. And because of the sandboxed nature of Docker, a user can rely on being able to run <em>multiple</em> instances of CloudIDV simultaneously. </p>
<p>So, how does one run the CloudIDV? It is simple, but before you are run CloudIDV, the appropriate Docker image must be downloaded. This image is identified by Docker as <strong>unidata/cloudidv</strong>, and is available from DockerHub, Docker's repository for images. From the Docker documentation found at <a href="https://docs.docker.com/docker-hub:">https://docs.docker.com/docker-hub:</a> </p>
<p class='quote'>The Docker Hub is a cloud-based registry service for building and shipping application or service containers. It provides a centralized resource for container image discovery, distribution and change management, user and team collaboration, and workflow automation throughout the development pipeline. </p>
<p>In plain english, this is a place for individuals and organizations like Unidata to store their Docker images. When Docker tries to run an image, it will look for a copy. If the image is not found locally, Docker will automatically retrieve it from DockerHub. This removal of the explicit download/installation step for individual images simplifies the entire process of using Docker even further. Additionally, DockerHub provides a place for image maintainers to provide documentation specific to their project. The CloudIDV Docker Hub repository can be viewed at <a href="https://hub.docker.com/r/unidata/cloudidv/">https://hub.docker.com/r/unidata/cloudidv/. </a> </p>
<p>CloudIDV is started with the following command: </p>
<pre><code>$ docker run -d -p 6080:6080 -it unidata/cloudidv
</code></pre>
<p>Using CloudIDV is very straightforward. Rather than require a separate viewing program, the running CloudIDV image is accessed via a web browser.</p>
<h2>Connecting to your CloudIDV session.</h2>
<p>In order to connect to the running CloudIDV session, you will need two pieces of information; the <em>IP address</em> of the Docker server and the <em>port</em> you must connect to. Determining the port is straightforward; we specified it when we ran the container using the <code>-P</code> flag to the <code>docker</code> command (we are using port 6080). Determining the IP address is also straightforward, but the exact method will depend on your operating system; see table 1. </p>
<table class='simple'>
<colgroup>
<col style='text-align:center;'>
<col style='text-align:center;'>
<col style='text-align:center;'>
</colgroup>
<thead>
<tr>
<th style='text-align:center;' colspan='3'>Table 1: Determining the appropriate IP address</th>
</tr>
</thead>
<tbody>
<tr>
<td style='text-align:center;'><strong>Linux</strong></td>
<td style='text-align:center;'><strong>OSX</strong></td>
<td style='text-align:center;'><strong>Windows</strong></td>
</tr>
<tr>
<td style='text-align:center;'><em>No action required</em></td>
<td style='text-align:center;'><code>$ docker-machine ip default</code></td>
<td style='text-align:center;'>Launch <code>Windows Quickstart Terminal</code></td>
</tr>
<tr>
<td style='text-align:center;'><strong>127.0.0.1</strong></td>
<td style='text-align:center;'><img src='https://www.unidata.ucar.edu/blog_content/images/2015/20151119_docker-machine-ip.png' width='400'></td>
<td style='text-align:center;'><img src='https://www.unidata.ucar.edu/blog_content/images/2015/20151119_docker-quickstart-terminal.png' width='300'></td>
</tr>
<tr>
<td style='text-align:center;padding-left:2em;padding-right:2em;' colspan='3'>This table shows the various methods for determining the appropriate IP address you will need to connect to in your web browser. Note that, for linux, it is very straight forward; it will be a fixed address. For Windows and OSX, there is an additional step, although it is still an easy process. It is helpful to remember that the <strong>default</strong> docker IP address for non-linux machines is <strong>192.168.99.100</strong>. This will typically only change via advanced docker usage.</td>
</tr>
</tbody>
</table>
<p>Once you know the appropriate IP, you will enter the following in your web browser address bar: </p>
<ul>
<li><code>http://<IP>:6080</code> <br /></li>
</ul>
<p>After loading this address, you will see your CloudIDV instance running in the browser via Docker, as illustrated in figure 2.</p>
<table style='width:520px;margin:auto;'>
<colgroup>
<col style='text-align:center;'>
</colgroup>
<thead>
<tr>
<th style='text-align:center;'>Figure 2: Accessing CloudIDV</th>
</tr>
</thead>
<tbody>
<tr>
<td style='text-align:center;'><img width='500px' src='https://www.unidata.ucar.edu/blog_content/images/2015/20151119_idv_chrome.png'></td>
</tr>
<tr>
<td style='text-align:center;padding-left:2em;padding-right:2em;'>This figure illustrates how a CloudIDV session looks when run in the browser. It is fully interactive.</td>
</tr>
</tbody>
</table>
<h2>In Conclusion</h2>
<p>In this article we have introduced <em>CloudIDV</em>, a version of Unidata's IDV for use on new computing platforms. We've also discussed the technology that makes CloudIDV possible, <em>Docker</em>. Finally, we've provided an overview of a strategy for bringing traditional desktop applications to new computing platforms, <em>application streaming</em>. These technologies provide an exciting look into how software and services are evolving to meet the emerging cloud. The end result is a new method of writing, deploying and using software which is far removed from traditional local and server-based methods. </p>
<h3>Additional resources</h3>
<ul>
<li>Docker Hub information: <a href="https://docs.docker.com/docker-hub/">https://docs.docker.com/docker-hub/</a> <br /></li>
<li>The Docker user guide: <a href="https://docs.docker.com/userguide/">https://docs.docker.com/userguide/</a> <br /></li>
<li>CloudIDV documentation: <a href="https://hub.docker.com/r/unidata/cloudidv/">https://hub.docker.com/r/unidata/cloudidv/</a></li>
</ul>