<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Peter Killick on Medium]]></title>
        <description><![CDATA[Stories by Peter Killick on Medium]]></description>
        <link>https://medium.com/@DPeterK?source=rss-42746d50cf73------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*IltwdzJIj_nZAaYAW9sf6A.jpeg</url>
            <title>Stories by Peter Killick on Medium</title>
            <link>https://medium.com/@DPeterK?source=rss-42746d50cf73------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 04:23:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@DPeterK/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Accelerated Data Science]]></title>
            <link>https://medium.com/informatics-lab/accelerated-data-science-3921975d869a?source=rss-42746d50cf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/3921975d869a</guid>
            <category><![CDATA[m1]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[gpu-computing]]></category>
            <dc:creator><![CDATA[Peter Killick]]></dc:creator>
            <pubDate>Tue, 21 Jun 2022 14:31:46 GMT</pubDate>
            <atom:updated>2022-06-21T14:31:46.628Z</atom:updated>
            <content:encoded><![CDATA[<h4>Data Science and Machine Learning Workloads on an M1 Mac</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/0*DS36obKZ0mMAIQMj.jpg" /><figcaption>Apple’s latest M1 chip versions (excluding the M1 Ultra). Credit: <a href="https://www.apple.com/uk/newsroom/2021/10/introducing-m1-pro-and-m1-max-the-most-powerful-chips-apple-has-ever-built/">apple.com</a></figcaption></figure><h3>A New Order</h3><p>November 2020 saw the announcement of a significant change of direction for Apple: for the <a href="https://www.apple.com/newsroom/2005/06/06Apple-to-Use-Intel-Microprocessors-Beginning-in-2006/">first time in nearly 15 years</a>, the Apple Mac computer would no longer use Intel processors. Intel processors would be replaced by the M1 System on Chip (SoC), developed in-house by Apple and an enhancement on the A-series SoCs that have powered iPhones and iPads for a number of years.</p><h4>Why does this matter?</h4><p>Intel’s x86 microarchitecture is very prevalent across desktop computers, laptops, servers, the Cloud, and HPC (although IBM’s Power microarchitecture is a notable exception in the HPC sphere). ARM’s microarchitecture, meanwhile, is completely ubiquitous in mobile devices. If you own a modern smartphone, it’s almost certain to be running an ARM-architected chip, just manufactured under license by Qualcomm, Samsung, Huawei, MediaTek, Apple (of course), or another chip manufacturer.</p><p>The move by Apple to using the M1 chip for desktop computer applications is much more significant than turning MacBooks into glorified mobile phones, however. The change in microarchitecture from x86 to ARM introduces new uncertainty to the usability of desktop applications. Putting aside the question of the different application installers used by Windows, macOS and Linux, the likelihood was that if you compiled a binary (that is, a program compiled to an executable object) for x86, it would be likely to function on all of these desktop operating systems without trouble.</p><p>The M1 SoC’s ARM microarchitecture upends this comfortable certainty. A different microarchitecture means a different instruction set, which fundamentally means that a binary compiled for x86 will not run on ARM. It’s similar to going into a café in a country where you don’t speak the local language — it’s going to be hard to ask to buy a local delicacy if you and the barista don’t understand each others’ spoken language.</p><figure><img alt="A person makes a purchase in a café." src="https://cdn-images-1.medium.com/max/1024/0*A_FKv5rTHN4T3Fo9" /><figcaption>Better hope they’re both speaking the same language. Photo by <a href="https://unsplash.com/@heftiba?utm_source=medium&amp;utm_medium=referral">Toa Heftiba</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>The Pertinent Questions</h4><p>To get around this, you now require all the programs that you want to use on an M1 to be compiled for ARM microarchitecture as well as x86. The question is, have they been?</p><p>This question recently came to roost in the Informatics Lab as we received our first Macs that use the M1 SoC. The Lab (and indeed the wider Met Office) run a lot of Python-based Data Science and Machine Learning analysis workflows on large n-dimensional gridded weather and climate datasets.</p><p>The pertinent question for the Lab, therefore, is can we run these workflows on an M1 Mac? And if we can, how does the experience compare to running the same workflows on an Intel Mac? We’ll spend the rest of this blog post exploring the answers to these questions.</p><h3>Data Science</h3><p>I’ll handle Data Science as distinct from Machine Learning here and define it as all classical analysis workflows that don’t involve an element of machine-driven learning (unsurprisingly we’ll look at that in the next section on Machine Learning).</p><p>The Lab’s data science workflows typically use common scientific Python packages to load, analyse, visualise and save nD datasets of numerical data describing weather and climate phenomena. These are often provided as CSV or NetCDF files. To do this we use Python libraries such as Jupyter, NumPy, matplotlib, dask, pandas, Iris and cartopy, and Xarray, and their surrounding ecosystems of dependency packages. The simple question I wanted to ask of the M1 Mac in this case is “can I install and use these Python libraries on an M1 Mac?”</p><p>To test this I installed Python and conda via <a href="https://github.com/conda-forge/miniforge">miniforge</a> and went to work setting up environments that contained these different packages. Quite simply, I found that all of these packages installed and functioned without issue on an M1 Mac, so this was an easy and very gratifying conclusion to reach.</p><p>There is no doubt that this state of affairs is on account of the amazing efforts put in by the maintainers — both of the libraries themselves and the package builds of the libraries at conda-forge. Their efforts have ensured that these libraries are all available with either microarchitecture-independent (noarch) package builds, or with builds for multiple different microarchitectures, including x86 and ARM. So, when you install these libraries using conda, it will automatically select the package build that’s best suited to your system, ensuring consistent functionality across all sorts of different systems.</p><h3>Machine Learning</h3><p>For Machine Learning (ML) workflows I wanted to take things beyond the first question of “can I install the libraries?” and explore whether we can also find a computational advantage for using the M1 Intel. There is good reason for hoping that we might: the M1 Pro SoC in our MacBooks Pros contains an 8 core CPU as well as a 14 core GPU and a 16 core Neural Engine. These last two items are both accelerators that can be used to speed up the training of ML models — a GPU handles matrix operations at high speed typically to drive graphical applications, but can just as well be applied to matrix operations in ML applications; and the Apple Neural Engine is a type of Neural Processing Unit (NPU) that’s specifically designed for the sort of operations found in Neural Networks.</p><p>However, just because an accelerator is present doesn’t necessarily mean that you can just use it to accelerate training your ML model. You need to have a mechanism to transfer the training to the accelerator otherwise it will just run on the CPU and you won’t benefit from the presence of the accelerator. This fact turned out to particularly apply to the Apple Neural Engine, which seems to only be accessible when using <a href="https://developer.apple.com/documentation/coreml">Core ML</a>, Apple’s Swift library for running ML models. But as this is written in Swift it’s not a lot of direct use for Python ML libraries, so I didn’t explore this further.</p><p>The GPU on the M1 SoC, however, is accessible via <a href="https://developer.apple.com/metal/">Metal</a>, Apple’s graphical accelerator API. Apple have also written <a href="https://developer.apple.com/metal/tensorflow-plugin/">a TensorFlow plugin</a> for Metal that enables accelerated training of ML models written in TensorFlow using Mac GPUs. It made sense, therefore, to test accelerating ML workflows using ML models built with TensorFlow (PyTorch and XGBoost, for example, only support CUDA-based acceleration on NVIDIA accelerators).</p><h4>The Experiment — TensorFlow</h4><p>Accelerators work best when data volumes are large and the computations being run are complex. This is because there is a computational overhead associated with moving the model and in-memory data from the CPU to the accelerator. If the model and/or data are small, this overhead may be significantly larger than any speed-up gained from running on the accelerator, and the net result is that performance actually decreases for using the accelerator.</p><p>So, to best test for performance improvements for using the GPU in the M1 SoC, we want a complex ML model to be run on large data volumes. Or perhaps better still, we want a series of models (ranging from simple to complex) but all running on the same data, from which we can look for noticeable performance improvements when accelerating the more complex models compared to the simpler models.</p><p>Pleasingly, just such an example can be found in the <a href="https://www.tensorflow.org/tutorials/keras/overfit_and_underfit">Overfitting and Underfitting tutorial</a> in the TensorFlow docs. This demonstrates an important principle in ML model architecture (a complex model doesn’t necessarily produce better results) by running a series of models of increasing complexity against the same large-ish dataset. Or, to put it more simply, this is exactly what we were after. More details about the architectures of the different models and the dataset used can be found at the link above.</p><p>The setup of the experiment was as follows:</p><ul><li>Use six of the models defined in the tutorial linked above (the models named ‘tiny’, ‘medium’, ‘large’, ‘L2’, ‘dropout’ and ‘combined’). Record the wall time taken to train the model and the total number of training epochs required, and find the result value of number of seconds per epoch for the training run.</li><li>Each model was run three times on each hardware platform then the mean result value across the three runs was calculated.</li><li>As Metal allows us to accelerate ML models using any recent Mac with a GPU, we can compare the M1 SoC to the previous generation of Intel+AMD Macs.</li></ul><p>Therefore, the following hardware platforms were used:</p><ul><li>A 14” MacBook Pro 2021 with a M1 Pro SoC with an 8 core CPU, a 14 core GPU and 16GB integrated memory, <em>with and without Metal acceleration.</em></li><li>A 16” MacBook Pro 2019 with an 8 core Intel i9 9880H, an AMD Radeon Pro 5500M 4GB and 32GB system memory, <em>with and without Metal acceleration</em>.</li></ul><p>Thus we had two devices each running with and without Metal-enabled acceleration, providing four platforms in total, on which to run six experiments three times each. To accurately compare different models that ran to a different number of epochs, the data values we chose to record was the time in seconds taken to calculate one training epoch, calculated by dividing the total number of wall-time seconds that the model trained for by the number of epochs taken to train.</p><h4>Results — TensorFlow</h4><p>The graph below shows the average runtime (s) per epoch for each of the six models on each of the four hardware platforms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z_cBFjo1B_JIvwJz" /><figcaption>Line graph showing mean time per epoch for various ML models on different processor microarchitectures.</figcaption></figure><p>The graph demonstrates a number of interesting results:</p><ul><li>The M1 SoC outperforms the Intel processor both with and without Metal acceleration enabled.</li><li>Metal acceleration makes small and medium sized ML models a lot slower to train than without Metal acceleration.</li><li>However, as the models get larger, the difference between Metal acceleration being enabled and not being enabled shrinks for the M1 Mac, and in fact the Intel Mac trains faster for the two largest models with Metal acceleration enabled.</li><li>The performance difference between M1 and Intel gets more pronounced as the ML models get more complex.</li></ul><p>One other result that is not demonstrated in the graph above is the thermal impact of running these experiments, particularly with the most complex models and with Metal acceleration enabled. The M1 Mac became warm to the touch, but at no point did its fans switch on. The Intel Mac, meanwhile, became too hot to touch and its fans were running at maximum — to the extent that some runs showed obvious evidence of thermal throttling.</p><h4>The Experiment — PyTorch</h4><p>PyTorch has just (at time of writing) released support for Metal devices in v1.12. Unlike TensorFlow’s Metal plugin which is provided by Apple, the PyTorch plugin has been provided by the PyTorch community. This means we can run a similar experiment in PyTorch to the experiment we ran in TensorFlow.</p><p>Again we’ll use an example from the documentation to provide a reasonably-sized ML model with which we can test the performance of Metal acceleration. For PyTorch we’ll use this <a href="https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html">transfer learning tutorial</a> and use both the fine-tuning and feature extraction applications. We’ll use the same hardware platforms for PyTorch as were used in the TensorFlow experiment.</p><h4>Results — PyTorch</h4><p>The bar chart below shows the results of running the two applications from the transfer learning tutorial on the Intel and M1 Mac, with and without Metal acceleration enabled. Here we simply recorded the total wall time for each application on each platform and treated these as our results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-YbZ8lMjfaEifA1sE9cVw.png" /><figcaption>Bar chart showing run time (s) for two different ML applications on different processor microarchitectures.</figcaption></figure><p>Again, we see broadly the same pattern as with the TensorFlow experiment — typically the M1 is faster than the Intel Mac, and there is typically limited benefit for using the GPU (if any speed-up at all). The notable exception is with the fine-tuning experiment on the M1 Mac, where a significant speed-up was recorded with the GPU enabled.</p><p>Note that the results for this experiment were recorded a little differently than to the TensorFlow experiment, with total time elapsed for each application recorded rather than time per epoch. Each experiment was also run only once, meaning spurious results will not be averaged out over multiple runs.</p><p>Timing each run allowed us to capture not only wall time (the time between start and end of execution) but also the user process time (the amount of time the CPU spent executing the user process). CPU time for the two applications, with and without GPU acceleration, are shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kNzhuQrMwOLj2CGQz7XTMA.png" /></figure><p>It’s significant that CPU time decreases significantly when the GPU is enabled. This is a direct demonstration that the processing is being offloaded from the CPU to the GPU, so the time the CPU spends running the processing is significantly reduced, even if the overall wall time of the processing (from the previous chart) does not change significantly.</p><h4>Conclusions</h4><p>The results from both these experiments allow us to draw these interesting conclusions:</p><ul><li>There is an evident improvement in training more complex ML models on an Intel Mac with Metal acceleration enabled.</li><li>There is the suggestion of a similar performance improvement on the M1 Mac if the ML model was even more complex.</li><li>The difference in thermal performance between M1 and Intel is quite striking: the M1 is not only faster but also far more thermally efficient than Intel. Indeed this conclusion reflects one of the main reasons that Apple pursued an ARM-based SoC for Mac computers.</li></ul><h3>In Summary</h3><p>This brief exploration of using an M1 SoC for Data Science and Machine Learning workflows has found a number of conclusions that are significant to the applicability of the M1 to these fields:</p><ul><li>We encountered no difficulty with installing and using common Scientific Python libraries for Data Science workflows on an M1 Mac.</li><li>The M1 SoC is faster than Intel in the ML model training experiment that we performed. And the M1 seemed to be faster for the Data Science workflows that I used to test the functionality of scientific Python libraries on the M1 Mac.</li><li>We found that Apple’s Metal API can be effectively used to accelerate training ML models both on M1 and Intel Macs, with a performance gain evident with more complex models on the Intel Mac.</li><li>The M1 SoC is much more thermally efficient than Intel.</li></ul><h4>Next Steps</h4><p>Here are some ideas of where to go to extend this investigation further:</p><ul><li>Data Science workflows felt like they were faster on the M1. We could time these workflows and see if we can prove (or disprove!) this with some numerical results.</li><li>The ML experiment showed that the M1 was always faster without Metal acceleration. It would be interesting to explore how big an ML model we would need for the M1 with Metal acceleration to train faster than without.</li><li>I still want to try and make use of the Neural Engine to accelerate ML workflows. It would be a lot of effort, but it would be interesting to see if we could reproduce the ML model in Swift for Core ML, or even call Core ML from Python somehow and see if we could make use of the Neural Engine.</li><li>Simply out of curiosity it would be interesting to run the ML experiments again but on Colab Pro with a TPU connected, and see just how fast we could go.</li></ul><h3>Appendix</h3><p>In this article we’ve explored how you can speed up training of ML models using the GPU in recent Mac devices via Apple’s Metal API. We’ve shown that this is possible with both TensorFlow and PyTorch. What we haven’t explored is how to actually enable GPU acceleration in either of these libraries! We’ll correct that here; detailing how to install each library with Metal integration enabled, and also how to utilise Metal acceleration in both TensorFlow and PyTorch code.</p><h4>TensorFlow</h4><p>There is a specific build of TensorFlow with Metal acceleration available from Apple, along with <a href="https://developer.apple.com/metal/tensorflow-plugin/">install instructions</a>, which must be followed <em>exactly</em>. This is particularly true on the Intel Mac, where in testing I found that the build of TensorFlow with Metal acceleration was only found by pip when installed in a Python virtualenv — and not in a conda env. The build is only available for Python 3.8.</p><p>To check Metal acceleration is available to TensorFlow:</p><pre>import tensorflow as tf<br>tf.config.list_physical_devices()</pre><p>If you get the following result (or similar, but with a GPU in the list of PhysicalDevices), Metal support has been properly configured for TensorFlow:</p><pre>[PhysicalDevice(name=&#39;/physical_device:CPU:0&#39;, device_type=&#39;CPU&#39;),<br> PhysicalDevice(name=&#39;/physical_device:GPU:0&#39;, device_type=&#39;GPU&#39;)]</pre><p>Note that you do not need to explicitly target the GPU for your workloads— TensorFlow will use it automatically if it is present.</p><h4>PyTorch</h4><p>It’s a lot easier to install PyTorch with Metal acceleration enabled — you just need to install v1.12 or later. At time of writing this requires installing PyTorch from the preview channel, but once PyTorch v1.12 moves out of pre-release this will get simpler again. Details are available in the <a href="https://pytorch.org/get-started/locally/">PyTorch install instructions</a>.</p><p>Conversely, it’s a little more difficult to check Metal acceleration is available in PyTorch applications and then also use it to accelerate training. You can use the following to check if Metal acceleration is available:</p><pre>import torch</pre><pre>mps_built = torch.backends.mps.is_built()<br>mps_avail = torch.backends.mps.is_available()<br>device = &quot;mps&quot; if mps_built &amp; mps_avail else &quot;cpu&quot;</pre><p>Note that PyTorch refers to Metal acceleration as MPS (Metal Performance Shaders). To utilise the MPS device to train a model you can then do something similar to the following, having predefined model:</p><pre>model = model.to(device)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3921975d869a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/informatics-lab/accelerated-data-science-3921975d869a">Accelerated Data Science</a> was originally published in <a href="https://medium.com/informatics-lab">Met Office Informatics Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Metadata Queries]]></title>
            <link>https://medium.com/informatics-lab/metadata-queries-eeb06c1c9e1e?source=rss-42746d50cf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/eeb06c1c9e1e</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[query]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Peter Killick]]></dc:creator>
            <pubDate>Tue, 30 Mar 2021 14:49:51 GMT</pubDate>
            <atom:updated>2021-03-30T14:49:51.756Z</atom:updated>
            <content:encoded><![CDATA[<h4>Another option for user interactions with large datasets</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ln8kNc4WQ6PBIsyI" /><figcaption>Photo by <a href="https://unsplash.com/@amartino20?utm_source=medium&amp;utm_medium=referral">Anthony Martino</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Analysis-ready, cloud-optimised (ARCO) data has become an area of particular interest recently — within the Pangeo community and more widely. The concept of ARCO data reflects that, for large volumes of data stored in the Cloud to be maximally useful to end users, it must be both:</p><ul><li><strong>analysis-ready</strong>; that is, the data can be used for a variety of analysis operations without any processing other than loading the data.</li><li><strong>Cloud-optimised</strong>; or provided in formats, such as <a href="https://zarr.readthedocs.io/en/stable/">Zarr</a> or <a href="https://www.cogeo.org/">CoG</a>, that are designed to work effectively on Cloud data stores. We’ve <a href="https://medium.com/informatics-lab/representing-thousands-of-netcdf-files-using-tiledb-af5865996b93">blogged recently</a> about a few different options Cloud-optimised data storage formats, and what makes them particularly suited for use on the Cloud.</li></ul><p>These attributes of ARCO data mean that users can work with it as provided without first having to expend significant amounts of time making the data usable. In this sense, ARCO data is a good step towards also having FAIR data (<a href="https://www.go-fair.org/fair-principles/">Findable, Accessible, Interoperable and Reusable data</a>) — ARCO data being Accessible, Interoperable and Reusable — and, via new tools like P<a href="https://pangeo-forge.readthedocs.io/en/latest/index.html">angeo-Forge</a>, also Findable as well.</p><p>Often it’s the case that the data attributes of analysis-ready and Cloud-optimised come together. So, for example, hundreds of small files in a legacy format may be able to be combined together to form a single larger dataset. By converting all these files to a single Zarr, we can make one dataset that is analysis-ready (the user doesn’t need to combine the small files before analysing the whole dataset) and Cloud-optimised (the data has been converted from legacy formats to the Cloud-ready Zarr format).</p><h3>Usage Patterns</h3><p>The nature of ARCO data means it lends itself to one particular usage pattern.</p><p>This pattern is that of supersetting to form a single large dataset structure that can be loaded and analysed. This is certainly a useful pattern for many workflows, particularly workflows that operate on large volumes of data such as are provided by whole ARCO datasets. It is not the only usage pattern, however, and other workflows may be better served by different usage patterns, such as those that require a specific or known subset of the ARCO data rather than the whole dataset.</p><p>To demonstrate this, here’s a diagram that shows three conceptual, orthogonal axes of options for interacting with ARCO data. All three axes are familiar, but we’ve only considered the top one in relation to ARCO data so far:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*qpMzz1kpT355r3rg" /><figcaption>Axes of interaction with ARCO data.</figcaption></figure><p>At the centre of this diagram is some “ARCO data”. We don’t know too much about it, and in a sense we don’t need to know too much about it either — from the perspective of the data user, we shouldn’t need to care about how the data is provided, just that it is provided and that we can access and use it without difficulty. For the sake of the example, though, let’s assume that the ARCO data has been provided as a number of individual files, and the data provider has done some work to ensure the files are provided in a cloud-optimised format, and to ensure they’re analysis-ready somehow.</p><p>As we thought about above the diagram, ensuring the files are analysis-ready would typically mean combining them into a single object that can be used for large-scale analysis. This diagram, however, suggests two further patterns by which users of the ARCO data can interact with it. The diagram also includes a secondary vertical axis that indicates whether each pattern tends to provide the user with a superset of all available data, or access to a subset of it. To briefly define these two terms:</p><ul><li><strong>superset:</strong> combining inputs to form single logical entity made up of all the inputs.</li><li><strong>subset:</strong> extracting elements of the inputs based on specified criteria.</li></ul><p>For a more in-depth consideration of these two terms, take a look in the following §On Supersetting and Subsetting. Let’s now explore the three access patterns introduced in the diagram above in a little more detail.</p><h4>Dataset</h4><p>We can take ARCO data and superset it to produce a single dataset that can be easily loaded and analysed. This is particularly suited to bulk analysis patterns that need to operate on large volumes of data.</p><p>For example, we need to find the difference over time between two possible future climate scenarios. To do this we need to load a century of climate forecast data for each scenario, find the spatial mean of each scenario at all timesteps, and finally plot the two resultant datasets together.</p><h4>Catalog</h4><p>We can present all of our ARCO data in a data catalog, such as might be presented by <a href="https://intake.readthedocs.io/en/latest/">Intake</a> or <a href="https://stacspec.org/">STAC</a>. This allows users to get an overview of the contents of the ARCO data from the metadata, so that specific elements of the ARCO data can be selected from the catalog and then loaded and analysed.</p><p>For example, exploring the catalog of the ARCO data could reveal that the data describes global weather forecast data produced by Met Office models; specifically of air temperature, humidity pressure and wind data, for the whole of 2019, on hourly, daily and monthly timescales.</p><h4>Query</h4><p>We can make queries against the metadata of the ARCO data. This allows users to select specific elements of the ARCO data that match a metadata query and analyse these elements only.</p><p>For example, in a dataset containing air quality observations over the UK, the user could submit a query to retrieve all data describing PM2.5 (<a href="https://laqm.defra.gov.uk/public-health/pm25.html">fine particulate matter</a>) measurements within Birmingham in March 2018.</p><h4>Catalog vs. Query</h4><p>The catalog and query access patterns are quite similar. Both provide a route for a data user to explore the data provided and select specific subsets of that data. You could also consider searching the contents of a STAC Catalog to find a specific STAC Item.</p><p>There are some differences between the two patterns as well:</p><ul><li><strong>Catalogues</strong> offer functionality for browsing a dataset to explore its contents before selecting items of interest.</li><li>A <strong>query engine</strong> allows you to select items from a dataset based on specific search terms.</li></ul><p>The idea of querying a dataset based on metadata is not intended as a competitor to catalogues. It is just a demonstration of another option for a data user to utilise to explore and interact with a large dataset. In practice, it may prove easier to catalog some datasets and provide metadata query engines for others. The following §Possible Applications provides some examples of where metadata query engines may prove valuable.</p><h4>Technical Detail</h4><p>Let’s draw the diagram above in a different way, which provides more focus on technical detail. Doing so reinforces the idea that these three usage patterns are effectively three different views, or ways of interacting with the same ARCO data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/0*V74MRx9SDPrVG36q" /><figcaption>A more detailed representation of options for interaction with ARCO data.</figcaption></figure><p>In this stylised example, our ARCO data is composed of six NetCDF (.nc) files, named a — f, and we can interact with this data using all three usage patterns.</p><p>We can take the superset of all the data by combining all the data into a single dataset via a bespoke curation. This bespoke curation could be defined by the data provider, or the dataset could be registered on Pangeo Forge, for example.</p><p>We can also subset the data to only retrieve elements of it. The catalog approach, backed by Intake or STAC, for example, registers all of the files in the ARCO data in the catalog and allows a user to explore all the files via the catalog. Similarly, users could submit metadata queries to a query engine, which would return only matching files from the ARCO data (a.nc and c.nc in this case).</p><p>Note that this also highlights a functionality gap — in the provision of a metadata query engine. The rest of this blog post will focus on producing an implementation of a metadata query engine as an example of this functionality.</p><h4>On Supersetting and Subsetting</h4><p>Let’s take a moment to better define what we mean by supersetting and subsetting. To do this, let’s assume that our ARCO data is made up of hundreds of small files — represented by the six files a.nc — f.nc in the diagram above — that could be combined into a single logical dataset. For example, each file might represent one particular timestep (such as successive hours or days). The logical dataset in this case would have a new dimension for time, with each point along this dimension described by a particular file.</p><p>Taking this example, then, a superset of the ARCO data would combine the files together as described above and provide that as the single logical dataset with a time dimension, ready for analysis without data users first having to combine each file to build the time dimension themselves. On the other side, a subset of the ARCO data would provide the contents of all the individual files that match either to some query criteria, such as all the files that fall within a certain time period; or are certain files selected from browsing a catalog of the dataset.</p><h3>Metadata Query Engine</h3><p>A metadata query engine provides the functionality needed to enable data subsetting based on matches to metadata queries. All metadata pertinent to the data to be queried is stored in a database along with references that allow each metadata item to be related back to the original data item. Or, to put it more tacitly, it’s a typically-functioning database.</p><p>A metadata query engine therefore allows you to select out of a large volume of data only a subset that matches a submitted query. Thus you could select data that describes a certain phenomenon, such as air temperature; or select all data with certain attributes, for example it’s observations data, or was produced by a specific version of a model; or select data that covers a specified spatio-temporal area, such as data from 2018 over London.</p><h4>Overview</h4><p>To demonstrate how a metadata query engine could work, let’s look at one practical example. This example takes a collection of files describing weather and climate data, exports each file’s metadata into a document database, and provides a query client to easily connect to and submit queries against the document database as well as a demonstration notebook. This example explicitly works at the file level — so each file is interrogated for all metadata, which is included, along with the path to the file, in the document database.</p><p>In particular, for this demo implementation:</p><ul><li>The collection of files is the contents of the <a href="https://github.com/SciTools/iris-sample-data">Iris sample data</a> and <a href="https://github.com/SciTools/iris-test-data">Iris test data</a> git repos.</li><li>The document database is provided by <a href="https://www.mongodb.com/cloud/atlas">mongoDB Atlas</a>.</li><li>The code and example notebooks are available in the <a href="https://github.com/informatics-lab/metadatabase">metadatabase git repo</a>.</li></ul><h4>Detail</h4><p>To build a metadata query engine we need both a database of metadata entries linked to files that provided the metadata in each entry, and a mechanism for submitting queries to the database to retrieve matching files. Thus, a query run against the document database finds all metadata matching the query and returns the file path stored in all matching documents. These paths to matching files can then be consumed by downstream functionality.</p><p>The following architectural diagram provides an overview of how the different elements of the metadata query engine connect together, including the functionality of the metadatabase library as an adaptor between weather and climate data and mongoDB:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/0*JYnlKLFqWTfmhXxY" /><figcaption>Architectural diagram of the metadata query engine, including the metadatabase Python library.</figcaption></figure><p>All document database functionality is provided by mongoDB Atlas, mongoDB’s managed Cloud database service. This handles storage of all database documents and executes queries submitted via pymongo. The metadatabase library provides an intermediate layer between weather and climate datasets and mongoDB, handling the conversion of dataset metadata into JSON format and providing a custom interface to query the database, which handles only returning the file paths to matching files.</p><p>The full set of operations, then, is as follows:</p><ol><li>One or more files are passed to metadatabase. These files are loaded as Iris cubes by functionality provided by the CubeToJSON class. Each cube’s metadata is saved to JSON in a standardised format.</li><li>The JSON files are passed to mongoDB Atlas (via a Client method) to be inserted into a specified database and collection.</li><li>Further Client methods wrap mongoDB database read and query functionality, allowing users to make metadata queries against a specified database and collection. These bespoke wrappers provide extra functionality, such as returning query results ready-loaded as Iris cubes.</li></ol><h4>Possible Applications</h4><p>There are some particular situations where having a metadata query engine provided to interact with a large volume of data may prove beneficial.</p><p>The particular use-case this demonstration was put together for is to simplify access to data stored in very large volume <strong>data archives</strong>, such as those attached to institutional data centres. Typically the sheer amount of data stored in these archives is too large and heterogeneous to be able to be represented as a single logical ARCO dataset. The interface to such archives can also be cumbersome, and both of these challenges together make the data stored in these archives neither easily findable or accessible. By building up an index of the contents of all the files in the archive, users can more easily search the contents of the archive by running queries against the metadata query engine to find and extract files of interest from the archive.</p><p>With a little bit of work, a metadata query engine such as the one demonstrated here could be adapted to run queries against a <strong>data lake </strong>/ <strong>data warehouse</strong>. Again, the database would need to maintain an index of the metadata of all the files contained in the data lake, but with that in place, a user could explore and retrieve files from the data lake by running queries against the metadata query engine.</p><p>One more use-case could be querying <strong>ARCO datasets</strong> directly. For example, if a user of an ARCO dataset knew they needed a specific subset of the ARCO dataset described by a few of the original files used to make up the dataset, the user could extract those files and interact with them directly by making queries to the metadata query engine, rather than first loading the entire logical ARCO dataset and extracting from that the specific subset they needed.</p><h4>GUI</h4><p>The final element of this practical example of a metadata query engine demonstrates running metadata queries via a GUI to provide a simple user interface to the metadata database. A preview is shown in the image below, and the original Jupyter notebook used to make the GUI example is included in the <a href="https://github.com/informatics-lab/metadatabase">metadatabase git repo</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k-J_MS3MhakLO58_" /><figcaption>A screengrab of the metadatabase GUI demo.</figcaption></figure><p>The GUI is provided as a Jupyter notebook with embedded IPywidgets providing authenticated access, database and collection selection, and a query field. In the image above the notebook has been served by <a href="https://voila.readthedocs.io/en/stable/index.html">voila</a>. File matches to the query within the database are presented both as the full path to the file, and also as Iris cubes in a cubelist.</p><h4>Limitations</h4><p>Considering this demonstration of a metadata query engine even for a short while will make it clear that it includes a number of inherent limitations. Some of these are simply to keep the complexity low, some may be excusable on account of the intended applications of such a metadata query engine, while still others point to genuine limitations in the approach being demonstrated.</p><p>Let’s take a look at some of the limitations in more detail.</p><p><strong>Tight Coupling<br></strong>The metadata query engine works by maintaining a record of the specific location of the file that provided each metadata document in the database. Thus, if the file is changed in any way (including being moved, modified, or deleted) then the query engine will return results that are out-of-date. Similarly, it means the database is not portable, but is tightly coupled to the archive (or similar) against which it has been constructed.</p><p>If we do not expect a given database of metadata to be portable, but fixed to a particular archive, this limitation is partly mitigated. Nevertheless, a system would still be needed to ensure that any changes in the archive are reflected in the metadata database, so that queries always return accurate results.</p><p><strong>Files are the quantum unit<br></strong>Although this sounds spectacular, in reality all it means is the smallest unit a query can return is a reference to a single whole file. This has a couple of particular implications.</p><p>Firstly, it is common for a single file of weather and climate data to contain multiple data arrays. This can happen when all the data arrays are on the same grid, or when all the data arrays were produced in the same operation. A common weather modelling example of this is vector components of wind (u-wind, v-wind and w-wind; the vector components of wind on the x, y, and z axes respective to the underlying model grid). If a single file contained all three components but the user queried for a standard name of u-wind, the single file (which contains all three components) would be returned, so all three components would incongruously be loaded in a subsequent load operation.</p><p>Secondly, a limitation in this demo implementation of a metadata query engine cannot return a subset of a file. On a technical level, this comes about because the documents in the database store only file metadata and a reference to the file, but not the actual data points from the file. A significant advantage of this is that the document database remains small (metadata volumes are typically significantly smaller than data volumes), but it also means that references to whole files only can be returned, and not a subset or an index of the file.</p><p>For example, if a file contained 100 years of data, you could not use the metadata query engine to return to you only the 10 years of data you were particularly interested in. Instead, the query would return the file containing all 100 years of data, and it would be up to the user to subsequently subset the file once loaded to retrieve the 10 years’ data of particular interest.</p><p><strong>Limited-scope queries<br></strong>Simple equality-test queries can be run against any metadata contained in the documents making up the document database. More complex queries have not been implemented, even though such queries should be possible to implement. Examples of these more complex queries that have not been implemented are inequality queries (for example, locate all files containing data for years before 1980, or locate all files that measure height data above 1km), and spatio-temporal queries (for example, locate files that only contain data over the UK — perhaps by supplying a bounding box that must completely encompass all a file’s spatial extent).</p><p><strong>Incomplete metadata<br></strong>Not all of the metadata present in files being indexed by the metadata query engine is currently included in the metadata documents that make up the metadata database. An example of this is the bounds attribute of coordinate metadata, which, if present, describes the extent (that is, the lower and upper bound) of each point in the coordinate array. With the coordinate bounds metadata not translated, queries based on bounds (even whether bounds are present or not) will fail.</p><p><strong>UX<br></strong>Queries must be written and passed as Python dictionary objects in this demonstration. While this is arguably simpler than writing SQL-like queries, it is not necessarily the most intuitive way to pass queries to the metadata database. There is no hinting or autocompletion of allowed keys and values, requiring that the data user has an understanding of the schema used to generate the metadata documents, or at least at the type of metadata expected in the files being indexed. Worse still, metadata elements can be nested, and the syntax for specifying nested elements is quite unintuitive. So, while an un-nested metadata query only requires getting Python dictionary syntax correct:</p><pre>{“standard_name”: “air_temperature”}</pre><p>The syntax for checking if a coordinate has bounds, were the example from the previous limitation to be fixed, would presumably look quite unintuitive:</p><pre>{“dim_coords.&lt;coord_name&gt;.bounds” = True}</pre><h3>Where Next?</h3><p>Despite the limitations of the metadata query engine that have just been considered, the core concept of a metadata query engine has proven to be sound, with the possibility of having genuine practical application. To move this from a proof-of-concept towards being a useful application, we could look at taking the following steps.</p><h4>Make it Go</h4><p>A good first step would be trialling a deployment of the metadata query engine that indexes and provides a search function for a real-world data archive. By exploring its useability — and its usefulness — based on feedback from users accessing the archive, we can determine what works well about the metadata query engine, what doesn’t, and whether it provides beneficial functionality.</p><p>A good indication that the metadata query engine provides a valuable service will be if we find that users are consistently and quickly able to find the data they need in the archive more quickly than having to manually search the archive. Such a finding would suggest that the metadata query engine is making life easier for archive users and improving the findability and accessibility of data stored in the archive.</p><p>If we find instead, however, that users chose not to use the metadata query engine when accessing the archive, or that inaccurate results are returned, or that the query engine errors when being used, then this will be an indication that, at the minimum, more work is needed before we can deploy metadata query engines more widely.</p><p>One more thing we would need to consider when deploying a metadata query engine for searching an archive is the scalability of the query engine. That is, how does it handle multiple concurrent queries? We would need to consider both the client and the database server and ensure that both can handle concurrent requests, and have sufficient resources to handle requests in a timely manner.</p><h4>Make it Better</h4><p>We noted in §Limitations that there are a number of improvements and optimisations that could be made to the query functionality and UX of the metadata query engine. Implementing these would make the metadata query engine more functionally useful and easier to use.</p><p>Of particular value would be providing functionality that enables spatio-temporal queries to be submitted. Selecting data based on it covering a particular area in space and/or time is a common data access method, so adding this extra functionality would certainly be a valuable addition. We could further extend the functionality of the metadata query engine so that it also extracts subsets that precisely match the extents requested in the query from files returned and loaded by queries. At this point the metadata query engine would be able to supply an in-memory dataset, ready for analysis, that precisely matched the extents requested in the query.</p><p>Improving the manner in which query strings are provided to the query engine — so that they are not so prescriptive in format — would improve the experience for users of the metadata query engine. This perhaps particularly applies to the GUI, which requires a Python dictionary passed as a string. This is quite unintuitive! A possible way to improve this would be to provide a number of text entry fields, where keys and values have discrete text entry fields. This would remove the need for the end user to have to type a syntactically-correct Python dictionary into a single text entry field, as the dictionary could be built automatically behind the scenes from the discrete entries in the keys and values fields.</p><h3>In Summary</h3><p>In this post we’ve explored a new concept for user interaction with large volumes of data: querying the data, based on its metadata, to return a subset of the data that matches the metadata query that was made. This sits alongside existing methods for interacting with such large volumes of data — those of making an ARCO dataset of the data, or cataloguing its content.</p><p>We’ve taken a look at a demo implementation of a metadata query engine, and noted that while there are some limitations to it, we’ve also seen that it’s functional and an effective method for interacting with large volumes of data. Finally, we’ve explored some next steps that would improve the existing implementation to make it more full-featured, as well as considering situations where we could deploy an operational trial of a metadata query engine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eeb06c1c9e1e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/informatics-lab/metadata-queries-eeb06c1c9e1e">Metadata Queries</a> was originally published in <a href="https://medium.com/informatics-lab">Met Office Informatics Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Representing thousands of NetCDF Files using TileDB]]></title>
            <link>https://medium.com/informatics-lab/representing-thousands-of-netcdf-files-using-tiledb-af5865996b93?source=rss-42746d50cf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/af5865996b93</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cloud-optimization]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[analysis-ready-data]]></category>
            <dc:creator><![CDATA[Peter Killick]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 14:08:02 GMT</pubDate>
            <atom:updated>2020-12-03T14:08:02.647Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This blog post supports a poster that I presented at AGU2020. You can find </em><a href="https://agu2020fallmeeting-agu.ipostersessions.com/default.aspx?s=7A-68-39-27-8E-7C-0A-01-6D-6B-97-10-61-F1-BE-07&amp;guestview=true"><em>the poster here</em></a><em>. Note: the QR code in the poster links to this blog post, so if you scan the QR code you’ll just end up right back here!</em></p><h3>Introduction</h3><p>The Cloud is increasingly being used for processing very large volumes of scientific data. This reflects the increasing attractiveness of the Cloud for data processing — including the ease of access to large amounts of compute and storage, limited only by your budget; the wide array of hardware available (including fast CPUs, accelerators such as GPUs, ARM-based chips, and even HPC systems); different managed services to meet your needs (VMs, machine learning studios, kubernetes and more); the simplicity of not having to manage your own hardware; the ability to access other people’s data that’s also Cloud-hosted; and the offering of Cloud-based services and platforms such as Pangeo.</p><p>Given this increased uptake in usage of the Cloud, it follows that it is also increasingly important that data be easily findable, accessible and usable on the Cloud. To put it more succinctly, we require that scientific data that’s available on the Cloud be both Cloud-optimised and analysis-ready.</p><p><strong>Cloud-optimised data:</strong> fileformats and data storage formats that are specifically designed to work effectively on Cloud data stores (that is, object stores).</p><p><strong>Analysis-ready datasets:</strong> datasets that are completely ready to be analysed by a user, where the user doesn’t first have to perform data cleaning tasks, or locate missing elements of the dataset, or combine the contents of multiple files in order to be able to use the dataset, for example.</p><p>Let’s take a look at improving the provision of weather and climate data on the Cloud by providing this data in a cloud-optimised, analysis-ready format.</p><h3>Data on the Cloud</h3><p>Classical data storage (that is, methods of storing data that pre-date the Cloud) and Cloud data storage are very different entities. They have differing strengths and weaknesses, meaning data storage formats optimised for one will likely exhibit challenges for use on the other. This is certainly true of using classical data storage formats on Cloud data storage, and is the reason why — at least for data storage and processing on the Cloud — pursuing cloud-optimised data storage formats is important.</p><p>Let’s take a look at the key attributes of classical and Cloud data storage in turn. From these attributes we’ll draw some conclusions on ideal characteristics for data storage formats optimised both for classical storage and Cloud data storage.</p><p>Note that I’m intentionally only considering one classic data storage system and one Cloud data storage system. Other systems of course exist in both cases to which the comments below may not so directly apply. But for the sake of brevity we will consider just the one case each for both classical and Cloud data storage systems.</p><h4>Classical Data Storage</h4><p><strong>Hardware:</strong> typically made up of a single locally-mounted disk, or possibly a few network-mounted disks.</p><p><strong>Network access:</strong> latency — very low; throughput — high<br>Locally mounted disks exhibit very low latency and high throughput as there is a very short data transfer path between disk and compute.</p><p><strong>File access:</strong> sequential — fast; parallel — very slow. <br>Network access characteristics to a single local disk give fast sequential access to parts of files or complete files. The single disk means that parallel access is very slow as the parallel accesses compete for the disk’s IO bandwidth.</p><p><strong>File and folder hierarchy:</strong> typically POSIX-like hierarchical files and folders.</p><p><strong>File browsing:</strong> POSIX-like paths on local or network-mounted disks.</p><p><strong>Byte-range requests:</strong> always available, but must be supported by the application requesting the bytes from disk.</p><p>A data storage format optimised for classical data storage would then be a single, reasonably small file, with a logically separated internal byte structure. This single file can either be read in a single operation, or via multiple small byte-range requests that take advantage of the logical internal byte structure. This takes advantage of fast sequential reads without requiring slow parallel reads.</p><h4>Cloud Data Storage</h4><p><strong>Hardware: </strong>thousands of disks logically connected to make a vast single storage volume.</p><p><strong>Network access:</strong> latency — high; throughput — low<br>For typical access to a remote cloud data store, high latency and low throughput are natural outcomes of relying on the Internet for all interactions with the data store. If compute is close to the data — in the same Cloud region, for example — this pattern does not hold and network access is closer to locally mounted storage (as compute and storage are likely in the same datacenter on the same network).</p><p><strong>File access:</strong> sequential — slow; parallel — very fast<br>Sequential file access is limited by the latency and throughput of the network, so will be worse than for locally-mounted disks. The fact that Cloud storage is made up of numerous disks makes parallel file access very fast as different requests can be made to different disks. And while each request is limited by the same network overhead as sequential files, this is also parallelised, so its slowdown is much smaller than the parallel file access speedup.</p><p><strong>File and folder hierarchy:</strong> none; instead there is a flat file structure made up of key-value pairs, where keys are file names and values are the data bytes of those files.</p><p><strong>File browsing:</strong> by http requests to the Cloud data store, which may be provided via a web interface.</p><p><strong>Byte-range requests:</strong> only if exposed by the API for the Cloud data store, which must also be exposed by the application making the request. The high latency of requesting data from the Cloud data store means byte-range requests are often impractical to utilise.</p><p>A data storage format optimised for a Cloud data store is thus very different to one optimised for a classical data store. The high cost of making requests over a network means that individual requests are ideally kept small, with larger requests ideally being parallelised. The cost of requesting large amounts of data means that ideally the data bytes of a dataset be chunked into many smaller files that can be logically reconstructed into a complete dataset. The dataset’s metadata is included in separate metadata files, which contain both information about the the values in the data bytes (such as what the data represents and units of measure) and also a mapping that describes how the data chunks fit together to re-form the complete dataset. This allows the metadata to be requested separate from any of the data bytes, which can be requested in parallel in subsequent operations.</p><h3>Some Cloud-Optimised Data Storage Formats</h3><p>We have laid out the characteristics of Cloud data storage and how it is different to classical data storage. We’ve used this information to draw up how a Cloud-optimised data storage format would work. Let’s now take a look at some examples of cloud-optimised data storage formats.</p><h4>TileDB</h4><p><a href="https://tiledb.com/">TileDB</a> is described as a universal data engine. It can store gridded and sparse arrays, dataframes and custom scientific datasets and provide database-like access to the data. TileDB is cloud-native and stores data in a cloud-optimised format, but can also store data to a local filesystem.</p><p>The core TileDB engine is a fast, efficient and parallel C++ library that exposes a rich API. This API is also made available in C, Python, Java, R and Go.</p><h4>Zarr</h4><p><a href="https://zarr.readthedocs.io/en/stable/">Zarr</a> is a very lightweight, open-source, cloud-first data storage specification for storing chunked, compressed nD arrays. It offers chunked storage of datasets and parallel reads and writes to and from the data store. Zarr can also be used to create data stores in memory and on local disks.</p><p>Zarr is an intentionally lightweight specification for storing nD arrays on the Cloud. There is a reference implementation written in Python, but the lightweight nature of the specification means implementations in other languages are easy to produce.</p><p>There is also work ongoing to produce an implementation of NetCDF <a href="https://www.unidata.ucar.edu/blogs/news/entry/netcdf-and-native-cloud-storage">that uses Zarr as its storage backend</a>. The aim of this work is to make the NetCDF fileformat itself cloud-optimised by means of the Zarr data storage backend, and so provide all the benefits of NetCDF and all the benefits of Zarr in a single package.</p><h4>Others</h4><p>There are other Cloud-optimised data storage formats too. These include <a href="https://www.cogeo.org/">Cloud-Optimised GeoTiff</a> (COG) and <a href="https://parquet.apache.org/documentation/latest/">Parquet</a>. We won’t consider these formats further as they are not designed to store nD arrays, being more targeted at image files and columnar data respectively. So while they enable other sectors to work with cloud-optimised data, they aren’t directly applicable to our use-case.</p><h3>Producing Cloud-Optimised TileDB arrays</h3><figure><img alt="A series of volumes of an encyclopaedia. Just as a series of files make a dataset, so these volumes make an encyclopaedia." src="https://cdn-images-1.medium.com/max/1024/0*dFEwkKkmsftca4aF" /><figcaption>Photo by <a href="https://unsplash.com/@fragilejames?utm_source=medium&amp;utm_medium=referral">James</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Let’s now take a look at how we represent the contents of thousands of NetCDF files in TileDB. The NetCDF files that we wish to translate are effectively a single dataset containing high-resolution UK weather forecast data produced by the Met Office. The dataset covers approximately 20 common weather phenomena that get forecasted (such as air temperature and humidity, forecast rainfall, surface pressure and wind), and cover approximately the whole period from 2016 to 2020 at three different temporal resolutions: daily, hourly and five-minute timescales. Our aim is to take all of these individual NetCDF files and represent them in a single cloud-optimised and analysis-ready TileDB (although technically we will create one TileDB array per temporal resolution).</p><p>The high-level overview of the process for converting thousands of NetCDF files into a single TileDB array looks like the following:</p><ol><li>Generate an in-memory representation of the contents of a single NetCDF file.</li><li>Create a TileDB array from the contents of that NetCDF file.</li><li>Extend the TileDB array by adding the contents of further NetCDF files to the array.</li><li>Access and interact with the resultant array.</li></ol><p>We ran all of these steps in Python, making use of existing Python libraries for loading NetCDF files and interacting with weather data, and using the TileDB Python API. As there is no existing translation layer between NetCDF and TileDB we wrote a Python library containing this functionality: <a href="https://github.com/informatics-lab/tiledb_netcdf">tiledb-netcdf</a>.</p><h4>1. Representing a NetCDF file</h4><p>The Python NetCDF interface provides access to the contents of NetCDF files as in-memory `Dataset` objects containing attribute dictionaries of metadata items and a number of `Variable` objects. These represent anything in the NetCDF file that have data bytes, which includes data variables, coordinate metadata variables, and other more bespoke variables as well.</p><p>What the `Dataset` object does not include is any indication of what sort of `Variable` any of the variables are — there’s no programmatic method of determining with certainty whether a given `Variable` is a data variable, a coordinate variable, or something else. For an accurate translation of a NetCDF file to a TileDB array we need to ensure that all the elements of the NetCDF file are equivalently stored in the TileDB array.</p><p>To enable this, tiledb-netcdf includes a custom data model for representing NetCDF files, based on the <a href="https://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html">CF-NetCDF specification</a>. This uses a series of heuristics to try and infer the type of each variable in the NetCDF file. The outcomes of this inference is stored in a series of lookup dictionaries in the custom data model, ready to be interrogated when the TileDB array is created in the next step.</p><h4>2. Create a TileDB array</h4><p>We can use the `Writer` interface of the tiledb-netcdf library to convert the contents of a NetCDF file into a TileDB array. The `Writer` instance interacts with a NetCDF file via the custom data model described above, and requests data variables, coordinate variables, metadata and more from the NetCDF file via the lookup dictionaries populated in the data model.</p><p>These are used to create a TileDB array with a slightly bespoke format that groups data variables according to the number of dimensions of the data and the coordinate variables that describe them. These data variables are grouped together in <a href="https://docs.tiledb.com/main/basic-concepts/data-model">multi-attribute TileDB arrays</a> that include metadata relevant to the group of data variables, with separate arrays that store data and metadata for the coordinates that describe each group of data variables.</p><h4>3. Extend the array</h4><p>Once a TileDB array has been created it can be extended to include the contents of other NetCDF files — ultimately so that the contents of all of the thousands of NetCDF files in the dataset are stored in the single TileDB array. There are a number of complexities to extending an array with extra data. These complexities come down to accurately placing the data to be appended within the index-space of the existing array and ensuring that appropriate metadata is preserved</p><p>In tiledb-netcdf the complexities associated with appending extra data are handled by the `append` method of the Writer class. The `append` method determines the offset along the append dimension for each NetCDF file to be appended and handles metadata and coordinate values. Note that append functionality is limited to being able to extend only a single dimension in an append operation.</p><h4>4. Interact with the array</h4><p>Finally, TileDB arrays created with tiledb_netcdf can be interacted with using the Python libraries Iris and Xarray. The `Reader` interface in tiledb_netcdf includes functionality to access the contents of the arrays via <a href="https://scitools-iris.readthedocs.io/en/latest/">Iris</a> or <a href="https://xarray.pydata.org/en/stable/">Xarray</a> by loading the metadata contents of the TileDB array from storage and populating an <a href="https://scitools-iris.readthedocs.io/en/latest/userguide/iris_cubes.html#cube">Iris Cube</a> or an <a href="https://xarray.pydata.org/en/stable/data-structures.html#dataarray">Xarray DataArray</a> from it. A TileDB array containing the contents of all the NetCDF files included in the dataset will be very large, so it would be infeasible to load all of the data bytes into memory at once. To avoid this tiledb-netcdf includes functionality to defer loading the actual data bytes by maintaining only a reference to the array that can be interrogated for byte ranges on request.</p><p>The advantage of having this functionality is that we can interact with the contents of the whole dataset, represented in a TileDB array, using tools that are well known for interacting with weather data. This reduces the bar to entry for scientists and data users, meaning they do not need to learn new approaches for interacting with the data. It also means we can continue to benefit from the domain-specific, often highly optimised functionality provided by Iris and Xarray without having to re-write it specifically for dealing with TileDB arrays.</p><h4>A short code example</h4><p>The following code snippet shows the code necessary to run all of the above steps in Python, using tiledb-netcdf, the TileDB Python API and the Iris Python library:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/479683c773b2ae316c11d04ed84cfb52/href">https://medium.com/media/479683c773b2ae316c11d04ed84cfb52/href</a></iframe><h3>Benefits</h3><p>Let’s take a look at some of the benefits of representing our NetCDF files as a cloud-optimised, analysis-ready TileDB array.</p><p><strong>Data access:</strong> it is much easier to interact with the contents of thousands of NetCDF files in a TileDB array than it is via the individual files directly. The fact that there is just a single TileDB array in the place of thousands of NetCDF files means that accessing all the data is a lot quicker and a lot simpler as well. Much less pre-processing of the data is needed as it comes ready-made as a single logical dataset rather than the contents of all the NetCDF needing to be combined each time you wish to work with them. The data can still be interacted with using common tools like Iris and Xarray, and the whole dataset can be subset to retrieve specific elements of interest.</p><p><strong>Data volume:</strong> as noted above, we can use a single TileDB array to represent the contents of thousands of NetCDF files. This allows a very large volume of data to be accessed from a single array, and all this data can be represented (metadata-only) in memory in a Python script, for example. For example, the image below shows an Iris cube constructed from such a TileDB array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-KYRSBfUw6T83SphzXrNYQ.png" /><figcaption>A very large Iris cube constructed from a TileDB array.</figcaption></figure><p><strong>Data interaction:</strong> we can load all the data we need — be it an entire TileDB array or a subset of it — in a single operation and interact with this data via common Python tools like Iris and Xarray. The fact that this is done in a single operation means preparing the data is no longer a time-consuming process, nor a blocker on performing analysis operations on the data. Further, TileDB allows parallel interaction with actual data values, so analysis operations such as statistical aggregations can be distributed on scalable cloud data processing platforms.</p><h3>Next Steps</h3><p>There are substantial benefits to using cloud-optimised, analysis-ready datasets to represent large volumes of NetCDF data in the Cloud. There are further steps that we can take, though, to better understand the nature of the datasets that we have created and to further improve their usability. Some possible routes for further work, then, are detailed below.</p><h4>User Experience</h4><p>A major driver for representing NetCDF files as cloud-optimised, analysis-ready TileDB arrays is the experience of the data user. As we have explored already, it is much easier to load a single analysis-ready TileDB array than to wrestle with loading and combining thousands of NetCDF files.</p><p>There are still improvements we can make to the experience of the data user in accessing and interacting with such cloud-optimised, analysis ready data. For example, there is a reasonable amount of setup needed to connect TileDB arrays to an object store, and you need to know the name of the object store and possibly an access key as well. Ideally this complexity would not be exposed to the data user (and the access key never made public!). Similarly, without access to the object store you wouldn’t necessarily know what datasets are available.</p><p>One way to improve this would be to catalogue all the available cloud-optimised, analysis-ready datasets using Intake, for example. We could include all the complexity of accessing the object store in the Intake catalogue entry and remove that from the data user, so that loading a cloud-optimised, analysis-ready dataset from the Intake catalogue returned the dataset as an Iris cube or Xarray DataArray directly.</p><h4>Library Improvements</h4><p>The Python library tiledb-netcdf provides us with an interface between NetCDF and TileDB to store NetCDF data in TileDB, and a further interface to interact with TileDB arrays using Iris and Xarray. This is very beneficial functionality, but there are improvements that can still be made to the library.</p><p>From a functionality point of view, a key improvement that can be made is to utilise TileDB’s built-in labelled array functionality rather than using a bespoke system. The library was written before TileDB’s labelled array functionality was released. The downside of the bespoke system is that TileDB arrays created using tiledb-netcdf are not fully portable, so will only be correctly interpreted when being read via tiledb-netcdf.</p><p>From a usability point of view, the library would benefit from a test suite to ensure complex code is functioning as expected, as well as expanding the documentation to make it easier to use. The library is <a href="https://pypi.org/project/tiledb-netcdf/">installable from the Python Package Index</a>, but would also benefit from being conda installable.</p><h4>Benchmarking</h4><p>We will get a better understanding of the value of storing NetCDF data in cloud-optimised, analysis-ready TileDB arrays by benchmarking various elements of creating and using such arrays, and comparing TileDB to other options, such as Zarr and plain NetCDF. Another valuable attribute of such arrays to benchmark is their usability from a user experience perspective.</p><p>Performance benchmarks to run and compare include:</p><ul><li>speed of writing data from NetCDF files to cloud-optimised storage formats.</li><li>speed of reading data from Cloud storage to an analysis platform to create an analysis-ready dataset. Here it would be valuable to compare reads of metadata only as well as reads of data bytes, and comparing reads to a local analysis platform as well as Cloud analysis platforms.</li></ul><p>A major driver for using cloud-optimised, analysis-ready datasets is their usability. We can use this fact to create usability benchmarks that we can use to compare different cloud-optimised data storage formats, including:</p><ul><li>Ease of creating analysis-ready datasets from input data.</li><li>Ease of accessing analysis-ready datasets once they’re created.</li><li>Ease of performing custom analysis on analysis-ready datasets once accessed.</li></ul><h3>To Sum Up</h3><p>By representing a dataset composed of thousands of NetCDF files in a single cloud-optimised, analysis-ready dataset, we can greatly simplify the process of accessing and analysing the contents of the dataset, and entirely remove the requirement to pre-process the contents of the dataset to make it ready for analysis. This means data scientists are able to start performing analysis of the datasets directly without having to first pre-process and tidy the data. Cloud-optimised, analysis ready datasets are also ideally suited to representing the increasingly large volumes of data typical to many science domains.</p><p>A number of different cloud-optimised, analysis-ready data storage formats exist, so formats can be chosen to meet the requirements of many different use-cases. We have primarily focused on TileDB here, as this (along with Zarr) best suits our use-case. There are different advantages and disadvantages to each format, but they all share the advantage of providing cloud-optimised data storage.</p><p>There are still some challenges to providing and using cloud-optimised, analysis-ready datasets. For data providers, there is extra work needed to provide datasets cloud-optimised and analysis-ready, from translating existing datasets and ensuring the datasets accurately represent all the data they contain. For data users there can be challenges around learning new methods of finding and interacting with such datasets. Providing tooling to improve interactions to cloud-optimised, analysis-ready datasets can reduce the impact of these challenges, both for data providers and data users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af5865996b93" width="1" height="1" alt=""><hr><p><a href="https://medium.com/informatics-lab/representing-thousands-of-netcdf-files-using-tiledb-af5865996b93">Representing thousands of NetCDF Files using TileDB</a> was originally published in <a href="https://medium.com/informatics-lab">Met Office Informatics Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Attending the ESIP Summer Meeting 2020]]></title>
            <link>https://medium.com/informatics-lab/attending-the-esip-summer-meeting-2020-cd746a21cdac?source=rss-42746d50cf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd746a21cdac</guid>
            <dc:creator><![CDATA[Peter Killick]]></dc:creator>
            <pubDate>Mon, 20 Jul 2020 16:23:22 GMT</pubDate>
            <atom:updated>2020-07-20T16:23:22.422Z</atom:updated>
            <content:encoded><![CDATA[<h4>Presenting TileDB and Project Cloud-Ready Data</h4><p>Like much of the rest of the world’s events in 2020, science and technology conferences are largely meeting online. The <a href="https://2020esipsummermeeting.sched.com/">ESIP Summer Meeting 2020</a> was no exception. ESIP, the <a href="https://www.esipfed.org/">Earth Science Information Partners</a>, is an organisation that fosters interactions between people who deal with Earth Science Information, so that new partnerships can grow out of these interactions.</p><p>ESIP’s theme for the year is “Putting Data to Work”, a theme that has been reflected in the content of the Summer Meeting. In the Informatics Lab we put a lot of effort into making data usable, particularly on the Cloud, so that data users can put this data to work as effectively as possible. One recent example of this is <a href="https://medium.com/informatics-lab/analysis-ready-data-47f7e80cba42">Project Cloud-Ready Data</a>. I was invited to speak on this project in the Cloud-Optimised Data session, with a particular focus on how we made use of <a href="https://tiledb.com/">TileDB</a> in Project Cloud-Ready Data, which we <a href="https://medium.com/informatics-lab/storing-cloud-ready-geoscience-data-with-tiledb-34d454c33055">also blogged about recently</a>.</p><p>I joined four other speakers in presenting on a broad range of cloud-optimised data formats and how they’re being utilised. Here’s the video of the livestream of the event:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7Jl9wKIiWis&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7Jl9wKIiWis&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2F7Jl9wKIiWis%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5b3d9e8f02f42398ceb8586a2ee6ab7/href">https://medium.com/media/b5b3d9e8f02f42398ceb8586a2ee6ab7/href</a></iframe><p>Here’s the time index for the talks in the video:</p><ol><li>Ryan Abernathey — Rechunker (00:13:41)</li><li>Peter Killick — Project Cloud-Ready Data (00:25:35)</li><li>David Neufeld — Parquet and Athena for crowdsourced bathymetry data (00:40:55)</li><li>Trevor Skaggs — ICESAT2 Data and Entwine Point Tiles (00:54:19)</li><li>Patrick Quinn — EOSDIS Zarr Store (01:06:07)</li></ol><p>By attending this meeting and presenting in this session I was able to share the learning the Informatics Lab gained through project Cloud-Ready Data about producing cloud-optimised data and the storage formats that are available for doing so. It was also good to discover that there are other people thinking the same sorts of things as we are! I have also been able to learn lots about the work others are doing in this and related fields, and I have made valuable relationships with other people working to solve very similar problems to those we are tackling in the Informatics Lab.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd746a21cdac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/informatics-lab/attending-the-esip-summer-meeting-2020-cd746a21cdac">Attending the ESIP Summer Meeting 2020</a> was originally published in <a href="https://medium.com/informatics-lab">Met Office Informatics Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Storing Cloud-Ready Geoscience Data with TileDB]]></title>
            <link>https://medium.com/informatics-lab/storing-cloud-ready-geoscience-data-with-tiledb-34d454c33055?source=rss-42746d50cf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/34d454c33055</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Peter Killick]]></dc:creator>
            <pubDate>Mon, 06 Apr 2020 08:43:04 GMT</pubDate>
            <atom:updated>2020-04-06T08:43:04.971Z</atom:updated>
            <content:encoded><![CDATA[<h4>Representing thousands of NetCDF files in a single logical dataset</h4><h3>The Helicopter View</h3><p>Not enough time to read the whole blog post? Here’s a quick summary:</p><blockquote>TileDB offers some great functionality which could be very powerful if applied to earth system science. We are actively collaborating with the TileDB Team to make TileDB functionality available alongside existing earth system science tooling, which we think could be a game-changer for storing and interacting with earth system science datasets.</blockquote><h3>Introduction</h3><p>Data volumes in computational data science are increasing. This is as true in earth system science as in other disciplines. For the Met Office this means about 14TB per day of operational (that is, weather and climate forecast) data being produced by the Met Office supercomputer, with some estimates putting daily research data volumes at 8x that.</p><p>All this data needs to be stored somewhere, found and accessed by people who wish to use it in their own research and, more pertinently for this blog post, also stored somehow. Typically the ‘how’ of storing earth system data has been a variety of formats, with a slight preference towards NetCDF files. Often a single logical dataset is represented with hundreds or even thousands of discrete files. Reading and working with these files can introduce a significant code and mental overhead that is a blocker to getting on with using the contents of these files in earth system research.</p><p>In this blog post I will detail some recent exploratory work we’ve been doing in the Informatics Lab with TileDB, a reasonably new and cloud-ready approach for storing large volumes of data.</p><h3>About TileDB</h3><p><a href="https://tiledb.com/">TileDB</a> is a new, open-source storage engine for chunked, compressed nD arrays. It is similar to <a href="https://zarr.readthedocs.io/en/stable/">Zarr</a> as it introduces a cloud-native, parallel engine for dense arrays, and is an alternative to <a href="https://www.hdfgroup.org/solutions/hdf5/">HDF5</a>. Over and above the features offered by Zarr, TileDB also supports sparse arrays, offers multiple language APIs — it is built in C / C++, and provides efficient wrappers for Python, R, Java and Go — implements time traveling (more on this later), and integrates with many popular tools (<a href="https://spark.apache.org/">Spark</a>, <a href="https://dask.org/">dask</a>, <a href="https://prestodb.io/">PrestoDB</a>, <a href="https://mariadb.org/">MariaDB</a>, <a href="https://gdal.org/">GDAL</a> and <a href="https://pdal.io/">PDAL</a>). TileDB can store data on multiple cloud backends, including AWS S3, Azure Blob Storage, and Google Cloud Storage.</p><h3>TileDB and Earth System Science Data</h3><p>We can use TileDB to store earth system science data, providing some exciting new possibilities for earth system sciences. In the Lab we are interested in using TileDB to store very large earth system science datasets. These may be composed of thousands or tens of thousands of individual files, or be composed of fewer, much larger files on the order of tens of terabytes of data. We are exploring using TileDB to represent all this data, however it is formed, in a single logical TileDB array. One thing we in the Lab are excited about with TileDB is that it offers a genuine solution for doing just this.</p><p>In order to completely store the contents of NetCDF files in any storage engine (TileDB, Zarr, or something else), you effectively need to be able to store three things: nD arrays of data, key-value pairs of arbitrary array metadata, and label arrays for the axes of the nD arrays. With TileDB you can store nD arrays with arbitrary metadata, but there is currently no native support for labelled array axes, although this is on the <a href="https://feedback.tiledb.com/tiledb-core/p/support-axes-labels">TileDB roadmap</a>.</p><p>TileDB does not currently integrate with <a href="https://scitools.org.uk/iris/docs/latest/">Iris</a> and <a href="https://xarray.pydata.org/en/stable/">xarray</a>, common libraries for interacting with earth system science data in Python. These libraries provide lots of useful functionality when interacting with earth system science data, which we’d like to make use of for TileDB arrays too. On account of this, we have written an adaptor that bridges the gaps between earth system data, TileDB arrays and high-level libraries like Iris and Xarray.</p><h4>Technical Implementation</h4><p>We’ve seen two areas where there’s a need for an interoperability library that connects TileDB to an existing Python ecosystem: for making the link between TileDB arrays and analysis libraries such as Iris and xarray, and for writing TileDB arrays containing extra metadata that’s specific to earth system science data.</p><p>We wrote a Python package to allow us to create TileDB arrays from NetCDF files and interact with these arrays using Iris and Xarray. The package provides three primary functions:</p><ul><li><strong>A data model</strong> for NetCDF files as loaded using the <a href="https://unidata.github.io/netcdf4-python/netCDF4/index.html">netcdf4-python</a> library, which classifies NetCDF variables as describing data arrays, coordinate arrays, or other metadata.</li><li><strong>A writer</strong> to convert NetCDF files represented using the data model (data and metadata) to TileDB arrays.</li><li><strong>A reader</strong> to load TileDB arrays (data and metadata) into high-level libraries like Iris and xarray.</li></ul><p>This package is <a href="https://github.com/informatics-lab/tiledb_netcdf">available on GitHub</a>. Writing it was needed to bridge the gap between the existing, metadata-rich file formats such as NetCDF and high-level libraries such as Iris, and the TileDB array specification. With it, we’ve been able to create TileDB arrays comprised of data and metadata from thousands of individual NetCDF files, and load these into Iris as a single Iris cube object:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q5uNaC0AIDAEL6u0" /><figcaption>This is one big Iris cube.</figcaption></figure><p>This is a really exciting result, as it is the biggest Iris cube that we have created in the Informatics Lab to date! It shows that TileDB can be used to store data plus metadata from NetCDF files that’s representable as a single Iris cube. As we’ve recently blogged about elsewhere, it’s possible to make such an Iris cube directly from the input NetCDF files, but the cognitive burden is much higher than simply being able to load a single TileDB array directly as a single Iris cube.</p><p>Going further, we can leverage <a href="https://dask.org/">dask</a> and functionality available in Iris to perform operations on such cubes that are backed by TileDB arrays, such as extracting a single latitude/longitude grid point, or performing a statistical collapse across all time points.</p><h3>TileDB’s Unique Capabilities</h3><p>Our exploration of TileDB has led to us finding a lot of interesting functionality in TileDB that we can make use of when storing earth system data in TileDB arrays. Let’s take a look at some of these in a bit more detail.</p><h4>“Infinite” Domain</h4><p>All data within a TileDB array must be contained within the array’s <em>domain</em> — the labelled, nD space that describes the limits of the array. One or more axes of the domain can be made effectively infinite in length, however, meaning that near unlimited appends of data to that axis become practicable. One good use-case for this is storing data from a very long time period in a single array.</p><p>You may think that an infinite domain could make indexing a very expensive operation. Fortunately TileDB includes clever indexing, and the concept of a <em>non-empty domain</em> — the extent of the indices of your array that have actually been written — to make sure this isn’t a hefty overhead.</p><h4>Time Travel</h4><p>The contents of each write to a TileDB array are stored in a <em>fragment</em>, but successive writes do not overwrite previous writes. Instead each write fragment is time-stamped and kept. On read, the TileDB API returns data that matches the read keys from the most recent fragment by default.</p><p>The fact that older fragments are retained, however, means that you can explore the array from times in its history, or <em>time travel</em> through the array. Another way of looking at this is that TileDB implements a form of data version control.</p><p>Of course, storing all this historical array data requires storage space, and can make read operations slow as multiple fragments may need to be accessed. TileDB has a consolidation algorithm that takes the most recent write to each cell within the array and makes it available in just a single fragment, which reduces the read overhead.</p><p><strong>Time Travel and Met Office Model Data</strong></p><p>Data from Met Office forecast models have two time dimensions. Each model is executed on a certain cadence (a new model run kicks off every three hours, for example), and each model run forecasts a certain time period into the future (one model run may forecast only 48hr ahead while the next model run may forecast out to a whole week, for example).</p><p>The time at which a model run is kicked off is its <em>forecast reference time</em>, and the offset in time between the model run’s forecast reference time and each given timestep in the model run is that timestep’s <em>forecast period</em>. From these two values a single standard time coordinate can be calculated by adding the<em> forecast period</em> value at each timestep in the model run to the model run’s <em>forecast reference time</em>, but the extra forecast period and forecast reference time metadata are also retained.</p><p>Storing and comprehending this data makes for an interesting challenge! We’re excited to apply TileDB’s time travel functionality to this challenge. For example, we could use the time travel axis to store all model data at a given forecast reference time; that is, all the data from a single model run.</p><h4>Fancy Array Functionality</h4><p>TileDB includes some array functionality that’s unique to TileDB. TileDB arrays can have both be <em>multiple attribute</em>s and <em>variable-length attributes</em>. Let’s take a look at each of these in turn:</p><ul><li><strong>multiple attributes:</strong> a single TileDB array can store multiple <em>attributes</em> in the same array. In TileDB terminology, an attribute is a named nD array of data, equivalent to a phenomenon in Iris terminology, or a NetCDF data variable.</li><li><strong>variable-length attributes:</strong> in addition, a single cell in a TileDB array can hold multiple data values in a list, not limited by type. More information on this is available in the <a href="https://docs.tiledb.com/developer/api-usage/writing-arrays/var-length-attributes">TileDB developer documentation</a>.</li></ul><p>Both of these effectively equate to increased array dimensionality. This functionality might also provide new ways of storing existing earth system science data. For example, you could use either of these examples of TileDB fancy array functionality to store x-wind and y-wind — either as multiple attributes of the same array, or as multiple elements in the same cell of a single xy-wind array.</p><h4>Virtual Datasets</h4><p>This is not directly a piece of TileDB functionality, but something that could come as an extension on account of the fancy array functionality that TileDB does provide. We just saw how you could, for example, store both x-wind and y-wind in the same array, but you could also extend this to create <em>virtual datasets</em> from the multiple-attribute array containing x-wind and y-wind.</p><p>Wind speed and direction are commonly derived from x-wind and y-wind so we could create virtual datasets of wind speed and direction, based on the multiple-attribute x-wind and y-wind. These virtual datasets would contain no actual data, just the knowledge of how to index the underlying array to get x-wind and y-wind data at a given point, and the mathematical operations needed to turn these points from x-wind and y-wind into wind speed and direction.</p><h4>Language Support</h4><p>As mentioned earlier, TileDB also supports a number of different languages, not just Python. While written in C++, it has bindings to provide a TileDB API in C, Python, R, Java and Go as well. So TileDB’s cross-language interoperability is very good, and means that any earth system science data (for example, from NetCDF files) stored in a TileDB array is immediately accessible in multiple languages.</p><p>This is, incidentally, a nice step away from common Informatics Lab thinking on data provision and data pipelines. This has unintentionally become quite Python-centric, assisted by the fact that a lot of data science now takes place quite exclusively in Python, with many high quality data science tools provided as Python libraries. Making the data available in a format that’s accessible in multiple languages is a good first step on the way to making a whole data pipeline that’s multi-language, and not so Python-first.</p><h3>Next Steps</h3><h4>Comparing with other Formats</h4><p>In the Informatics Lab we are exploring the best ways to store large volumes of earth system science data in a cloud-ready format. We feel that TileDB represents a strong candidate for doing this, but we are also experimenting with <a href="https://zarr.readthedocs.io/en/stable/">Zarr</a>, and with NetCDF — the current de facto file format for earth system science data.</p><p>One of the aims of this work, then, is to compare TileDB to these other formats, particularly for storing large volumes of logically structured earth system data on the cloud. For example, we’re interested in exploring:</p><ul><li>How does TileDB compare to Zarr in terms of speed and scale when reading and writing data?</li><li>How much of a reduction in cognitive load is there from using earth system science data stored in TileDB or Zarr over multiple NetCDF files, particularly when we can continue to use Iris and xarray to interact with this TileDB and Zarr data?</li></ul><p>We hope we’ll be able to answer these questions as we continue with the next steps in this investigation (see below). We’ll share our findings in upcoming blog posts. So far, though, we’ve successfully converted large volumes of data from NetCDF to TileDB. We can perform experiments on these TileDB arrays that will help us answer these questions and others.</p><h4>Timing Benchmarks</h4><p>One of the main aims of the broader Informatics Lab project that this work is a part of is benchmarking the performance of different cloud data storage formats. We are particularly interested in comparing TileDB to Zarr, but also to NetCDF. Some of the benchmarks we’ll run target common earth system science data analysis operations, which can be challenging with very large volumes of data. These include calculating point means and rolling window calculations over a long time period.</p><h4>Cloud Support</h4><p>The Lab has an ongoing partnership with Microsoft Azure, so all our experiments with TileDB have been run on Azure. Initially we were using FUSE (Filesystem in Userspace) to connect TileDB to Azure blob stores, but we have been trialling the recent dev release of TileDB that includes a direct interface to Azure blob, which we have found to be a great improvement over using FUSE.</p><p>The direct interface shows much better performance for both reads and writes to the TileDB array on blob, which is as we would expect. We have also found that a few odd errors when trying to distribute reads and writes using dask have also been solved, which we hoped would be the case. The sort of errors we were seeing were typical of parallelising something: a key that exists not being found when running in parallel, file lock errors and similar. It seems that having FUSE as an intermediate between the Python runtime and the TileDB array stored on Azure blob was making the operation not thread-safe, so we’re very pleased to have this solved by using TileDB’s direct Azure blob interface.</p><h4>Technical Implementation</h4><p>There are a number of improvements that could be made to the Lab’s Python library that allows interoperability between TileDB, NetCDF and Iris / xarray. For example, not all NetCDF metadata is being preserved by this library when writing from NetCDF to TileDB. Instead, only essential metadata (data values, name and units for the data values, and dimension-describing coordinates) are being preserved. This can be improved by passing more metadata out of the data model and into the TileDB array when it is written.</p><p>We are also working closely with the TileDB team on the technical side. We are working together to provision labelled axes in the core of TileDB. This will add to the functionality offered by TileDB, and the Lab’s Python Library can make use of it rather than providing its own opinionated approach for storing labelled axes in TileDB. We are also working on providing integrations for TileDB with Iris and xarray.</p><h3>In Summary</h3><p>We have successfully used TileDB to store the contents — data and metadata — of hundreds of discrete NetCDF files in a single logical TileDB array. We have been able to interact with the data stored in this array directly. We have also been able to interact with this data using Iris and xarray, meaning we can take advantage of the rich data exploration APIs provided by these libraries. This means we have also proven the concept of extending the functionality of Iris and xarray to support a new data storage format.</p><p>There’s still more work to do — for example, the Python interoperability library we’ve written as part of this work is missing some useful features. What we’re really interested in doing now is using the data we’ve successfully stored in TileDB and exploring how it is to work with, and how fast we can run operations common to earth system science data analysis on this data stored in TileDB. We’re also excited to continue to collaborate with the TileDB team on future enhancements to TileDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NgvMQ_SeFhlUds7I.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34d454c33055" width="1" height="1" alt=""><hr><p><a href="https://medium.com/informatics-lab/storing-cloud-ready-geoscience-data-with-tiledb-34d454c33055">Storing Cloud-Ready Geoscience Data with TileDB</a> was originally published in <a href="https://medium.com/informatics-lab">Met Office Informatics Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Intake Server Service]]></title>
            <link>https://medium.com/informatics-lab/the-intake-server-service-10eebb48101?source=rss-42746d50cf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/10eebb48101</guid>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Peter Killick]]></dc:creator>
            <pubDate>Fri, 20 Dec 2019 11:43:56 GMT</pubDate>
            <atom:updated>2019-12-20T11:43:56.728Z</atom:updated>
            <content:encoded><![CDATA[<h4>Exposing Intake Server as a service on Pangeo</h4><p>One of the main areas of work focus in the Informatics Lab at the moment is on provenance — broadly defined as knowing the history of some object. We recently <a href="https://medium.com/informatics-lab/what-have-you-done-f069b9d50050">published an article</a> that defined provenance in greater detail and laid out some of our thinking on provenance, including why we believe this is an important area of research. Here we will explore just one small, technical piece of work that contributes to the wider work on provenance.</p><p>Cataloguing what you’ve got — data, analysis routines and more (or, collectively, artifacts)— is an important part of provenance tracking. Within a catalogue we can record not only these artifacts but also extra information about each artifact, such as when it was created, who created it, how it was created, processing history, and more besides. This information records the provenance of each artifact and also allows us to build up a provenance chain for each artifact.</p><p>For example, this extra information about a given artifact, <em>artifact_b</em>, might allow us to determine that it was produced in an experiment run on June 15, by <em>user21</em>, from a script called <em>my_processing_script</em>, which applied a statistical collapse operation on <em>artifact_a</em> to produce <em>artifact_b</em>. This is a useful history, but it also allows us to derive the value of <em>artifact_b</em>. To further the example, it could be that the origin of <em>artifact_a</em> (as recorded in its further information) is a model run with a known bias. This bias therefore may be present in <em>artifact_b</em> as well, a fact we can derive from looking at its provenance chain (as potentially <em>user21</em> should have done before choosing to use <em>artifact_a</em> to create <em>artifact_b</em>).</p><p>In Python, we can produce catalogs of data and more using the library <a href="https://intake.readthedocs.io/en/latest/index.html">Intake</a>. Intake can also be used to stand up a server that allows you to serve catalogs over a network. Here we will explore how we exposed the intake server as a service running on a kubernetes cluster.</p><h3>Intake In Detail</h3><p>Intake is an open-source Python library that aims to make it easy to find and load data. This is achieved via Intake catalogues, which record both <strong>where datasets are stored</strong> (a filepath or a web link, for example to an S3 bucket) and <strong>how to load them </strong>(a <em>driver</em> in Intake parlance). This means that you do not need to remember where on a filesystem the dataset you want to use is stored (this is recorded in the Intake catalogue), nor the specific code needed to load the dataset into your Python session (a reference to the driver is also recorded in the intake catalogue). As such, the pain of finding and loading data is taken away, and you are free to focus on using the data, rather than trying to access it.</p><p>Intake catalogues are designed to store data, but in principle there’s nothing that limits them to only storing data. This means we could explore storing more of the artifacts of provenance in Intake catalogues, such as analysis routines described in Jupyter notebooks. Tools such as <a href="https://github.com/nteract/papermill">papermill</a> provide functionality for automatically executing Jupyter notebooks, so we could produce an Intake driver for Jupyter notebooks that auto-executes Jupyter notebooks when they are loaded. All together, this gives us a simple provenance system all using Intake catalogues.</p><h4>Intake Server</h4><p>Intake server serves up one or more Intake catalogues over a network, accessible by connecting to the server’s endpoint rather than by reading an Intake catalogue from a file. This means you could run intake-server as a discrete service on a kubernetes cluster, which is precisely the aim here. Other services running on the cluster, such as user notebooks in Pangeo, can then connect to the Intake server’s endpoint and read the catalogues being served by the intake server.</p><h3>Making the Intake Server Service</h3><p>To create an Intake server service we followed these steps:</p><ul><li>Create a conda env that includes Intake and all the addon drivers that we use (specifically intake-iris and intake-xarray).</li><li>Put the conda env in a docker container that exposes intake-server as the docker container’s entrypoint.</li><li>Create a kubernetes Deployment that itself creates a kubernetes pod running the docker container.</li><li>Add a kubernetes Service that exposes the pod on the network via DNS for easy discoverability.</li><li>Write a helm chart that wraps up all of the kubernetes elements for easy, customisable deployment on a kubernetes cluster.</li></ul><h4>What’s the benefit of this?</h4><p>The main thing that Intake server provides is simplicity. So, you can use intake-server as a single service that can provides access to all required catalogues, without needing to know or remember how to access these catalogues. The running Intake server then acts as a single location from which you can explore and load all of your catalogued data.</p><p>The intake server endpoint can by default be accessed by all the other services running on the same kubernetes cluster. This means the intake server can be used to serve catalogues to all services on the cluster. With a little more setup (and due security consideration) it could also be accessed outside the cluster, which means it could be used to share catalogues of data with partner institutions, and to serve data that would otherwise not be visible on the cluster.</p><p>On a purely personal level, I learned a lot while creating the Intake server service. Despite having used kubernetes and helm a lot while creating and administering Informatics Lab Pangeos, I felt that my understanding of how these technologies actually work was lacking. The opportunity to have to set up kubernetes resources and then encapsulate that resource setup in a helm chart means I now understand much better how both technologies function.</p><h4>Any Downsides?</h4><p>The biggest challenge to the concept of the Intake server is whether it is really necessary. It’s already pretty easy to point Intake at one or more catalogues and access the data in these catalogues. In many ways doing this via a server rather than via the filesystem is just added complexity, as there’s now also a server to maintain.</p><p>The server functionality in Intake is still reasonably new and immature. This means it has limited functionality and occasionally does not function as expected. For example, one benefit we hoped to get from using intake-server is that we would not need to add extra Intake drivers to conda envs (particularly user-defined envs) on Pangeo. Unfortunately this is not currently possible with intake-server: all drivers need to be present both on the server and the client. Hopefully this and other limitations will be removed as the Intake server matures.</p><h4>How do I use it?</h4><p>At the moment this helm chart is only available in a git repo in the Informatics Lab organisation. You can install the Intake server helm chart onto your cluster as follows:</p><pre>$ git clone https://github.com/informatics-lab/intake-server<br>$ helm install --namespace &lt;my-namespace&gt; --name &lt;deployment-name&gt; ./intake-server -f customisations.yaml</pre><p>Here it’s assumed that you have already created a yaml file called customisations.yaml for customising the install of the helm chart onto your kubernetes cluster. You will also need to choose a namespace (in place of &lt;my-namespace&gt;) and name for the deployment (in place of &lt;deployment-name&gt;).</p><h3>Next Steps</h3><p>It seems that the Intake Server offering is a little immature at the moment. Once Intake server gains more functionality then this could be a useful mechanism for interacting with Intake catalogs — on Pangeo and on other Kubernetes clusters.</p><p>As we saw in the previous section, the Intake server helm chart is currently not particularly accessible, as it is not available via any of the standard helm repos. We intend to improve this by submitting the intake server helm chart to <a href="https://hub.helm.sh/">helm hub</a>. We will also need to provide documentation for the helm chart, particularly for the configurable parameters in the chart.</p><p>On a technical level, the helm chart currently only allows you to specify a single catalogue file for the server to serve. While you can nest Intake catalogues so that all required catalogues are available from this single catalogue, it would be preferable to be able to specify multiple catalogues in the helm chart. This should be entirely doable technically, it just hasn’t been implemented yet!</p><p>Intake server uses server-specific drivers, called <em>remote drivers</em>, to load data from catalogues. Provision of remote drivers alongside standard drivers is good for the drivers provided as part of Intake, but not as good for 3rd-party drivers. For example, <a href="https://scitools.org.uk/iris/docs/latest/">Iris</a> and <a href="https://xarray.pydata.org/en/stable/index.html">Xarray</a> are Python libraries used extensively for analysing earth system science datasets, and are thus of particular relevance. Both of these libraries have standard intake drivers, but Iris does not have a remote driver at all, and Xarray’s remote driver (at time of testing) did not function equivalently to it’s standard intake driver. A further technical improvement that’s needed, then, is to improve the provision of 3rd-party remote drivers for Intake.</p><p>Finally, it would be really interesting to explore further the opportunity of sharing catalogues and data via intake server. This could open up many opportunities to share access to data that would otherwise be inaccessible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10eebb48101" width="1" height="1" alt=""><hr><p><a href="https://medium.com/informatics-lab/the-intake-server-service-10eebb48101">The Intake Server Service</a> was originally published in <a href="https://medium.com/informatics-lab">Met Office Informatics Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Accelerating Iris with NVIDIA GPUs]]></title>
            <link>https://medium.com/informatics-lab/accelerating-iris-with-nvidia-gpus-6a5a44ff047e?source=rss-42746d50cf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a5a44ff047e</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[gpu-computing]]></category>
            <category><![CDATA[nvidia]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Peter Killick]]></dc:creator>
            <pubDate>Fri, 19 Jul 2019 13:39:30 GMT</pubDate>
            <atom:updated>2019-07-19T13:39:30.258Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iJ-Pjc3F36Ru9Mb-jbN1FQ.jpeg" /><figcaption>The NVIDIA Tesla V100 GPU, the star of this blog post.</figcaption></figure><p>Recently in the Informatics Lab we were sad to say goodbye to <a href="https://twitter.com/_JacobTomlinson">Jacob Tomlinson</a>, who has moved to an exciting new job working for <a href="https://www.nvidia.com/">NVIDIA</a>. One of his roles at NVIDIA will be enabling communities to utilise GPUs for accelerated data processing, as a part of <a href="https://developer.nvidia.com/rapids">RAPIDS</a>. Given Jacob’s recent employment, the Met Office is an obvious target community, especially with the amount of data processing that is done by the Met Office.</p><p>With Jacob’s new boss <a href="https://github.com/mrocklin">Matthew Rocklin</a> visiting from the US to support his induction into NVIDIA, we thought we’d pool resources to work on something appropriate to our combined expertise. We decided to apply work that NVIDIA have been doing to speed up Python code to a Python package heavily used at the Met Office for analysing weather and climate data.</p><h3>Existing libraries</h3><p>The Python programming language has been widely adopted for use within the science community for its ease of use, simple syntax and extensive library of packages that extend core Python functionality. The Met Office is no exception to this, with a majority of computational analysis and visualisation of weather and climate data that takes place being written in Python.</p><p>Python packages add a broad range of functionality to Python, from packages that provide scientific and mathematical processing operations to packages providing advanced out-of-core processing and just-in-time compilers. Let’s explore four of these packages in a bit more detail.</p><h4>NumPy</h4><p><a href="https://numpy.org/">NumPy</a> is a Python package that adds support for arrays (n-dimensional grids of data) to Python. It is very commonly used to the point that it has become the de facto package for working with arrays in Python. You can use NumPy to generate arrays in Python and perform mathematical and statistical operations on them and between them. NumPy is also fast due to largely being implemented in C, but it has limits: it cannot handle very large datasets that do not fit in memory.</p><p>One of the biggest things that NumPy has provided is an array API for Python, which is in such common use that it is effectively the de facto array API in Python. This means that other libraries can take this API and recreate it for their bespoke, but still NumPy-based, Python array objects. Two notable examples of this are dask’s Array functionality and CuPy.</p><h4>Dask Array</h4><p><a href="https://docs.dask.org/en/latest/array.html">Dask array</a> provides <a href="https://en.wikipedia.org/wiki/External_memory_algorithm">out-of-core</a> parallelised data processing to NumPy arrays. The majority of the NumPy array API is reproduced in dask for dask arrays, meaning that with dask you can create arrays too large for memory and parallelise processing of them, all while using the same API as originally provided by NumPy. It is also easy to switch between a NumPy array and a dask array.</p><h4>CuPy</h4><p><a href="https://cupy.chainer.org/">CuPy</a>, part-developed by NVIDIA, effectively replaces the C code in NumPy with <a href="https://developer.nvidia.com/cuda-zone">CUDA</a> code. Doing so produces arrays that can be processed extremely rapidly on GPUs. Again the majority of the NumPy array API is reproduced for CuPy arrays, and it is easy to switch between a NumPy array and a CuPy array. This means you could run an intensive NumPy array calculation on an NVIDIA GPU and see a significant speedup in processing time compared to running the same calculation with a pure NumPy array.</p><h4>Iris</h4><p><a href="https://scitools.org.uk/iris/docs/latest/">Iris</a> provides a data object called a cube that utilises the NumPy array and adds functionality specialised to handling weather and climate datasets. The cube contains both data (a NumPy or dask array) and metadata that describes the meaning of the values in the array, such as what the values in the array describe, and where in space and time the data are located. The Iris user guide contains more details on <a href="https://scitools.org.uk/iris/docs/latest/userguide/iris_cubes.html#cube">the cube object</a>.</p><h3>Enhancements to the fore</h3><p>A recent <a href="https://docs.scipy.org/doc/numpy/release.html#numpy-functions-now-support-overrides-with-array-function">enhancement to NumPy</a> called “array overrides” (available from v1.16) enables NumPy to hand off processing of a NumPy-like array to the library best suited to processing the array. For example, you could pass a CuPy array to a NumPy array operation, and NumPy would automatically call the CuPy equivalent of the NumPy operation to perform the requested processing. There is great benefit to be had from doing this, as you get the most effective (and so also fastest) way to process any given array without requiring any changes to your own code.</p><h4>Application to Iris</h4><p>As we’ve seen, at the core of the Iris cube is an array, either a dask array or a NumPy array. This allows Iris to take advantage of the benefits of dask but also to get to the real numbers when they’re needed (such as for plotting). There is cleverness in Iris to take advantage of this and make the user experience as seamless as possible. Iris detects whether the array is a dask or NumPy array and responds accordingly.</p><p>This means that Iris already contains functionality similar to what has recently been added to NumPy, if a lot more limited in capacity. By making use of array overrides in Iris we would see the following benefits:</p><ul><li>No loss of existing functionality, but instead a gain in functionality as this functionality would be available for all array operations in Iris rather than just in the limited number of cases where it has already been implemented.</li><li>Iris would benefit from being able to support any array type that’s like the NumPy array, without any changes to Iris code.</li><li>We could remove existing Iris code designed to handle different array types, making Iris simpler and easier to maintain.</li></ul><h3>The Experiment</h3><p>We thought we would try passing an Iris cube a CuPy array (we called this cube a cucube) as its data attribute and seeing how much Iris functionality we could use with this cucube. In particular we were interested in trying to use the Iris statistic operators (common statistics such as <em>mean</em>, <em>max</em>, or <em>std </em>captured in an Iris API for easy application to Iris cubes) on the cucube. There were a number of reasons for this choice:</p><ul><li>performing a statistical operation on an Iris cube is a very common operation,</li><li>it’s a mathematically intensive operation that could easily benefit from faster processing, and</li><li>it’s one of the areas of Iris that already handles dask and NumPy arrays differently.</li></ul><p>We reasoned that we could bypass the different array handling mechanism used by the Iris statistic operators and use the new functionality in NumPy in its place. This way if we passed a CuPy array from the cucube with a request to perform a mean operation on the array then NumPy should automatically hand off to CuPy to perform the requested calculation on the array.</p><h4>Setup</h4><p>The equipment we used to run the experiment is worth a brief mention. With no NVIDIA GPUs physically available at the Lab we turned to <a href="https://aws.amazon.com/">AWS</a> (Amazon Web Services) to provide a GPU-accelerated machine. We spun up a <em>p3.8xlarge</em> EC2 instance containing no less than four NVIDIA V100 GPUs to run our experiment on, giving us lots of GPU processing space. For our data processing environment on top of this EC2 instance we chose <a href="https://tljh.jupyter.org/en/latest/index.html">the Littlest JupyterHub</a> for being a lightweight JupyterHub environment that was easy to set up and use.</p><p>Jacob has written elsewhere about our experiences in preparing this experimental setup. If you’re interested in what we did, the difficulties we encountered and how we resolved them, his post is well worth a read.</p><h4>Data used and calculation performed</h4><p>We ran our experiment on a 4D Iris cube of global air temperature data, containing 18 ensemble members, 33 pressure levels, on a 960x1280 horizontal grid. With float64 data, this added up to 2.9GB of data to process. To this 4D cube we applied a sum operation over all ensemble members and pressure levels, resulting in one 2D cube describing total air temperature over all ensemble members and pressure levels.</p><p>While representing a completely unphysical quantity, this operation was useful for testing the performance improvement found using CuPy over NumPy in Iris. The sum statistic operator was also one of the easiest Iris statistic operators to convert, making it an ideal operator to use in this experiment.</p><h4>What we found</h4><p>Our first attempt took this large Iris cube, converted the cube’s data array to a CuPy array and tried to put that CuPy array back into the Iris cube. Here we encountered our first difficulty: by trying to seamlessly handle either a dask or a NumPy array, Iris was not able to handle a CuPy array. We worked around this with a quick modification to Iris to skip this array type handling step.</p><p>With Iris modified we were able to make an Iris cube containing a CuPy data array (that is, the cucube). This was an excellent initial result as all the rest of the experiment relied on getting this done. The next step was to try using a statistic operator on our cucube. This operation also initially failed as Iris again expected either a dask or a NumPy array. Again a quick modification to Iris got us over this hurdle so that we could use Iris to calculate statistics on our cucube.</p><h4>Results</h4><p>We ran the same sum operation described above on both the original cube and the cucube we created from the original cube. The processing times for performing the sum operations using NumPy and CuPy respectively are shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*hn1zKIpuZfcZHocfCi-BSg.jpeg" /><figcaption>Brief excerpt from the experiment notebook showing the timing results.</figcaption></figure><p>We can see that using CuPy to perform the sum operation resulted in a speedup of near 75x over NumPy. This is on a reasonably small cube too; we might hope to see increasing performance improvements with larger cubes.</p><p>The full demo notebook used to get this result, which includes a demonstration of how to make a cucube, can be viewed in <a href="https://gist.github.com/DPeterK/11a2271b160c8debe4c77dda3334f24b">this GitHub gist</a>.</p><h3>In Conclusion</h3><p>Even this somewhat brief and limited experiment has shown that we can successfully use CuPy to speed up data processing in Iris. It was also pleasingly simple to modify Iris to be able to handle CuPy arrays and so make use of the new functionality added to NumPy.</p><p>To take full advantage of the findings of this experiment we should modify Iris to use this new NumPy functionality by default. As discussed above, this will make Iris simpler and have more consistent behaviour all throughout the codebase. It will also mean that the whole of Iris can benefit from the speedups available through using CuPy for data processing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a5a44ff047e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/informatics-lab/accelerating-iris-with-nvidia-gpus-6a5a44ff047e">Accelerating Iris with NVIDIA GPUs</a> was originally published in <a href="https://medium.com/informatics-lab">Met Office Informatics Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My time at PASC19]]></title>
            <link>https://medium.com/informatics-lab/pasc19-ff97cedc90ae?source=rss-42746d50cf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff97cedc90ae</guid>
            <category><![CDATA[hpc]]></category>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[conference]]></category>
            <category><![CDATA[supercomputer]]></category>
            <category><![CDATA[switzerland]]></category>
            <dc:creator><![CDATA[Peter Killick]]></dc:creator>
            <pubDate>Tue, 25 Jun 2019 14:23:03 GMT</pubDate>
            <atom:updated>2019-06-25T14:24:22.786Z</atom:updated>
            <content:encoded><![CDATA[<h4>Another week, another city, another conference</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q12SuCLRbOjNQjyVTRhuFA.jpeg" /></figure><p>You’d be forgiven for thinking that the only work I ever do with the Informatics Lab is travelling. And while there is currently a fair amount of evidence to support such thinking (visiting three different EU cities and countries in the last three months), this is not true! I just happen to be in a high-density travel period of work life right now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W6qHu8PvvyX_mSm5IehFXw.jpeg" /><figcaption>ETH Zürich, the host of PASC19</figcaption></figure><p>This particular piece of travelling took me to the Swiss city of Zürich for the <a href="https://pasc19.pasc-conference.org/">PASC19 conference </a>— Platform for Advanced Scientific Computing 2019 — hosted at ETH Zürich; Zürich’s technology university. My reason for attending PASC19 was to present, advertise and evangelise the Pangeo scalable data processing platform, for which the Met Office is one of the key partners.</p><p>At this point it’s probably worth a quick diversion to introduce the related but different terms of HPC and supercomputing, as both terms will be used in the following article. Confusion is increased by the fact that people often use the terms HPC and supercomputer interchangeably.</p><ul><li><strong>HPC:</strong> either High Performance Computer, or more generally, the concept of High Performance Computing. This can cover a fairly broad range of hardware, from an unusually powerful personal computer, to a cluster of servers, all the way up to supercomputers. A supercomputer, then, is a subset of HPC.</li><li><strong>Supercomputer:</strong> a specialised example of HPC hardware specifically designed to deal with very large scale, massively parallel data processing. Supercomputers are typically made up of multiple racks of reasonably standard (if high-end) computer hardware, such as CPUs and memory, but with the differentiating feature being an extremely fast network infrastructure between racks and CPUs.</li></ul><h3>The PASC Conference</h3><p>The PASC conference brings together HPC administrators and practitioners from a very broad range of backgrounds and scientific disciplines. These themes run from astrophysics through weather and climate research, to fluid physics (itself covering such diverse topics as flow over turbine blades to high-energy plasmas), to biochemistry. The uniting theme of all attendees, though, is that their science is run on HPC; or, in the case of the administrators, that science is run on their HPCs.</p><p>PASC is very application-heavy. While other HPC conferences have a lot about the latest hardware and the latest vendor provision, PASC focuses on the science research that is being done on existing HPCs. These are, to refer back to the conference’s name, the practical applications of scientific computing that are of interest. Of course there are talks about hardware as well, but even these tend to have a focus on how a given hardware can enable new science, speed up existing science, or be tuned so that science can be done faster.</p><p>The theme of this year’s conference was set as “Exascale and Beyond.” This picks up on the fact that the first exascale-capable HPCs are now being built and coming online. Let’s define some terms:</p><ul><li><strong>exascale:</strong> HPCs that are capable of ExaFLOPs operations, where…</li><li>the prefix <strong>exa</strong> is the name given to 10¹⁸ — a billion billion — of whatever follows (in the same way that “mega” is 10⁶ or a million, “giga” is 10⁹ or a billion, and so on),</li><li><strong>FLOP</strong> stands for Floating-Point OPeration (per second); the number of calculations between decimal numbers that the computer can carry out in a second, and</li><li>an <strong>exabyte</strong> is a billion billion bytes’ worth of data.</li></ul><p>Thus an ExaFLOP capable HPC can perform at least one billion billion calculations between decimal numbers every second, which is a lot of calculations!</p><p>PASC has always been hosted in Switzerland, although the specific location and host institution of PASC has varied throughout its history. Now into its 7th year, PASC19 was hosted in Zürich at ETH Zürich, with previous instances of the conference having taken place in other big Swiss cities, and next year’s conference already announced as being at the end of June / start of July 2020, in Geneva. This year’s PASC conference marked a turning point in the conference’s history as the first one where more than half of the attendees were International attendees and not Swiss natives — what had started out as a Swiss HPC conference bringing together users of Swiss HPC systems (such as CSCS, who are still very much involved in PASC), has now become an internationally-recognised conference.</p><h3>In Zürich, I shall…</h3><p>Here are the specific things that I went to Zürich to do.</p><h4>Networking</h4><p>Ahead of PASC19 I visited a friend of the Informatics Lab who is fortuitously based at ETH Zürich. We spent a good time discussing Pangeo, dask and Iris and thinking about how you encourage uptake of new tools and technologies when there is little incentive to do so and it is hard to find time and support to do so. A little local knowledge is always a good thing, so at the end of a hard afternoon of thinking we all headed out to an excellent local restaurant for good local food and beer.</p><h4>My talk</h4><p>At PASC19 there was a minisymposium themed on Pangeo, into which my talk slotted. It presented Pangeo as the basis for an alternative to the traditional HPC model for a data API; a bold move at a supercomputing conference!</p><p>Here’s the abstract for my talk, entitled <strong>Turn Key Ephemeral Data Platforms: the Next Generation Data API</strong>, and the slides that accompanied it:</p><blockquote>Tens of terabytes of Met Office weather forecast data is currently being served every day via the AWS cloud. This low level data contains complex probabilistic information which spans multiple scales. However, its volume and velocity make it increasingly hard for consumers to get bespoke analyses (i.e. new value) from the data. Currently, this data is being made available through traditional RESTful APIs, where users can request subsets of these datasets before being sent them across the internet. Whilst this model serves well most of our traditional consumers, it can be prohibitive to the new use cases which are necessary to justify the large up-front investment. Pangeo provides an opportunity to allow consumers to efficiently make use of these complex datasets. However, this presents a challenge: how would a public sector body justify funding a data processing platform which is designed to allow private enterprise to make money from bespoke data products, effectively subsidising their business? This talk describes work to allow Pangeo to be easily cloned and deployed by non-experts, transferring the cost away from the tax-payer to the business, effectively creating a new type of data API.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdocs.google.com%2Fpresentation%2Fembed%3Fid%3D1A74xsdcFtDeOXH0d3uk7GhQgnFhE89pJ1gWrNeY1aWY%26size%3Dl&amp;url=https%3A%2F%2Fdocs.google.com%2Fpresentation%2Fd%2F1A74xsdcFtDeOXH0d3uk7GhQgnFhE89pJ1gWrNeY1aWY%2Fedit%3Fusp%3Dsharing&amp;image=https%3A%2F%2Flh6.googleusercontent.com%2FV8hM6eNykvTp3VREtbCxz-fwKk8ARUGHWjra72_qsjghh0YLyITT2ZNdS3LBSkf_C64Wnw%3Dw1200-h630-p&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=google" width="700" height="559" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ddf99576eed00b64186962788f54839/href">https://medium.com/media/1ddf99576eed00b64186962788f54839/href</a></iframe><h3>Themes</h3><p>There were a number of themes evident throughout PASC19 in the sessions that I attended. Perhaps unsurprisingly these all had at least some connection to this year’s conference theme. Let’s explore these themes in some more detail.</p><h4>Supercomputers remain popular</h4><p>In the face of the rise of new technologies the main theme I saw at PASC19 was that the traditional supercomputer continues to be popular. On the face of it, this theme should not be a surprise, but, as introduced above, the supercomputer is just one among many options for HPC. I think this reflects that the supercomputer still remains the best overall platform for high-performance computing, especially with the challenges posed by exascale, and with the fact that a supercomputer can be reasonably easily improved with accelerators such as GPUs.</p><h4>Exascale</h4><p>As discussed above, an exascale HPC can reach ExaFLOP performance — that is, perform at least one million billion floating point calculations every second. This brings with it a number of secondary considerations that need to be thought about now before they actually cause problems for people. These include the amount of data being produced, where to store this data, and how to use this data in downstream systems. This is a problem that affects CERN, the Met Office and ECMWF, and organisations working in many other fields.</p><p>Appropriately given the conference theme, this fact prompted a number of talks at PASC19, where various options and solutions were proposed for various different exascale considerations. Some of these talks in a sense just presented a newer, bigger HPC, which is a great way of tackling the exascale problem head-on, so long as you have budget and space to enable a sufficiently large HPC. Perhaps the more interesting talks were the ones where alternative solutions to dealing with the exascale problem were presented and explored, and it’s these alternatives that we’ll explore next.</p><h4>Doing something else</h4><p>Exascale brings with it many challenges, which won’t necessarily be eased just by making more compute available. A lot of the talks I attended at PASC19 presented alternatives to this to help with these challenges.</p><p><strong>Reduced precision<br></strong>Reduced precision stood out as a non-hardware approach to tackling the exascale problem. It does this, very cleverly, by greatly reducing the amount of data to be processed! To understand this we need to take a brief detour into how numbers are represented by computers.</p><p>The numbers used in computer simulations are typically represented as signed 64-bit floats (usually called “doubles”; short for double-precision values). This means each number can be positive or negative (“signed”), with a variable-position decimal point (“float”), that takes up 8 bytes in memory (that is, 64 bits, given there are 8 bits to a byte).</p><p>Using 8 bytes in memory for a single number seems like a lot when we can’t make use of all the decimal places in the number in the final result we’re trying to calculate. To take a hypothetical example from the weather, the forecast air temperature for 2pm on Tuesday barely needs to be expressed as a decimal at all: 18.2℃ is, for all intents and purposes, the same as forecasting the temperature just as 18℃, so forecasting the temperature as exactly 18.21399864652℃ is just a little too precise for the situation.</p><p>The argument for reduced precision, then, says “we’re not using all those extra decimal places, so why include them in calculations at all?” and puts the argument into practice by using numbers with half, or even a quarter, of the precision of a double. These are called single precision and half precision values respectively. Let’s take a look at what happens to the well-known floating point value π when we express it as a double, single, and half-precision float.</p><ul><li><strong>double</strong> (64-bit): π = 3.141592653589793</li><li><strong>single</strong> (32-bit): π = 3.1415927</li><li><strong>half</strong> (16-bit): π = 3.14</li></ul><p>As can be seen, the numerical accuracy of π drops off dramatically with each reduction in precision, but each drop in precision also brings a reduction in the amount of bytes to process.</p><p>The reduction in numerical accuracy with single and half-precision values is the main risk of not using doubles in numerical calculations. Although the numerical accuracy is not needed in the end result, removing it entirely can lead to wild inaccuracies in the final result being calculated. To go back to the weather example from earlier, the eventual result calculated might end up being inaccurate by as much as 3–5℃.</p><p>A lot of talks about reduced precision numbers, then, focussed on exploring how great the forecast inaccuracies become when using reduced precision numbers in numerical simulations, and what can be done to reduce the inaccuracies while still taking advantage of the lower memory usage with reduced precision numbers. Specifically, careful use of reduced precision numbers can lead to models being quicker to run without significant reduction in accuracy.</p><p><strong>Exotic hardware accelerators<br></strong>This was the other major example of alternatives to HPC with more compute. Augmenting traditional CPU-based compute was a very popular theme at PASC19, with all sorts of different options presented on. Let’s take a look at the contenders…</p><p><strong>Arm:</strong> Arm is best known for providing processor architectures used in your smartphone. Recently, however, Arm-based processors have started making inroads into high performance computing. Key examples of this are the Marvell (Cavium) <a href="https://www.marvell.com/server-processors/thunderx2-arm-processors/">Thunder X2</a> processor and the <a href="https://www.fujitsu.com/global/about/resources/news/press-releases/2018/0822-02.html">Fujitsu A64FX</a> processor, which will be used in the <a href="https://www.fujitsu.com/global/about/resources/news/press-releases/2019/0415-01.html">Post-K supercomputer</a>.</p><p>Testing of HPC with Arm-based processors showed they had comparable performance to more mainstream Intel Xeon processors, showing slightly better performance in some cases and slightly worse performance in others. Arm-based processors were also easy to start using, and are noticeably cheaper than similar offering from Intel. The main difficulty with using Arm-based processors comes from the software stack. As Arm-based processors have a different microarchitecture to Intel processors, code must be re-compiled to run on them, and a different set of libraries and compiler toolchains are needed, which are not necessarily as optimised as the Intel offering.</p><p><strong>GPU:</strong> Graphical Processing Unit, better known as a graphics card. For many years the only thing graphics cards were really used for was playing Crysis at ever-improved frame rates. It turned out though that the maths needed to display high-quality video graphics is exactly the same as the sort of maths needed in a number of high-performance computing applications. As GPUs have been developed over many years to solve such maths better and better, they are now very good at solving this sort of maths, so GPUs are now reasonably well-known as hardware accelerators for HPC applications.</p><p>The big advantage of GPU is the performance you get, which can be significantly faster than running the same calcuations on CPU. The main downsides with GPU is they use a lot of power compared to CPU and can be hard to use as they require niche programming experience to extract the full performance they are capable of providing.</p><p>In recognition of the difficulties present with using graphics cards to the full available performance, the graphics card manufacturer NVidia have started working on making core libraries of the scientific Python ecosystem natively support graphics cards. This means you can use these libraries —in particular <a href="https://dask.org/">dask</a> and <a href="https://numba.pydata.org/">numba</a> — on graphics cards to get all the benefits of running on graphics cards without having to do extra work in your own code to get graphics card support.</p><p><strong>FPGA:</strong> Field Programmable Gate Arrays; a sort of programmable hardware. Whereas a CPU has a microarchitecture that’s fixed at fabrication time, FPGAs can be architected (in a sense programmed) to match the requirements of the application they are going to be used for. This means they can be made highly performant and efficient for processing a particular task.</p><p>The main advantage of FPGAs then is the performance and efficiency you can achieve using them for a particular processing task. A well-programmed FPGA can achieve GPU-like performance but with much lower power usage. The main downside of FPGAs is that code development for them is long and complex; more so than with GPU. FPGAs also have some inherent hardware limitations, particularly to do with clock speed and amount of on-board BRAM that make them a poor fit for some (particularly memory intensive) tasks.</p><p><strong>Cloud vs on-prem</strong><br>The broad feeling within PASC19 seemed to be that all supercomputing equated to on-premises hardware (or, at least, hardware owned by the institution or a partner institution). That said, cloud is now a viable alternative for many supercomputing tasks, especially those that are reasonably ad-hoc, a fact that was borne out in the Pangeo talks presented.</p><p>As such, it was good to see that it wasn’t just the Informatics Lab presenting cloud technologies at PASC19. There were also a number of other interesting talks on how cloud is advancing as a viable alternative to HPC, at least in a number of specific use-cases.</p><p>As noted much earlier on in my definition of HPC, the thing that really sets HPC apart from other forms of supercomputing is the fast network interconnects between workers running on the HPC. This traditionally has also been what has prevented cloud from being a viable challenger to HPC, as the interconnects between cloud nodes just has not been good enough.</p><p>This seems to be changing though. Penguin computing now provide a cloud-based HPC-on-demand service. At the same time both AWS and Azure are working on providing cloud instance types that come preconfigured with fast network interconnects, reducing the difference between HPC infrastructure and cloud infrastructure. There was even evidence presented that for some workloads, such cloud instance types could rival HPC runtimes on like-for-like tests.</p><p>As an aside that links to my recent travel, it was again noticeable that cloud uptake is much higher in the US than in Europe. This is the same pattern that we have observed in the Pangeo community.</p><h3>The end of the supercomputer era?</h3><p>The supercomputer remains the de facto HPC platform, but for how much longer? In the past a new supercomputer would, like for like, approximately provide an order of magnitude processing improvement over the outgoing supercomputer. So, for an supercomputer of a given physical size with a given number of processor cores, a new supercomputer with approximately the same size and number of processor cores would effectively give an order of magnitude more processing capacity.</p><p>This is a pattern that we are seeing drawing to a close. Improvements in processor technology have slowed dramatically, so a new supercomputer of approximately the same size as the outgoing one does not necessarily offer an order of magnitude increase in processing capacity any more. Instead, to see this order of magnitude improvement you need either a bigger supercomputer or one that includes some form of acclerators, which is OK unless you are limited by physical or fiscal resources.</p><p>This is all basically a statement of the end of Moore’s Law.</p><p>In the face of this, it’s the belief of the Informatics Lab that we need to look for new technologies to provide the de facto HPC platform of the future. This belief was one of the key points that I made in my talk at PASC19. It’s a disruptive viewpoint, and one that some found threatening, refusing to engage with arguments in support of it.</p><p>Of course, the end of the supercomputer era is not here yet. But even the content and major themes of PASC19 show that a supercomputer is no longer enough in a number of HPC applications. The end of the supercomputer era should not be seen as a threat but an exciting opportunity to shape the next era of HPC, in whatever forms it should come!</p><h3>A note about Zürich</h3><p>To finish in what is becoming traditional style for me, let me share my impressions (and a couple of photos) of Zürich.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hJ377r7zvLFLHar96__P8A.jpeg" /><figcaption>The Alps visible in the distance over Zürichsee</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MQVyCyoyYWtF5OtuMX9c2Q.jpeg" /><figcaption>Beautifully clear water in the river</figcaption></figure><p>The thing that everyone said to me about Zürich is that it is an expensive city. This was borne out in fact as well as in promise! Nothing sums this up better than the fact that Zürich’s Bahnhofstrasse is Europe’s most expensive shopping street. In every other way though Zürich is a lovely city containing amazing architecture, good food and very nice people. And one of the best places to view Zürich’s architecture is from the terrace at the back of ETH Zürich.</p><p>My favourite part of Zürich was probably the view from the bridge at the head of the lake down the lake. On a clear day it is possible to see the Alps from this vantage point. The lake is well worth making the most of, as the water, which drains down from the mountains, is beautifully clear.</p><p>If you get the chance to go to Zürich, don’t turn it down!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNVF9PYT8qTyi0GmsyMfhA.jpeg" /><figcaption>Looking over Zürich from the terrace at ETH Zürich</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff97cedc90ae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/informatics-lab/pasc19-ff97cedc90ae">My time at PASC19</a> was originally published in <a href="https://medium.com/informatics-lab">Met Office Informatics Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab on the Road: The Informatics Lab at EGU19]]></title>
            <link>https://medium.com/informatics-lab/lab-on-the-road-the-informatics-lab-at-egu19-a5835acb05a8?source=rss-42746d50cf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5835acb05a8</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[conference]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Peter Killick]]></dc:creator>
            <pubDate>Wed, 08 May 2019 08:46:25 GMT</pubDate>
            <atom:updated>2019-06-25T14:23:51.329Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lab on the Road</h3><h4>The Informatics Lab at EGU19</h4><p>The European Geosciences Union General Assembly 2019, or EGU19 for short, is one of the largest conferences on the geosciences in the world, and one of the largest academic conferences in Europe. It meets every year in April in Vienna, and brings together academics and practitioners from all over the geosciences — people studying everything from geology and soil sciences, to space science, to informatics and data science.</p><p>The diversity and number of topics is matched by the diversity and number of conference attendees, with over 15,000 people from all over the world visiting EGU19 over the course of the conference. Such diversity brings both opportunities and challenges: there is a lot available to learn from (and many people to teach!), but the content most appropriate for your own situation and studies can get lost amongst all the other content! Planning ahead is essential.</p><h3>Informatics Insights</h3><p>The Informatics Lab’s presentation contribution to EGU19 was made up of three posters — one about technology, one about Lab culture, and one about applying Machine Learning to atmospheric science. These themes together encapsulate some key areas of Informatics Lab thinking. Let’s explore each poster in a little more detail.</p><p><strong>The Technology One</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m8IxG_-ua7BvX8Bid1WPzA.png" /></figure><p>This poster demonstrated the application of a number of technologies to solving a real world weather data problem. We took the scalable data processing platform <a href="http://pangeo.io/">Pangeo</a>, open-source Python libraries <a href="https://scitools.org.uk/iris/docs/latest/">Iris</a> and <a href="https://intake.readthedocs.io/en/latest/">Intake</a>, and added custom code to produce a system where very large volumes of weather data can be loaded as a single datacube structure (which we prosaically named a SuperMegaHyperCube).</p><p>The target problem behind this poster is that weather and climate datasets are getting bigger and bigger. This makes the data harder to work with. There is often too much data to be able to process, at least on short timescales; the data often contains more dimensions than the human brain is able to easily comprehend; and it can be hard to locate the dataset that you need in amongst all the other datasets that have also been produced.</p><p><strong>The Culture One</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ua8tyDprLkHdVyvpPcwefw.png" /></figure><p>A new theme introduced at EGU19 was that of RSEs (Research Software Engineers). RSEs are researchers whose primary research target is creating software — either as a standalone task, or as part of a wider research group.</p><p>The Informatics Lab does not quite fit the description of a team of RSEs, as instead we work as a multidisciplinary team applying science, technology and design holistically to inform thinking on future direction for the UK Met Office.</p><p>Nevertheless, the Informatics Lab’s primary output is functional prototypes that detail the thinking behind each project we work on. These functional prototypes almost always involve producing code. This and the fact that the culture of the Informatics Lab is also quite different to that of many research groups in science has given us an interesting story to share, and it’s this story that’s shared in this poster.</p><p><strong>The Machine Learning One</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsOQ5aSSLmYTjkHNmnrV0Q.jpeg" /></figure><p>One member of the Informatics Lab’s multidisciplinary team is exploring the application of Machine Learning to forecasting the weather. Specifically, the focus is on a particularly gnarly area of weather forecasting: predicting the location of shower clouds at very high resolution.</p><p>Predicting exactly where showers will form is difficult because convective processes, which drive the formation of shower clouds, happen on a scale that is far smaller than the grid cells of even the highest resolution weather models run by the UK Met Office. This means there can be a rain shower occurring in part of a grid cell but not another part of the same grid cell! This presents a problem for the weather forecast: do you say it will or will not be raining within this grid cell?</p><p>Evidently this could be solved by making each grid cell in the weather model smaller. This is not a perfect solution though: decreasing the size of the grid cells increases the number of grid cells in the model, meaning the model both takes longer to run and generates bigger output files containing more data, which themselves take longer to process.</p><p>An alternative solution to this problem is the one presented in this poster: use machine learning to try and infer convective scale processes from existing model data without having to add more grid cells to the model. This removes the problems created by adding more grid cells, which is good. What’s not certain is whether machine learning can be effectively applied in this situation to produce valuable results, which is why this is such an important area of exploration.</p><h3>Elsewhere at the Conference</h3><p>Here’s the space for my feedback on my time at EGU19 — taking a look at what was good and interesting at the conference, and also the challenges it presented. During my time at the conference I also noticed some themes in the content being presented, so I’ll spend a bit of time here exploring those themes.</p><p>Here we go then:</p><ul><li>Machine learning is everywhere. A number of sessions I attended contained at least one presentation on using machine learning techniques, and there was at least one session entirely dedicated to machine learning. This appears to be an upward trend on previous years, suggesting that this reasonably new technique is becoming more mainstream as a research tool within the geosciences.</li><li>There was a theme of moving data processing to HPC and cloud infrastructures, as well as increasing focus on hybrid infrastructures combining both HPC hardware and cloud architecture. I wonder if this trend will continue, given how geophysical datasets are getting bigger and bigger, with the same requirement to process and visualise them.</li><li>A new term that I learned at EGU19 was RSEs: Research Software Engineers; researchers who write code (see above). These are researchers who write code that is itself scientific exploration, or enables other work that is scientific exploration. This definition is not a long way from the work of the Informatics Lab.</li><li>The Informatics Lab and ESSI (Earth and Space Science Informatics) programme group share a common term in their names. It’s also the programme group where Informatics Lab presentations fit most naturally and where content applicable to the Informatics Lab is most likely to be found at EGU. At EGU19, however, a lot of ESSI content had been merged with sessions run by other programme groups. This I feel is positive, because more and more Informatics concepts are being actively applied and researched in all areas of the geosciences.</li><li>Pangeo is not well-known in European Geosciences, something that is not so true in the USA. I nevertheless saw a lot of interest in Pangeo, as well as groups working on projects similar to Pangeo. This suggests there is a recognition that Pangeo-like systems are becoming increasingly necessary in the geosciences.</li><li>A common theme at EGU19 was that a lot of content in a given session would describe a very similar end product. There are positives to this, as it suggests that the product being developed is one that is important to contemporary geosciences, but it does also shine a light on a tendency within science to silo work, and reinvent instead of collaborate to produce a single common product rather than a number of replica products.</li></ul><h3>Holiday Snaps</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8W8LZdVMWgwO75oqHCreyg.jpeg" /><figcaption>Looking back on Schloss Schönbrunn</figcaption></figure><p>And finally, around a packed schedule at a busy EGU19 I also found some time for a bit of sightseeing. Having visited Vienna a few times in the past I feel I’ve ticked off many of the big tourist attractions in Vienna — I’ve taken a look inside Stephansdom, the imposing cathedral with patterned tiled roof at the very centre of Vienna; nodded to the golden statue of Johann Strauss in Stadtpark; and explored the grounds of Schloss Belvedere.</p><p>The one major tourist attraction I hadn’t managed to visit was Schloss Schönbrunn. So, with the opportunity to do some sightseeing around this year’s visit to EGU19, Schönbrunn was the obvious place to visit. And it was worth the visit — the palace itself is huge and partially open as a museum; and there are extensive grounds, and monuments within the grounds, to also explore. There was even an Easter market in the grounds as an added attraction.</p><h3>In Summary</h3><p>EGU19 was all about lots of content, lots of sessions, lots of interesting ideas (and a few repeated ones). There were three posters from the Informatics Lab that were well attended, and there was just a little bit of sightseeing for me. There’s just space here for me to thank all the organisers of EGU19 for putting together an excellent, useful and informative conference.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5835acb05a8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/informatics-lab/lab-on-the-road-the-informatics-lab-at-egu19-a5835acb05a8">Lab on the Road: The Informatics Lab at EGU19</a> was originally published in <a href="https://medium.com/informatics-lab">Met Office Informatics Lab</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>