<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Seb's repository</title>
 <link href="https://e5k.github.io/atom.xml" rel="self"/>
 <link href="https://e5k.github.io/"/>
 <updated>2021-12-10T08:11:56+00:00</updated>
 <id>https://e5k.github.io</id>
 <author>
   <name>Sébastien Biass</name>
   <email></email>
 </author>

 
 <entry>
   <title>TephraProb v.1.7</title>
   <link href="https://e5k.github.io/codes/2020/02/21/TephraProb_v1_7/"/>
   <updated>2020-02-21T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/2020/02/21/TephraProb_v1_7</id>
   <content type="html">&lt;p&gt;TephraProb v1.7 includes access to ERA-5 wind data, a different sampling of masses and some bug fixes.&lt;/p&gt;

&lt;h2 id=&quot;changes-in-tephraprob-v17&quot;&gt;Changes in TephraProb v1.7&lt;/h2&gt;
&lt;h3 id=&quot;added-functionalities&quot;&gt;Added functionalities&lt;/h3&gt;

&lt;h4 id=&quot;era-5&quot;&gt;ERA-5&lt;/h4&gt;
&lt;p&gt;ERA-5 is now available for download. It follows the same procedure as ERA-Interim (refer to manual), but it uses a different Python API (&lt;a href=&quot;https://pypi.org/project/cdsapi/#files&quot;&gt;cdsapi&lt;/a&gt;) - which also requires a new key.&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Create a new account on the &lt;a href=&quot;https://cds.climate.copernicus.eu/user/register?destination=/drupal_auth_check&quot;&gt;CDS website&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Retrieve your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UID&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;key&lt;/code&gt; and format it as such (where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1234&lt;/code&gt; is your UID and the string following the column is the API key):
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;url: https://cds.climate.copernicus.eu/api/v2
key: 1234:abcdefghij-134-abcdefgadf-82391b9d3f
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Enter this key in &lt;strong&gt;TephraProb&lt;/strong&gt; under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Input&lt;/code&gt; &amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Wind&lt;/code&gt; &amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Set ERA-5 API key&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Install the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cdsapi&lt;/code&gt; in &lt;strong&gt;TephraProb&lt;/strong&gt; using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Input&lt;/code&gt; &amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Wind&lt;/code&gt; &amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Install ERA-5 libraries&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note it is only required to perform steps 4-5 once.&lt;/p&gt;

&lt;h5 id=&quot;relevant-era-5-documentation&quot;&gt;Relevant ERA-5 documentation&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;Reference page for &lt;a href=&quot;https://confluence.ecmwf.int/display/CKB/ERA5&quot;&gt;ERA-5&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Good introduction to ERA-5 on &lt;a href=&quot;https://retostauffer.org/code/Download-ERA5/&quot;&gt;retostauffer.org&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Introduction to &lt;a href=&quot;https://cds.climate.copernicus.eu/api-how-to&quot;&gt;CDS API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;loading-wind-datasets&quot;&gt;Loading wind datasets&lt;/h4&gt;
&lt;p&gt;It is now possible to load existing datasets in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Input&lt;/code&gt; &amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Wind&lt;/code&gt; &amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Download Wind&lt;/code&gt; module.&lt;/p&gt;

&lt;h4 id=&quot;logarthmic-sampling-of-mass&quot;&gt;Logarthmic sampling of mass&lt;/h4&gt;
&lt;p&gt;For subplinian/Plinian scenarios, the sampling of the eruption mass when &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;constrain=0&lt;/code&gt; was linked to the distribution chosen for the plume height. A new variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mass_sample&lt;/code&gt; was introduced to control the shape of the distribution from which the mass is sampled:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mass_sample=0&lt;/code&gt;: the mass is sampled between &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;min_mass&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;max_mass&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mass_sample=1&lt;/code&gt;: the mass is sampled between log10(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;min_mass&lt;/code&gt;) and log10(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;max_mass&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;linking-outputs-to-original-esps&quot;&gt;Linking outputs to original ESPs&lt;/h4&gt;
&lt;p&gt;A new scheme was introduced to be able to link the content of the files &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dataProb.mat&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dataT2_*.mat&lt;/code&gt; located in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RUNS/runName/runNb/DATA/&lt;/code&gt;. This is explained in more details in&lt;/p&gt;

&lt;h3 id=&quot;bug-fixes&quot;&gt;Bug fixes&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Fixed a bug on the sampling wind profiles when &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;seasonality=1&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>TephraProb troubleshoot</title>
   <link href="https://e5k.github.io/codes/tips/2018/12/20/tephraprob_troubleshoot/"/>
   <updated>2018-12-20T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/tips/2018/12/20/tephraprob_troubleshoot</id>
   <content type="html">&lt;p&gt;This is an attempt to track issues that could not be solved within the code. Keep in mind that having a code that works on everybody’s computers is hard, especially on Windows where errors can arise because of loaaaaads of different factors. Also, please keep in mind I am not a personal hotline :)&lt;/p&gt;

&lt;h3 id=&quot;content&quot;&gt;Content&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#ecmwf-related-issues&quot;&gt;ECMWF-Related issues&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#pip&quot;&gt;Pip&lt;/a&gt;
        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#case-yey&quot;&gt;Case yey!&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#ssl&quot;&gt;SSL&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#setuptools&quot;&gt;Setuptools&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#ecmwf-python-api&quot;&gt;ECMWF Python API&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#tephra2-related-issues&quot;&gt;Tephra2 related issues&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#mac-os-1014-mojave&quot;&gt;Mac OS 10.14 Mojave&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;ecmwf-related-issues&quot;&gt;ECMWF-Related issues&lt;/h2&gt;

&lt;h3 id=&quot;pip&quot;&gt;Pip&lt;/h3&gt;
&lt;p&gt;Pip is a package manager, see it as an AppStore for nerds, but the principle is the same. Most of the errors related to the access to ECMWF datasets can be solved by installing small bits of code, and Pip helps with that. The first thing you have to check is whether Pip is installed on your system. To do so, you need to open a &lt;em&gt;terminal&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Windows&lt;/strong&gt;: Open the start menu and type &lt;cmd&gt;cmd&lt;/cmd&gt; and open &lt;em&gt;Command Prompt&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Mac OS&lt;/strong&gt;: Open &lt;em&gt;Terminal.app&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Linux&lt;/strong&gt;: I assume you know how to do it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now type:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;case-ney-&quot;&gt;Case ney :(&lt;/h4&gt;
&lt;p&gt;Do you see anything that tells you that &lt;cmd&gt;pip&lt;/cmd&gt; is not a recognized command? Then you need to install it. First, still in the terminal, let’s hope that the following command works&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;easy_install pip&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Else, you unfortunately need to figure it out using &lt;a href=&quot;https://www.makeuseof.com/tag/install-pip-for-python/&quot;&gt;this tutorial&lt;/a&gt;&lt;/p&gt;

&lt;h4 id=&quot;case-yey&quot;&gt;Case yey!&lt;/h4&gt;
&lt;p&gt;Move on to installing the required package as described below!&lt;/p&gt;

&lt;h3 id=&quot;ssl&quot;&gt;SSL&lt;/h3&gt;
&lt;p&gt;Error:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;urllib.error.URLError: &amp;lt;urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Fix:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip install pyopenssl&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;setuptools&quot;&gt;Setuptools&lt;/h3&gt;

&lt;p&gt;Error:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ImportError: No module named setuptools&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Fix:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip install setuptools&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;ecmwf-python-api&quot;&gt;ECMWF Python API&lt;/h3&gt;
&lt;p&gt;Summary of troubleshooting issues &lt;a href=&quot;https://confluence.ecmwf.int/display/WEBAPI/Web-API+Troubleshooting&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;tephra2-related-issues&quot;&gt;Tephra2 related issues&lt;/h2&gt;
&lt;h3 id=&quot;mac-os-1014-mojave&quot;&gt;Mac OS 10.14 Mojave&lt;/h3&gt;
&lt;p&gt;If error during compilation, &lt;a href=&quot;https://stackoverflow.com/questions/52509602/cant-compile-c-program-on-a-mac-after-upgrade-to-mojave&quot;&gt;this thread&lt;/a&gt; helps fixing it.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Random tools</title>
   <link href="https://e5k.github.io/notetomyself/2018/12/13/random_tools/"/>
   <updated>2018-12-13T00:00:00+00:00</updated>
   <id>https://e5k.github.io/notetomyself/2018/12/13/random_tools</id>
   <content type="html">&lt;p&gt;Just a repository of cool and handy tools.&lt;/p&gt;

&lt;h3 id=&quot;github-repositories&quot;&gt;Github repositories&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/dergachev/screengif&quot;&gt;Screengif&lt;/a&gt;: Software to convert screencasts to gifs&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/jgm/pandoc&quot;&gt;Pandoc&lt;/a&gt;: Convert text files between a lot of formats&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Python Resources</title>
   <link href="https://e5k.github.io/notetomyself/2018/12/04/Python_ressources/"/>
   <updated>2018-12-04T00:00:00+00:00</updated>
   <id>https://e5k.github.io/notetomyself/2018/12/04/Python_ressources</id>
   <content type="html">&lt;p&gt;Keeping track of interesting resources on Python.&lt;/p&gt;

&lt;h3 id=&quot;tutorials&quot;&gt;Tutorials&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://geologyandpython.com&quot;&gt;Geology and Python&lt;/a&gt;: Cool tutorials for Python applications to Earth sciences&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/patrickcgray/open-geo-tutorial&quot;&gt;Open Geo Tutorials&lt;/a&gt;: Intro to GIS, remote sensing and bits of machine/deep learning&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;github-repositories&quot;&gt;Github repositories&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/sdtaylor/pyPhenology&quot;&gt;pyPhenology&lt;/a&gt;: Phenology toolbox&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/welch/seasonal&quot;&gt;seasonal&lt;/a&gt;: Robustly estimate trend and periodicity in a timeseries&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/jgomezdans/geog0133-practicals&quot;&gt;geog0133-practicals&lt;/a&gt;: Practicals on phenology modeling (especially &lt;a href=&quot;https://hub.gke.mybinder.org/user/jgomezdans-geog0133-practicals-5ekr1cso/notebooks/04-Phenology_Modelling_Practical.ipynb&quot;&gt;this&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>GEE Resources</title>
   <link href="https://e5k.github.io/notetomyself/2018/11/30/GEE_ressources/"/>
   <updated>2018-11-30T00:00:00+00:00</updated>
   <id>https://e5k.github.io/notetomyself/2018/11/30/GEE_ressources</id>
   <content type="html">&lt;p&gt;Keeping track of interesting resources on the Google Earth Engine.&lt;/p&gt;

&lt;h3 id=&quot;example-scripts&quot;&gt;Example scripts&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Use of the 25th percentile to make cloud free mosaics &lt;a href=&quot;https://code.earthengine.google.com/643c86f713c64dea1d921358b8da0530&quot;&gt;link&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Merging of Landsat products &lt;a href=&quot;https://code.earthengine.google.com/62e1d22b56a11404dbfdbf49d6179f91&quot;&gt;link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;toolbox&quot;&gt;Toolbox&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;GEE implementation of the LandTrendr spectral-temporal segmentation algorithm &lt;a href=&quot;https://github.com/eMapR/LT-GEE&quot;&gt;link&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;GEE tile layers with Folium &lt;a href=&quot;https://github.com/mccarthyryanc/folium_gee&quot;&gt;link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;tutorials&quot;&gt;Tutorials&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://mygeoblog.com&quot;&gt;MyGeoBlog&lt;/a&gt;: Great tutorials&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;papers&quot;&gt;Papers&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www-sciencedirect-com.ezlibproxy1.ntu.edu.sg/science/article/pii/S0034425715302455&quot;&gt;Roy et al. (2016)&lt;/a&gt;: Scaling between Landsat 7 and 8&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;tips&quot;&gt;Tips&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Assign value to masked regions &lt;a href=&quot;https://gis.stackexchange.com/questions/279907/gee-how-to-transform-masked-values-nodata-to-9999&quot;&gt;link&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
    &lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;Empty cells in table export [link](https://groups.google.com/forum/#!searchin/google-earth-engine-developers/reduce$20collection$20empty&lt;/td&gt;
          &lt;td&gt;sort:date/google-earth-engine-developers/qsoHZ9Dhqlw/&lt;strong&gt;kJncwcXUEAAJ&lt;/strong&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;maps&quot;&gt;Maps&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Intro to Folium (french) &lt;a href=&quot;http://www.portailsig.org/content/python-leaflet-folium-ou-comment-creer-des-cartes-interactives-simplement&quot;&gt;link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Find wind profiles most similar to an average</title>
   <link href="https://e5k.github.io/codes/2018/10/31/wind_similarity/"/>
   <updated>2018-10-31T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/2018/10/31/wind_similarity</id>
   <content type="html">&lt;p&gt;Ever needed to find the &lt;em&gt;one&lt;/em&gt; wind profile most similar to an average wind profile? A new function in the &lt;cmd&gt;Analyse wind profiles&lt;/cmd&gt; of TephraProb does just that!&lt;/p&gt;

&lt;h2 id=&quot;access-the-tool&quot;&gt;Access the tool&lt;/h2&gt;
&lt;p&gt;The tool is available from &lt;cmd&gt;Tools &amp;gt; Find similar profiles&lt;/cmd&gt; in the &lt;cmd&gt;Analyse wind profiles&lt;/cmd&gt; window. Some specific parameters should be set for the code to work, namely:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Type&lt;/strong&gt; must be &lt;em&gt;Profiles&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Average&lt;/strong&gt; must be &lt;em&gt;Averaged&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Direction&lt;/strong&gt; must be &lt;em&gt;Direction&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;method&quot;&gt;Method&lt;/h2&gt;
&lt;p&gt;The similarity between one wind profile and an average profiles is assessed following these steps:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;The root mean square error of both direction and velocity is calculated between &lt;em&gt;all&lt;/em&gt; wind profiles in the database and the average wind profile across all heights&lt;/li&gt;
  &lt;li&gt;The euclidian distance between the direction and the velocity is minimised&lt;/li&gt;
  &lt;li&gt;The similarity is expressed in terms of decreasing euclidian distance&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;use-the-tool&quot;&gt;Use the tool&lt;/h2&gt;
&lt;p&gt;Upon clickling the tool, keep in mind that the average data used in the process is the data that is plotted in the axis. So should you select the average over a specific range of months, the most similar wind profile will reflect that range.&lt;/p&gt;

&lt;p&gt;The first option popping up allows to choose a range of elevations over which the previous calculation is applied. Having a plume height of 15 km asl above a volcano located at 5 km asl, the entire range of altitudes provided by reanalysis databases might not be relevant. This option allows to target where the similarity matters,&lt;/p&gt;

&lt;p&gt;The next window that opens contains the 100 most similar wind profiles ordered from top to bottom in decreasing similarity. In other word, the first item in the list is the best fit. Each wind profile is named with the date - remember that the hours are UTC - and the corresponding file number as named by TephraProb. You can now explore which single profile is best for you by plotting one or multiple profiles.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/similarwind.jpg&quot; alt=&quot;Wind interface&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>TephraProb v.1.6</title>
   <link href="https://e5k.github.io/codes/2018/10/02/TephraProb_v1_6/"/>
   <updated>2018-10-02T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/2018/10/02/TephraProb_v1_6</id>
   <content type="html">&lt;p&gt;There has been a change in the access to the Google Map API used by the function &lt;a href=&quot;https://au.mathworks.com/matlabcentral/fileexchange/27627-zoharby-plot_google_map&quot;&gt;plot_google_map&lt;/a&gt; by Zohar Bar-Yehuda that can cause problems when TephraProb attempts to retrieve the map background. Google now requires to get an API Key, which needs to be associated with a Google Project and, tadaaaa, a billing account. Although this is likely to remain free for a small number of requests, some might be reluctant to add a billing account to get a key. A new function offering to export maps to Google Earth was therefore implemented, which relies on the &lt;a href=&quot;https://au.mathworks.com/matlabcentral/fileexchange/12954-google-earth-toolbox&quot;&gt;Google Earth Toolbox&lt;/a&gt; by Scott Lee Davis.&lt;/p&gt;

&lt;h2 id=&quot;changes-in-tephraprob-v16&quot;&gt;Changes in TephraProb v1.6&lt;/h2&gt;
&lt;h3 id=&quot;tephraprob-preferences&quot;&gt;TephraProb preferences&lt;/h3&gt;
&lt;p&gt;The preference pannel has been reworked. Regarding Google Maps, the options are:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Choose whether a basemap should be plotted. The option for Google Map  remains, knowing that problems may occur if not used with an API Key;&lt;/li&gt;
  &lt;li&gt;Enter an API Key for Google Map, which is likely to solve the problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Regarding Google Earth, the options are:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Choose to export the set of plotted data to Google Earth. If selected, this option saves a &lt;pth&gt;.kmz&lt;/pth&gt; file in &lt;pth&gt;RunName/RunNb/KML/&lt;/pth&gt;;&lt;/li&gt;
  &lt;li&gt;Choose to display the &lt;pth&gt;.kmz&lt;/pth&gt; upon completion of the generation of the maps. Note that this process will attempt to open the &lt;pth&gt;.kmz&lt;/pth&gt; file with the default software assigned in your system for this file extension. If your computer opens another software, you must manually change the default software used for &lt;pth&gt;.kmz&lt;/pth&gt; files.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;google-earth-output-file&quot;&gt;Google Earth output file&lt;/h3&gt;
&lt;p&gt;If the option described above is selected, TephraProb will generate a Google Earth file upon completion of the &lt;cmd&gt;Display / Probability maps&lt;/cmd&gt; and &lt;cmd&gt;Display / Isomass maps&lt;/cmd&gt; functions. The Google Earth file generated by TephraProb is a &lt;em&gt;KMZ&lt;/em&gt; file, which is an archive containing all the associated files required for display that can easily be shared amongst people. Once opened, the file contains:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Each map selected for plotting in TephraProb;&lt;/li&gt;
  &lt;li&gt;A color bar;&lt;/li&gt;
  &lt;li&gt;The extent of the original computation grid. Note that some re-interpolation is necessary to plot the maps in Google Earth and some data may appear outside the computation domain. &lt;strong&gt;This is an artefact&lt;/strong&gt; and should be considered as such;&lt;/li&gt;
  &lt;li&gt;The vent.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionaly, if i) hazard curves have been computed for the working project , ii) the option &lt;cmd&gt;Plot hazard curve location&lt;/cmd&gt; is activated in the preferences and iii) probability maps are being plotted, TephraProb adds the location of the hazard curves in the &lt;pth&gt;.kmz&lt;/pth&gt; file. These points are clickable and will display the hazard curves.&lt;/p&gt;

&lt;h3 id=&quot;added-dependency&quot;&gt;Added dependency&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Function &lt;a href=&quot;https://au.mathworks.com/matlabcentral/fileexchange/12954-google-earth-toolbox&quot;&gt;Google Earth Toolbox&lt;/a&gt; by Scott Lee Davis.&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Wind data for Tephra2</title>
   <link href="https://e5k.github.io/tips/2018/07/27/wind_tephra2/"/>
   <updated>2018-07-27T00:00:00+00:00</updated>
   <id>https://e5k.github.io/tips/2018/07/27/wind_tephra2</id>
   <content type="html">&lt;p&gt;I thought I’d share some problems I’ve recently encountered with the format of wind files used in Tephra2. Just as a reminder, wind file should be a 3-columns, tab-delimited ASCII file containing:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;em&gt;Column 1&lt;/em&gt;: Altitude (m asl)&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Column 2&lt;/em&gt;: Wind speed (m/s)&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Column 3&lt;/em&gt;: Wind direction (i.e. the direction the wind blows to; degrees from N)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s review some aspects that can cause problems in Tephra2.&lt;/p&gt;

&lt;h2 id=&quot;null-elevations&quot;&gt;Null elevations&lt;/h2&gt;
&lt;p&gt;Tephra2 no like no 0 m elevation. Period. The reason is that wind directions and velocities are interpolated between levels. Entering a minimum elevation of 0 m asl will cause an error in the interpolation, which will not be output but &lt;em&gt;will produce unrealistic results&lt;/em&gt;&lt;/p&gt;

&lt;h2 id=&quot;end-of-the-file&quot;&gt;End-of-the-file&lt;/h2&gt;
&lt;p&gt;It should not matter whether wind profiles are organised with &lt;em&gt;ascending&lt;/em&gt; or &lt;em&gt;descending&lt;/em&gt; altitudes as Tephra2 re-orders it anyway. &lt;strong&gt;BUT&lt;/strong&gt;, because there is a but, one thing that can cause a problem is the definition of the &lt;a href=&quot;https://en.wikipedia.org/wiki/End-of-file&quot;&gt;End of the File&lt;/a&gt; - or &lt;strong&gt;EOF&lt;/strong&gt;, which is:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;…a condition in a computer operating system where no more data can be read from a data source.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This EOF can have an impact when &lt;strong&gt;i)&lt;/strong&gt; wind files are organised in descending elevations and &lt;strong&gt;ii)&lt;/strong&gt; the EOF is a new line (i.e. check if a file has an empty line at the end). If these two conditions occur, Tephra2 will reorder the wind data in ascending order, which will result in empty data as the first line and all hell will break loose.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;The two main important points in the format of wind files for Tephra2 are:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Wind files should not contain elevations of 0 m asl. Enter 1 instead&lt;/li&gt;
  &lt;li&gt;Avoid empty lines in wind files, or at least make sure wind files are organised in increasing elevations&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;how-to-notice-problems&quot;&gt;How to notice problems?&lt;/h3&gt;
&lt;p&gt;As already specified, should these problem occur, Tephra2 &lt;em&gt;will not&lt;/em&gt; output an error but &lt;em&gt;will&lt;/em&gt; produce unrealistic results. From experience, bogus results tend to display &lt;strong&gt;a conspicuous eastwards dispersal&lt;/strong&gt;. So always double check the model output against the wind data, which is valid for both Tephra2 and TephraProb!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>TephraProb v.1.5</title>
   <link href="https://e5k.github.io/codes/2018/07/27/TephraProb_v1_5/"/>
   <updated>2018-07-27T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/2018/07/27/TephraProb_v1_5</id>
   <content type="html">&lt;p&gt;Version releases were never systematically attributed to TephraProb until now. This new version was labeled &lt;strong&gt;v1.5&lt;/strong&gt; as some important changes have been made.&lt;/p&gt;

&lt;h2 id=&quot;changes-in-tephraprob-v15&quot;&gt;Changes in TephraProb v1.5&lt;/h2&gt;
&lt;h3 id=&quot;probability-calculations&quot;&gt;Probability calculations&lt;/h3&gt;
&lt;p&gt;Changes on storage of probability data have been made to reduce disk space usage and improve speed of reading Tephra2 outputs during probability calculations. Namely, the &lt;cmd&gt;probability_maker&lt;/cmd&gt; function, accessed from &lt;cmd&gt;Post processing &amp;gt; Probability calculations&lt;/cmd&gt; in TephraProb, proceeds in 2 steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Read the Tephra2 output, sums them if needed and stores the output in &lt;pth&gt;RunName/RunNb/DATA/dataT2_*.mat&lt;/pth&gt;. This is a 3D matrix, where the 3rd dimension equals the number of runs (i.e. each summed Tephra2 output is stored along the 3rd dimension). The 1st and 2nd dimensions vary with the grid type:
    &lt;ul&gt;
      &lt;li&gt;If runs are performed on a &lt;strong&gt;full grid&lt;/strong&gt;, dimensions 1 and 2 are equal to the dimensions of the grid northing and easting, respectively&lt;/li&gt;
      &lt;li&gt;If runs are performed on a &lt;strong&gt;list of points&lt;/strong&gt;, each output is in a 3 column format, with dimension 1 equal to the number of points and dimension 2 being [easting, northing, mass accumulation]&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;This new output is used for probabilit calculations, which are stored in  &lt;pth&gt;RunName/RunNb/DATA/dataProb.mat&lt;/pth&gt;. This file loads a Matlab structure containing the outputs of probability maps, probabilistic isomass maps and hazard curves&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note that to save disk space, the output of Tephra2 is now:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Rounded to a significant digit number&lt;/li&gt;
  &lt;li&gt;Accumulations below a thresholds are considered equal to zero&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Both the significand digit number and the thresholds are controlled in the preferences of TephraProb, accessible from &lt;cmd&gt;File &amp;gt; Preferences&lt;/cmd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;export-to-ascii-files&quot;&gt;Export to ASCII files&lt;/h3&gt;
&lt;p&gt;ASCII files previously generated upon completion of the post-processing stage are not automatically generated  anymore, which save a considerable amount of disk storage (i.e. the &lt;pth&gt;3C/&lt;/pth&gt;, &lt;pth&gt;GIS/&lt;/pth&gt; and &lt;pth&gt;MAT/&lt;/pth&gt; foldeds in the &lt;pth&gt;SUM/&lt;/pth&gt;, &lt;pth&gt;PROB/&lt;/pth&gt; and &lt;pth&gt;IM/&lt;/pth&gt; folders). Instead, a new function accessible from &lt;cmd&gt;Post processing &amp;gt; File management &amp;gt; Export to ASCII files&lt;/cmd&gt; allows the user to choose the type and the format of files to export.&lt;/p&gt;

&lt;h3 id=&quot;archive-tephra2-files&quot;&gt;Archive Tephra2 files&lt;/h3&gt;
&lt;p&gt;A new function available from &lt;cmd&gt;Post processing &amp;gt; File management &amp;gt; Archive Tephra2 files&lt;/cmd&gt; offers to compress files generated by and for Tephra2 (i.e. the &lt;pth&gt;OUT/&lt;/pth&gt;, &lt;pth&gt;CONF/&lt;/pth&gt; and &lt;pth&gt;GS/&lt;/pth&gt; folders). This was also implemented with concern for disk space usage. Note that this function should only be used &lt;strong&gt;once the Tephra2 modelling has successfully completed&lt;/strong&gt;. This process takes a long time due to to the large amount of small files and individual folders created.&lt;/p&gt;

&lt;h3 id=&quot;probabilistic-isomass-maps&quot;&gt;Probabilistic isomass maps&lt;/h3&gt;
&lt;p&gt;The method used to compute probabilistic isomass maps has been re-written and uses a percentile approach rather than an interpolation of iso-probability contours on probability maps. Note that a probability of occurrence of a given isomass is given by &lt;strong&gt;the inverse of the percentile&lt;/strong&gt;, i.e. a percentile of 25% reflects a 75% probability of occurrence.&lt;/p&gt;

&lt;h3 id=&quot;hazard-curves&quot;&gt;Hazard curves&lt;/h3&gt;
&lt;p&gt;It is now possible to import text files in the &lt;cmd&gt;Input &amp;gt; Points&lt;/cmd&gt; dialogue box. Text files should be 3-columns tab-delimited ASCII files with columns containing:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;em&gt;Column 1&lt;/em&gt;: Point name&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Column 2&lt;/em&gt;: Latitude (decimal degree, WGS84)&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Column 3&lt;/em&gt;: Longitude (decimal degree, WGS84)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;map-preferences&quot;&gt;Map preferences&lt;/h3&gt;
&lt;p&gt;A more in-depth customization of output maps is now offered from &lt;cmd&gt;File &amp;gt; Preferences&lt;/cmd&gt;. These parameters allow to:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Scale the colors of probability and isomass maps to the min/max values set in their respective contours. For instance, this is useful for plotting isomass maps for various probability threshold while preserving the value of a pixel color across maps&lt;/li&gt;
  &lt;li&gt;Control the display of contours labels. This is useful when the display gets jammed&lt;/li&gt;
  &lt;li&gt;Plot the points used for the calculation of hazard curves and their names&lt;/li&gt;
  &lt;li&gt;Chose the colormaps&lt;/li&gt;
  &lt;li&gt;Plot probabilistic isomass maps with a logarithmic colormap&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;bug-fix&quot;&gt;Bug fix&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;A bug was corrected for Plinian scenarios, causing problems in the calculation of eruption duration for eruptions &amp;gt; 6h and the long-lasting option disactivated&lt;/li&gt;
  &lt;li&gt;A problem was reported by two users concerning an improper interpretation of ECMWF wind files in Tephra2. The problem is discussed &lt;a href=&quot;/tips/2018/07/27/wind_tephra2/&quot;&gt;here&lt;/a&gt;. Changes were made in TephraProb to avoid the occurrence of this bug, but please &lt;strong&gt;check any run that could have been affected&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>TephraProb on a cluster</title>
   <link href="https://e5k.github.io/codes/2018/06/08/tephraprob-parallel/"/>
   <updated>2018-06-08T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/2018/06/08/tephraprob-parallel</id>
   <content type="html">&lt;p&gt;There is a relatively easy way to parallelise TephraProb on a computer cluster without having to struggle with Matlab’s Parallel Computing Toolbox. Matlab is not even needed on the cluster, and it is just a matter of sending single occurrences of Tephra2 on different nodes. Here is how to do so:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Generate your input files and eruption scenarios locally&lt;/li&gt;
  &lt;li&gt;Send the required files on the cluster&lt;/li&gt;
  &lt;li&gt;Run the scenario on the cluster&lt;/li&gt;
  &lt;li&gt;Retrieve the output files from the cluster to the local computer&lt;/li&gt;
  &lt;li&gt;Post-process the output files (e.g. probability calculations) locally&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;setting-up-remote-files&quot;&gt;Setting up remote files&lt;/h2&gt;
&lt;p&gt;Following the procedure in the &lt;a href=&quot;/files/tephraprob_man.pdf&quot; target=&quot;_blank&quot;&gt;TephraProb manual&lt;/a&gt;, all tasks should be completed until section 5.3 - meaning you should be set to hit the &lt;var&gt;Run Tephra2&lt;/var&gt; function. The main file that will be used for the parallelisation is &lt;strong&gt;T2_stor.txt&lt;/strong&gt;, located in &lt;pth&gt;RUNS/runName/runNumber/T2_stor.txt&lt;/pth&gt;, which contains the Tephra2 commands for all single model runs of the scenario.&lt;/p&gt;

&lt;p&gt;Transfer your run, grid and wind files on the cluster. Unless you decide to customize &lt;pth&gt;T2_stor.txt&lt;/pth&gt;, the directory tree once on the cluster should look like the following. Note that &lt;strong&gt;not all&lt;/strong&gt; files of the &lt;pth&gt;RUNS/&lt;/pth&gt;, &lt;pth&gt;GRID/&lt;/pth&gt; and &lt;pth&gt;WIND&lt;/pth&gt; folders need to be transferred.&lt;/p&gt;

&lt;pre&gt;
ROOT
├── MODEL/
├── RUNS/
│   └── runName/
│       └── runNumber/
│           ├── CONF/*.*
│           ├── GS*.*
│           └── OUT/*.*
├── WIND/
│   └── windName/
│           └── pathToAscii/*.*
├── GRID/
│   └── gridName/
│           └── *.utm
├── T2_stor.txt
└── runTephraProb.sh
&lt;/pre&gt;

&lt;p&gt;Note that &lt;pth&gt;T2_stor.txt&lt;/pth&gt; should be at the root, and all commands specified in it should point to locations that have been uploaded on the cluster. Note that by default, all paths defined in &lt;pth&gt;T2_stor.txt&lt;/pth&gt; are &lt;em&gt;relative&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;cmd&gt;rsync&lt;/cmd&gt; becomes handy here. To copy &lt;pth&gt;RUNS/&lt;/pth&gt; folders, you can use something like the following command, which will ignore all unecessary files and folders:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rsync &lt;span class=&quot;nt&quot;&gt;-arvz&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.mat &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt; FIG &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt; KML &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt; LOG &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt; SUM  RUNS/run_name host@server:~/TephraProb/RUNS/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;compiling-tephra2&quot;&gt;Compiling Tephra2&lt;/h2&gt;
&lt;p&gt;Tephra2 needs to be recompiled for the cluster’s architecture. On the cluster, from the root of TephraProb, navigate to &lt;pth&gt;MODEL/forward_src/&lt;/pth&gt; and enter:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;make
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, navigate back to the root of TephraProb and type:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;755 MODEL/tephra2-2012
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;That should get Tephra2 running on the cluster. Getting a &lt;cmd&gt;File format not recognized&lt;/cmd&gt; error? See if &lt;a href=&quot;https://e5k.github.io/codes/tips/2017/12/11/tephra2_manual_compilation/&quot;&gt;that&lt;/a&gt; helps.&lt;/p&gt;

&lt;h2 id=&quot;running-in-parallel&quot;&gt;Running in parallel&lt;/h2&gt;

&lt;p&gt;The parallelization is achieved using &lt;em&gt;job arrays&lt;/em&gt;. Conceptually:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;pth&gt;T2_stor.txt&lt;/pth&gt;
    &lt;p&gt;is cut in smaller files named &lt;pth&gt;T2_stor.txt00&lt;/pth&gt;, &lt;pth&gt;T2_stor.txt01&lt;/pth&gt; … &lt;pth&gt;T2_stor.txtXX&lt;/pth&gt; using the &lt;cmd&gt;split&lt;/cmd&gt; Unix command&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;The subset of commands to Tephra2 in each of the sub-file is sent to a different node using a &lt;em&gt;job array&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On the cluster, split &lt;pth&gt;T2_stor.txt&lt;/pth&gt;:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;split&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; 1000 &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; 2 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; T2_stor.txt T2_stor.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;where &lt;cmd&gt;-l&lt;/cmd&gt; is the number of line of each sub-file (here &lt;pth&gt;T2_stor.txt&lt;/pth&gt; will be split into subsets of 1000 lines) and &lt;cmd&gt;-a&lt;/cmd&gt; is the number of digits appended to the name of the subfile (e.g. -a 2 produces 01, 02 etc…). The last argument is the generic name of the sub-file.&lt;/p&gt;

&lt;p&gt;Let’s say that this created 10 files named &lt;pth&gt;T2_stor.txt00&lt;/pth&gt; to &lt;pth&gt;T2_stor.txt09&lt;/pth&gt;. We need to adapt the job array to account for the range 0-9. We then use a handy little piece of code called &lt;a href=&quot;https://savannah.gnu.org/projects/parallel/&quot;&gt;GNU Parallel&lt;/a&gt; to send single CPU jobs to the nodes.&lt;/p&gt;

&lt;h3 id=&quot;slurm&quot;&gt;SLURM&lt;/h3&gt;

&lt;p&gt;On a SLURM cluster, the bash &lt;pth&gt;runTephraProb.sh&lt;/pth&gt; might look like that:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;module load GCC/4.9.3-2.25
module load OpenMPI/1.10.2
module load parallel
&lt;span class=&quot;nv&quot;&gt;chunk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;printf&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;%02d&quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$SLURM_ARRAY_TASK_ID&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
srun parallel &lt;span class=&quot;nt&quot;&gt;-j&lt;/span&gt; 16 &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; T2_stor.txt&lt;span class=&quot;nv&quot;&gt;$chunk&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The job can then be submitted using:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sbatch &lt;span class=&quot;nt&quot;&gt;--array&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0-9 runTephraProb.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;openpbs&quot;&gt;OpenPBS&lt;/h3&gt;
&lt;p&gt;On an OpenPBS cluster, the bash &lt;pth&gt;runTephraProb.sh&lt;/pth&gt; might look like that:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;module load openmpi/1.4.5-gnu
module load parallel
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$PBS_O_WORKDIR&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;chunk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;printf&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;%02d&quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$PBS_ARRAYID&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
mpirun &lt;span class=&quot;nt&quot;&gt;-np&lt;/span&gt; 12 &lt;span class=&quot;nt&quot;&gt;-machinefile&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$PBS_NODEFILE&lt;/span&gt; parallel &lt;span class=&quot;nt&quot;&gt;-j&lt;/span&gt; 12 &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; T2_stor.txt.&lt;span class=&quot;nv&quot;&gt;$chunk&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The job can then be submitted using:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;qsub &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; 0-9 runTephraProb.sh 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;post-processing&quot;&gt;Post-processing&lt;/h2&gt;
&lt;p&gt;Once the modelling is finished, copy the remote version of &lt;pth&gt;RUNS/runName/runNumber/OUT/&lt;/pth&gt; on to your local &lt;pth&gt;RUNS/runName/runNumber/OUT/&lt;/pth&gt; and go on with the post-processing. Again, the &lt;cmd&gt;rsync&lt;/cmd&gt; command can help you achieve something like that:
The job can then be submitted using:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rsync &lt;span class=&quot;nt&quot;&gt;-arvz&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--ignore-existing&lt;/span&gt; host@server:~/TephraProb/RUNS/run_name/ RUNS/run_name/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Tephra2 Inversion</title>
   <link href="https://e5k.github.io/codes/utilities/2018/06/06/inversion/"/>
   <updated>2018-06-06T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/utilities/2018/06/06/inversion</id>
   <content type="html">&lt;p&gt;The current set of functions helps running the advection-diffusion model Tephra2 in inversion mode to estimate the best eruption source parameters (ESP) of a tephra deposit. The functions contain two sections. A first section contains a mixture of bash and python scripts for running the inversion of &lt;em&gt;OpenPBS&lt;/em&gt; and &lt;em&gt;SLURM&lt;/em&gt; clusters. A second section contains Matlab scripts for processing the inversion output designed to help its interpretation.&lt;/p&gt;

&lt;h4 id=&quot;updates---november-2018&quot;&gt;Updates - November 2018&lt;/h4&gt;
&lt;p&gt;The inversion scripts have been updated in November 2018. To find the scripts to post-process runs performed before this date, please download the previous version &lt;a href=&quot;https://github.com/e5k/Tephra2Utils/archive/v1.0.zip&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;table-of-content&quot;&gt;Table of content&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#introversion&quot;&gt;Introversion&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#single-vs-batch-runs&quot;&gt;Single vs. batch runs&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#caveats&quot;&gt;Caveats&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#installation&quot;&gt;Installation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#getting-started&quot;&gt;Getting started&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#case-study-files&quot;&gt;Case-study files&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#configuration-file&quot;&gt;Configuration file&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#running-the-inversion&quot;&gt;Running the inversion&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#single-vs-batch-vs-seed-runs&quot;&gt;Single vs. batch vs. seed runs&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#openpbs&quot;&gt;OpenPBS&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#post-processing&quot;&gt;Post-processing&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#output-figures&quot;&gt;Output figures&lt;/a&gt;
        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#1-spaces-of-solutions&quot;&gt;1. &lt;em&gt;Spaces&lt;/em&gt; of solutions&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#2-everything-against-everything&quot;&gt;2. Everything against everything!&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;introversion&quot;&gt;Introversion&lt;/h2&gt;
&lt;p&gt;The inversion searches for the set of ESP that best reproduce &lt;em&gt;observed&lt;/em&gt; values of tephra accumulations (kg/m&lt;sup&gt;2&lt;/sup&gt;) with the &lt;em&gt;computed&lt;/em&gt; values produced by Tephra2. As for any optimization problem, the many degrees of freedom require a critical interpretation of the inversion results. These scripts help building an empirical vision of the results in the perspective of the knowledge of the studied eruption.&lt;/p&gt;

&lt;p&gt;For a purpose of illustration, let’s consider that the fit depends mainly on &lt;em&gt;plume height&lt;/em&gt; and &lt;em&gt;eruption mass&lt;/em&gt;. We will therefore attempt to find the combination of plume height and eruption mass that best reproduce the deposit. To do so, the Tephra2 uses a &lt;a href=&quot;https://en.wikipedia.org/wiki/Nelder–Mead_method&quot;&gt;downhill simplex&lt;/a&gt; method, which searches for the minimum of a function - here the fit between observed and computed values - between user-defined ranges of [height&lt;sub&gt;min&lt;/sub&gt; - height&lt;sub&gt;max&lt;/sub&gt;] and [mass&lt;sub&gt;min&lt;/sub&gt; - mass&lt;sub&gt;max&lt;/sub&gt;].&lt;/p&gt;

&lt;p&gt;Unfortunately, this method can suffer from numerical artifacts resulting in “fake” minima, especially when initial user-defined ranges are too large. For instance let’s consider two sets of plume heights and mass, height&lt;sub&gt;1&lt;/sub&gt;, mass&lt;sub&gt;1&lt;/sub&gt; and height&lt;sub&gt;2&lt;/sub&gt;, mass&lt;sub&gt;2&lt;/sub&gt;, both giving a similarly good solution from a numerical perspective, but height&lt;sub&gt;1&lt;/sub&gt;, mass&lt;sub&gt;1&lt;/sub&gt; being irrealistic from a volcanological point of view. We therefore need a method to subjectively discard this solution from the inversion result.&lt;/p&gt;

&lt;h3 id=&quot;single-vs-batch-runs&quot;&gt;Single vs. batch runs&lt;/h3&gt;
&lt;p&gt;To avoid this problem, it is possible to run the inversion using three approaches, the &lt;em&gt;single&lt;/em&gt;, the &lt;em&gt;batch&lt;/em&gt; and the &lt;em&gt;seed&lt;/em&gt; modes. The &lt;strong&gt;single&lt;/strong&gt; mode searches for a minimum within the entire space defined by the ranges of plume heights and masses and consists of one single inversion run. The &lt;strong&gt;batch&lt;/strong&gt; mode splits the space of plume heights and masses into smaller domains, and one inversion run is performed for each domain. The &lt;strong&gt;seed&lt;/strong&gt; mode, for a lack of a better term, is pretty much the equivalent of the &lt;em&gt;single&lt;/em&gt; mode repeated multiple times varying the &lt;em&gt;seed&lt;/em&gt;. The &lt;em&gt;seed&lt;/em&gt; is a number that controls the reproducability of stochastic runs, and in the case of the inversion it will control the starting point of the optimisation process. In case of unconstrained deposits, varying the seed is likely to affect the results. It is a good procedure to assess the sensitivity of the results to the input seed.&lt;/p&gt;

&lt;p&gt;So what are the advantages and disadvantages of each method?&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Single&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;em&gt;Pros:&lt;/em&gt; Provides the most accurate minimum&lt;/li&gt;
      &lt;li&gt;&lt;em&gt;Cons:&lt;/em&gt; Can get stuck in local minima&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Batch&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;em&gt;Pros:&lt;/em&gt; Provides an overview of all minima on the height-mass space&lt;/li&gt;
      &lt;li&gt;&lt;em&gt;Cons:&lt;/em&gt; Small sub-spaces do not provide enough flexibility to accuratly define minima&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Seed&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;em&gt;Pros:&lt;/em&gt; Advantages of the single approach without disadvantages&lt;/li&gt;
      &lt;li&gt;&lt;em&gt;Cons:&lt;/em&gt; Euuh… Not sure, it’s pretty much my prefered approach now&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;/h3&gt;

&lt;p&gt;Below are a few things to keep in mind when using the inversion:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;The mass is always better constrained than the plume height&lt;/li&gt;
  &lt;li&gt;Constraining the plume height is more difficult because of the fact that in Tephra2, the plume height is intrinsically related to the computation of parameters controlling i) the grain size distribution, ii) the distribution of mass in the plume and iii) empirical parameters&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;

&lt;p&gt;Two components are needed, both available on GitHub:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Tephra2 source code, available &lt;a href=&quot;https://github.com/ljc-geo/tephra2&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Tephra2Utils, available &lt;a href=&quot;https://github.com/e5k/Tephra2Utils&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Tephra2, as far as we are concerned here, we only need the two executables created by the compilation of Tephra2 (&lt;em&gt;tephra2012_inversion&lt;/em&gt; and &lt;em&gt;tephra2-2012&lt;/em&gt;). For Tephra2Utils, we need the entire &lt;pth&gt;Inversion/&lt;/pth&gt; directory and the post processing files (&lt;pth&gt;plotBetaPlume.m&lt;/pth&gt;, &lt;pth&gt;plotT2.m&lt;/pth&gt; and &lt;pth&gt;processT2Inversion.m&lt;/pth&gt;).&lt;/p&gt;

&lt;p&gt;Organize your working folder like this:&lt;/p&gt;

&lt;pre&gt;
ROOT
├── Inversion/
│       ├── _example_folder/                    -&amp;gt; Example of input files
│       │        ├── forwardGrid.utm
│       │        ├── inversionConfig.conf
│       │        ├── inversionInput.txt
│       │        ├── inversionWind.txt
│       │        └── runInversion.sh
│       ├── _scripts/                           -&amp;gt; Scripts used during inversion*
│       │        ├── genConfig.py
│       ├── _templates/                        -&amp;gt; Templates used during inversion*
│       │        ├── forwardConfTemplate.conf
│       │        └── inversionConfTemplate.conf
├── dependencies/                               -&amp;gt; Dependencies for post-processing*
│       └── xlwrite/
├── plotBetaPlume.m                             -&amp;gt; Used during post-processing*
├── plotT2.m                                    -&amp;gt; Used during post-processing*
├── processT2Inversion.m                        -&amp;gt; Main post-processing function*
├── plotT2Inversion.m                           -&amp;gt; Plot results of batch and seed runs*
├── tephra2012_inversion                        -&amp;gt; Tephra2 inversion exec
└── tephra2-2012                                -&amp;gt; Tephra2 forward exec

* Should not have to be edited
&lt;/pre&gt;

&lt;h2 id=&quot;getting-started&quot;&gt;Getting started&lt;/h2&gt;
&lt;p&gt;Duplicate the folder &lt;pth&gt;Inversion/example_folder/&lt;/pth&gt; and rename it to whatever name makes you happy. I usually name this folder after the tephra deposit I am inverting. Note that you can have as many folders for as many deposits of as many volcanoes as you want here. Let’s now edit the required files.&lt;/p&gt;

&lt;h3 id=&quot;case-study-files&quot;&gt;Case-study files&lt;/h3&gt;
&lt;p&gt;Replace the following files by those for your own case-study.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;pth&gt;inversionInput.txt:&lt;/pth&gt;
    &lt;p&gt;This is the main file containing your field observations. It is a 4-columns, tab-delimited file containing:&lt;/p&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;em&gt;Column 1&lt;/em&gt;: Easting coordinates of the outcrop (UTM, WGS84)&lt;/li&gt;
      &lt;li&gt;&lt;em&gt;Column 2&lt;/em&gt;: Northing coordinates of the outcrop (UTM, WGS84)&lt;/li&gt;
      &lt;li&gt;&lt;em&gt;Column 3&lt;/em&gt;: Altitude (m asl). Note that Tephra2 can not accurately use the elevation. Instead, a mean elevation of all outcrops should be estimated and used as a unique value for all outcrops&lt;/li&gt;
      &lt;li&gt;&lt;em&gt;Column 4&lt;/em&gt;: The mass accumulation (kg/m&lt;sup&gt;2&lt;/sup&gt;) estimated at each outcrop. Note that this is a &lt;strong&gt;mass accumulation&lt;/strong&gt; and not a &lt;strong&gt;thickness&lt;/strong&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;pth&gt;forwardGrid.utm:&lt;/pth&gt;
    &lt;p&gt;The calculation grid used by the forward solution of Tephra2, and used during the inversion process to compare the deposit modelled by the inversion with field data. You can use &lt;a href=&quot;https://github.com/e5k/TephraProb&quot;&gt;TephraProb&lt;/a&gt; to create a grid following &lt;a href=&quot;https://www.youtube.com/watch?v=dgo2bZXKv0U&amp;amp;&quot;&gt;this tutorial&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;pth&gt;inversionWind.txt:&lt;/pth&gt;
    &lt;p&gt;If a wind observation is available for the studied eruption, it can be used to constrain the inversion. If no wind is available, ranges of wind speed and directions can be defined instead (described later), but please keep then the &lt;em&gt;inversionWind.txt&lt;/em&gt; file in the folder. If the eruption is within the time interval provided by Reanalysis datasets, &lt;a href=&quot;https://github.com/e5k/TephraProb&quot;&gt;TephraProb&lt;/a&gt; can be used to retrieve it. The wind file should be a 3-columns, tab-delimited file containing:&lt;/p&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;em&gt;Column 1&lt;/em&gt;: Altitude (m asl)&lt;/li&gt;
      &lt;li&gt;&lt;em&gt;Column 2&lt;/em&gt;: Wind speed (m/s)&lt;/li&gt;
      &lt;li&gt;&lt;em&gt;Column 3&lt;/em&gt;: Wind direction (i.e. the direction the wind blows to; degrees from N)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;configuration-file&quot;&gt;Configuration file&lt;/h3&gt;
&lt;p&gt;The main inversion file is &lt;pth&gt;inversionConfig.conf&lt;/pth&gt;, which &lt;strong&gt;must not be renamed&lt;/strong&gt;. As a tip, replace the &lt;em&gt;ERUPTION_NAME&lt;/em&gt; in the second line by the name of the eruption you are modelling. That my save you precious time when looking for data years from now!&lt;/p&gt;

&lt;p&gt;Below is a summary of the different sections to fill in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inversion behaviour&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This section controls the general behaviour of the inversion runs.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Variable&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;BATCH&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Enter 0 for &lt;em&gt;single&lt;/em&gt; runs, 1 for &lt;em&gt;batch&lt;/em&gt; runs and 2 for &lt;em&gt;seed&lt;/em&gt; rund&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;fixedWind&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Enter 0 to use ranges of wind direction/speed, 1 to use a wind profile&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;SEED&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Used to control the seed for reproducibility. To randomely choose a seed, enter &lt;cmd&gt;-1&lt;/cmd&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;Input files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This section defines the path to the input files previously described.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Variable&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;inputFile&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;File containing the field observations&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;windFile&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;File containing the wind profile. Leave &lt;pth&gt;inversionWind.txt&lt;/pth&gt; if fixedWind=0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;gridFile&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Path to the grid file&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;Vent properties&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This section defines the vent geometry. Coordinates are in UTM and should be projected on the same zone as the field data.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Variable&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;ventE&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Vent easting (UTM, WGS84)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;ventN&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Vent northin (UTM, WGS84)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;ventA&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Vent elevation (m asl)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;ventZ&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;UTM zone of the vent. Only the numeric part, negative in S hemisphere&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;Ranges to invert&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This section contains all the variable parameters that are optimized during the inversion. Each parameter contains min/max values.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Variable&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;Ht&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Plume heights (m asl)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;Mass&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Total mass (log10, kg). Used only when BATCH=0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;Diff&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Diffusion coefficient for large particles (m&lt;sup&gt;2&lt;/sup&gt;/s)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;FTT&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Fall-time threshold(s)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;MedPhi&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Median of the TGSD (Phi). Note that minMedPhi is the coarsest diameter&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;SigPhi&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Standard deviation of the TGSD (Phi)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;Alpha&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Alpha parameter of the Beta function controlling the mass distribution in the plume&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;Beta&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Beta parameter of the Beta function controlling the mass distribution in the plume&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;WindSpeed&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Wind speed (m/s) - used when fixedWind=0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;WindDir&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Wind direction (degree from N) - used when fixedWind=0&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;Constant parameters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This section contains parameters that are kept constant during the inversion.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Variable&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;lithicDensity&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Density of the lithics (kg/m&lt;sup&gt;3&lt;/sup&gt;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;pumiceDensity&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Density of the pumices (kg/m&lt;sup&gt;3&lt;/sup&gt;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;minPhi&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Minimum bound (coarsest diameter; phi) of the TGSD&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;maxPhi&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Maximum bound (finest diameter; phi) of the TGSD&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;Batch parameters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This section contains parameters that control the behavior of the batch inversion. It is still experimental, so it is recommended to keep the proposed parameters for now.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Variable&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;deltaMass&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Mass interval between each sub-run of the batch inversion (log10; kg)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;incrMass&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Mass increment between each sub-run of the batch inversion (log10; kg)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;deltaHt&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Height interval between each sub-run of the batch inversion (m asl)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;incrHt&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Height increment between each sub-run of the batch inversion (m asl)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;Tephra2 advanced parameters&lt;/strong&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Variable&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;colSteps&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Number of integration steps along the height of the column&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;partStep&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Number of integration steps along the TGSD&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;fitTest&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Merit test: 0 (chi-squared test), 1 (root mean squared error), 2 (Tokyo log test)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;eddy&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Eddy constant&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;plumeModel&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Mass distribution in the plume (2 is a beta distribution)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;windLevels&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Number of wind levels to consider. Only if fixedWind=0&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;running-the-inversion&quot;&gt;Running the inversion&lt;/h2&gt;
&lt;p&gt;Tephra2 is parallelised using &lt;a href=&quot;https://www.open-mpi.org&quot;&gt;OpenMPI&lt;/a&gt; and commonly run on clusters. Different clusters have different architectures, which will probably require some measure of editing. If your files are prepared locally, now is the time to upload everything on the server. Be sure to keep the directory tree specified before.&lt;/p&gt;

&lt;p&gt;The main script used to run the inversion is &lt;em&gt;runInversion.sh&lt;/em&gt;. The &lt;pth&gt;_template/&lt;/pth&gt; folder contains templates for different cluster architectures, namely &lt;em&gt;Slurm&lt;/em&gt;, &lt;em&gt;OpenPBS&lt;/em&gt; and &lt;em&gt;PBSPro&lt;/em&gt;. Edit the header of the script and copy it to the &lt;pth&gt;_example_folder/&lt;/pth&gt; folder. Navigate to &lt;pth&gt;_example_folder/&lt;/pth&gt; to start running the script.&lt;/p&gt;

&lt;h3 id=&quot;single-vs-batch-vs-seed-runs&quot;&gt;Single vs. batch vs. seed runs&lt;/h3&gt;
&lt;p&gt;For parallelisation purposes, single runs, batch runs and seed runs are submitted in slightly different ways.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;For &lt;em&gt;single&lt;/em&gt; runs, the mass range is defined in the &lt;pth&gt;inversionConfig.conf&lt;/pth&gt; file;&lt;/li&gt;
  &lt;li&gt;For &lt;em&gt;batch&lt;/em&gt; runs use &lt;em&gt;job arrays&lt;/em&gt;, the mass range is specified on the command line when submitting the job, which will allow each mass increment to be sent to a different node;&lt;/li&gt;
  &lt;li&gt;For &lt;em&gt;seed&lt;/em&gt; runs, the mass is specified in &lt;pth&gt;inversionConfig.conf&lt;/pth&gt; (as for &lt;em&gt;single&lt;/em&gt; runs), but the number of seeds is specified on the command line when submitting the job.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;openpbs&quot;&gt;OpenPBS&lt;/h3&gt;
&lt;p&gt;For a &lt;strong&gt;single&lt;/strong&gt; inversion run, set &lt;em&gt;BATCH=0&lt;/em&gt; in &lt;pth&gt;inversionConfig.conf&lt;/pth&gt; and type:&lt;/p&gt;
&lt;pre&gt;qsub runInversion.sh&lt;/pre&gt;
&lt;p&gt;For a &lt;strong&gt;batch inversion&lt;/strong&gt; run with a mass range between 10&lt;sup&gt;9&lt;/sup&gt; and 10&lt;sup&gt;11&lt;/sup&gt; kg, set &lt;em&gt;BATCH=1&lt;/em&gt; in &lt;pth&gt;inversionConfig.conf&lt;/pth&gt; and use the &lt;cmd&gt;-t&lt;/cmd&gt; flag:&lt;/p&gt;
&lt;pre&gt;qsub -t 9-11 runInversion.sh&lt;/pre&gt;
&lt;p&gt;For a &lt;strong&gt;seed inversion&lt;/strong&gt; performing 100 runs with a seed number varying between 1-100, type:&lt;/p&gt;
&lt;pre&gt;qsub -t 1-100 runInversion.sh&lt;/pre&gt;

&lt;h2 id=&quot;post-processing&quot;&gt;Post-processing&lt;/h2&gt;
&lt;p&gt;Upon successful (yey!) completion of an inversion run, one (&lt;em&gt;single&lt;/em&gt; run) or multiple (&lt;em&gt;batch&lt;/em&gt; run) folders are created inside &lt;pth&gt;_example_folder/&lt;/pth&gt;, named &lt;em&gt;mass&lt;strong&gt;M&lt;/strong&gt;_ht&lt;strong&gt;H&lt;/strong&gt;&lt;/em&gt;, where &lt;strong&gt;M&lt;/strong&gt; and &lt;strong&gt;H&lt;/strong&gt; are the lower intervals of the mass (log10 kg) and plume height (km) ranges, respectively. For post processing, follow these steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;In the &lt;pth&gt;_example_folder/&lt;/pth&gt; on your local computer, create a folder named &lt;pth&gt;n/&lt;/pth&gt;, where &lt;em&gt;n&lt;/em&gt; is the number of your inversion attempt (start at 1/ and name the subsequent folders in a continuous way). By doing so, each new inversion attempt doesn’t have to delete the previous one, and it becomes easier to track different attempts&lt;/li&gt;
  &lt;li&gt;Copy the content of &lt;pth&gt;_example_folder/&lt;/pth&gt; on the cluster into your local &lt;pth&gt;n/&lt;/pth&gt; folder&lt;/li&gt;
  &lt;li&gt;In Matlab, run the &lt;pth&gt;processInversion.m&lt;/pth&gt; script. When asked, go and select your &lt;pth&gt;n/&lt;/pth&gt; folder and let the script work&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This process will first create four new files in each folder:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;obsVScomp.pdf&lt;/strong&gt;: Plot of the computed values of tephra accumulation against their observed equivalents;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;plume.pdf&lt;/strong&gt;: The plume distribution&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;tephra2.out&lt;/strong&gt;: Result of the forward solution&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;wind.pdf&lt;/strong&gt;: Wind profile&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, each inversion attempt is recorded in an Excel file at the root of the &lt;pth&gt;Inversion/&lt;/pth&gt; folder in a different sheet named after &lt;pth&gt;n/&lt;/pth&gt;.&lt;/p&gt;

&lt;h3 id=&quot;output-figures&quot;&gt;Output figures&lt;/h3&gt;

&lt;h4 id=&quot;1-spaces-of-solutions&quot;&gt;1. &lt;em&gt;Spaces&lt;/em&gt; of solutions&lt;/h4&gt;
&lt;p&gt;In the case of &lt;em&gt;batch&lt;/em&gt; or &lt;em&gt;seed&lt;/em&gt; runs, the function &lt;cmd&gt;plotT2Inversion&lt;/cmd&gt; can be used to explore spaces of results. A plane of fit values is computed and interpolated between two variable of choice. In the case of &lt;em&gt;batch&lt;/em&gt; runs, this visualisation method is useful to assess the location(s) of minima. In the case of &lt;em&gt;seed&lt;/em&gt; runs, these figures are helpeful to assess the stability of the inversion output to the seed number.&lt;/p&gt;

&lt;h4 id=&quot;2-everything-against-everything&quot;&gt;2. Everything against everything!&lt;/h4&gt;
&lt;p&gt;In the case of &lt;em&gt;seed&lt;/em&gt; runs, the script produces a matrix plot (type &lt;cmd&gt;doc plotmatrix&lt;/cmd&gt; in the Matlab command line). I find this plot to be the most informative because:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;It allows indentifying populations of solutions from the histograms&lt;/li&gt;
  &lt;li&gt;It allows indentifying relationships between parameters&lt;/li&gt;
&lt;/ol&gt;

</content>
 </entry>
 
 <entry>
   <title>Access sampled ESP in TephraProb</title>
   <link href="https://e5k.github.io/codes/tips/2018/02/21/access_sampled_esp/"/>
   <updated>2018-02-21T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/tips/2018/02/21/access_sampled_esp</id>
   <content type="html">&lt;p&gt;This note shows how to access the ESPs sampled during Monte Carlo simulations and how to link them to a given output. This note has been updated on 2020-02-12 to work with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;v1.7.1&lt;/code&gt; of TephraProb. Two files are needed:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;The file located in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RUNS/runName/runNb/&lt;/code&gt; named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;runName_runNb.mat&lt;/code&gt;. This contains a &lt;strong&gt;structure&lt;/strong&gt; called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data&lt;/code&gt;, which contains a &lt;strong&gt;field&lt;/strong&gt; named &lt;var&gt;stor&lt;/var&gt; where all the ESPs are stored. &lt;var&gt;data.stor&lt;/var&gt; contains sub-fields for the different parameter (e.g. plume height, duration, mass, MER, TGSD). These parameters are stored as &lt;strong&gt;vectors&lt;/strong&gt; that can have different sizes. If the duration of each simulated eruption is &amp;lt;6 h, the size of all vectors should equal the number of simulated eruptions. If durations are &amp;gt;6 h, the size of those parameters that change at each 6 h increment (e.g. plume height, MER) represents the number of times each was sampled. For instance, in the case of a 15 h-long eruption, 3 plume heights are sampled. However, other parameters (e.g. TGSD) are constant over the entire duration of the eruption, so the resulting vectors will have a size equal to the number of simulated eruptions.&lt;/li&gt;
  &lt;li&gt;The file located in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RUNS/runName/runNb/DATA/&lt;/code&gt; named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dataT2_all.mat&lt;/code&gt;, which contains two variables:
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dataT2&lt;/code&gt; is a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m&lt;/code&gt; by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; matrix, where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m&lt;/code&gt; is the number of points over which accumulations are computed and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; is the number of runs. This variable contains all the summed Tephra2 outputs in kg/m2;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;runNb&lt;/code&gt; is a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m&lt;/code&gt; by 1 vector, where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;m&lt;/code&gt; is the number of runs.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, there is something to keep in mind. Let’s say we have 10 text files named sequentially from &lt;em&gt;01.txt&lt;/em&gt; to &lt;em&gt;10.txt&lt;/em&gt;. Matlab reads sequential files as &lt;em&gt;01.txt&lt;/em&gt;, &lt;em&gt;10.txt&lt;/em&gt;, &lt;em&gt;02.txt&lt;/em&gt; … &lt;em&gt;09.txt&lt;/em&gt;, &lt;strong&gt;and not as&lt;/strong&gt; &lt;em&gt;01.txt&lt;/em&gt;, &lt;em&gt;02.txt&lt;/em&gt; … &lt;em&gt;10.txt&lt;/em&gt;. In TephraProb post-processing, this means that:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;ESPs in the variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data.stor&lt;/code&gt; are ordered in increasing run number&lt;/li&gt;
  &lt;li&gt;Runs outputs in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dataT2&lt;/code&gt; are ordered in the way Matlab reads the files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is therefore necessary to re-index &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dataT2&lt;/code&gt; to the order of the ESPs contained in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data.stor&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;examples&quot;&gt;Examples&lt;/h2&gt;

&lt;h3 id=&quot;re-index-esps-with-outputs&quot;&gt;Re-index ESPs with outputs&lt;/h3&gt;

&lt;div class=&quot;language-matlab highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;% Load the second sampling attempt of the run called Sakurajima&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;RUNS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sakurajima&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sakurajima_2&lt;/span&gt; 

&lt;span class=&quot;c1&quot;&gt;% Load the isomass output&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;RUNS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sakurajima&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DATA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dataT2_all&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mat&lt;/span&gt; 

&lt;span class=&quot;c1&quot;&gt;% Show the loaded variables&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stor&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;dataT2&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;runNb&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;% Retrieve the selected ESPs&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;esp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ht&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'./1e3,log10([data.stor.mass]'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'./3600,[data.stor.gs_med]'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(:,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)];&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;% Reorder the run numbers in ascending order and save their indices&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;runNb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;% Reorder the isomass outputs&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;dataT2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dataT2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(:,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;% dataT2 and data.stor are now indexed&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;random_run&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;run_output&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dataT2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(:,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;random_run&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;run_ESPs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;esp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;random_run&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Plot a histogram of the plume height:&lt;/p&gt;

&lt;div class=&quot;language-matlab highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;toPlot&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ht&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;% Need to vectorize the data&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;figure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;histogram&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;toPlot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;xlabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Plume height'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ylabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Frequency'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;num2str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;numel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;toPlot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;' occurrences'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Manual compilation of Tephra2</title>
   <link href="https://e5k.github.io/codes/tips/2017/12/11/tephra2_manual_compilation/"/>
   <updated>2017-12-11T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/tips/2017/12/11/tephra2_manual_compilation</id>
   <content type="html">&lt;p&gt;TephraProb compiles Tephra2 through a bit of Matlab hocus pocus to facilitate problems of OS dependancy, but the mighty Matlab can sometime fail us. In this case, it becomes necessary to manually compile Tephra2 from the command line to see what the error message is. I spent a fair amount of time writing this procedure in emails to people who encountered problems and I thought I would write it down here.&lt;/p&gt;

&lt;p&gt;Just to clarify things, &lt;strong&gt;compiling&lt;/strong&gt; is the process of transforming files containing lines of code into a program that can be executed by the user. The whole compilation process depends on such aspects as the computer’s architecture or OS, so it needs to be performed on each computer separately. Again, most of the time everything should be taken care of smoothly within TephraProb, but just in case…&lt;/p&gt;

&lt;h2 id=&quot;unix-for-non-nerds&quot;&gt;Unix for non-nerds&lt;/h2&gt;
&lt;p&gt;This process requires to access Tephra2 through the command line (&lt;var&gt;Terminal&lt;/var&gt; on Unix, &lt;var&gt;Cygwin Terminal&lt;/var&gt; on Windows). Here are some tips on how to use it.&lt;/p&gt;

&lt;h3 id=&quot;navigating-through-folders&quot;&gt;Navigating through folders&lt;/h3&gt;
&lt;p&gt;The main command to navigate through folders is &lt;cmd&gt;cd&lt;/cmd&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;folder 	&lt;span class=&quot;c&quot;&gt;# Enter the directory called folder&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; .. 		&lt;span class=&quot;c&quot;&gt;# Go back to the parent directory&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;where-to-go&quot;&gt;Where to go?&lt;/h3&gt;
&lt;p&gt;Another useful command is &lt;cmd&gt;ls&lt;/cmd&gt;, which lists the content of the current directory. When navigating directories with &lt;cmd&gt;cd&lt;/cmd&gt;, note that the &lt;var&gt;tab&lt;/var&gt; key auto-completes commands. Taking the example above, typing &lt;cmd&gt;cd fold&lt;/cmd&gt; and hitting &lt;var&gt;tab&lt;/var&gt; is likely to complete the command to &lt;cmd&gt;cd folder/&lt;/cmd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;locating-tephra2&quot;&gt;Locating Tephra2&lt;/h3&gt;
&lt;p&gt;The Tephra2 executable (&lt;var&gt;tephra2-2012&lt;/var&gt; on Unix, &lt;var&gt;tephra2-2012.exe&lt;/var&gt; on Windows) should be located in the &lt;pth&gt;tephraProb/MODEL/&lt;/pth&gt; folder. Open the terminal and navigate to this location. If you are unsure in which directory you are when starting the Terminal, the command &lt;cmd&gt;pwd&lt;/cmd&gt; will help. On Unix, it usually starts in your home folder (&lt;pth&gt;/home/username/&lt;/pth&gt; on Linux, &lt;pth&gt;/Users/username/&lt;/pth&gt; on Mac).&lt;/p&gt;

&lt;p&gt;On Windows/Cygwin, things are slightly different. Let’s assume that TephraProb is located in &lt;pth&gt;E:/TephraProb/&lt;/pth&gt;, the right way to navigate to this location on the Cygwin terminal is:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /cygdrive/e/TephraProb&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;manual-compilation&quot;&gt;Manual compilation&lt;/h2&gt;
&lt;p&gt;Once in the &lt;pth&gt;MODEL/&lt;/pth&gt; folder, enter the &lt;pth&gt;forward_src&lt;/pth&gt; folder and type:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;make&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Hopefully, that should result in the last line printed to the command line being:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;tephra2-2012 ../tephra2-2012&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;There might be warnings, but these should be ok.&lt;/p&gt;

&lt;h3 id=&quot;common-errors&quot;&gt;Common errors&lt;/h3&gt;
&lt;p&gt;Here, I will try and list common errors that have been encountered.&lt;/p&gt;

&lt;h4 id=&quot;file-format-not-recognised&quot;&gt;File format not recognised&lt;/h4&gt;
&lt;p&gt;This error was encountered on Cygwin:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;make[1]: Entering directory &lt;span class=&quot;s1&quot;&gt;'/cygdrive/e/Seb/Documents/CODES/TephraProb/MODEL/forward_src'&lt;/span&gt;
&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;which gcc&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-Wall&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-idirafter&lt;/span&gt; ../include &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; tephra2-2012 new_tephra.o tephra2_calc.o &lt;span class=&quot;nt&quot;&gt;-lm&lt;/span&gt; /libcygwin64/libgc.a &lt;span class=&quot;nt&quot;&gt;-ldl&lt;/span&gt;
new_tephra.o: file not recognized: File format not recognized&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This was solved by entering in the &lt;pth&gt;forward_src&lt;/pth&gt;, removing the *.o files and recompiling:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;forward_src
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.o 	&lt;span class=&quot;c&quot;&gt;# Remove *.o files&lt;/span&gt;
make&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;manual-tephra2-run&quot;&gt;Manual Tephra2 run&lt;/h2&gt;
&lt;p&gt;If the compilation worked, the Tephra2 executable should now be located in the folder &lt;pth&gt;MODEL/&lt;/pth&gt;. To start the command, type &lt;cmd&gt;./tephra2-2012&lt;/cmd&gt; on Unix or &lt;cmd&gt;./tephra2-2012.exe&lt;/cmd&gt; on Windows, which will result in:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;Missing comand line arguments,
USAGE: &amp;lt;program name&amp;gt; &amp;lt;config file&amp;gt; &amp;lt;points file&amp;gt; &amp;lt;wind file&amp;gt; &amp;lt;file of grain sizes&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You now have to specify all input files including:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;A configuration file, typically a &lt;cmd&gt;.conf&lt;/cmd&gt; file located somewhere in &lt;pth&gt;TephraProb/RUNS/runName/runNumber/CONF/&lt;/pth&gt;&lt;/li&gt;
  &lt;li&gt;A grid file, typically a &lt;cmd&gt;.utm&lt;/cmd&gt; file located in &lt;pth&gt;TephraProb/GRID/gridName/&lt;/pth&gt;&lt;/li&gt;
  &lt;li&gt;A wind file, typically a &lt;cmd&gt;.gen&lt;/cmd&gt; file located in &lt;pth&gt;TephraProb/WIND/windName/&lt;/pth&gt;&lt;/li&gt;
  &lt;li&gt;A grain-size distribution file, typically a &lt;cmd&gt;.gsd&lt;/cmd&gt; file located somewhere in &lt;pth&gt;TephraProb/RUNS/runName/runNumber/GS/&lt;/pth&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can either specify the full path to these files or copy them in the same folder as the Tephra2 executable, in which case Tephra2 can be run by typing:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;./tephra2 conf.conf grid.utm wind.gen tgsd.gsd &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; test.out &lt;span class=&quot;c&quot;&gt;# Unix&lt;/span&gt;
./tephra2.exe conf.conf grid.utm wind.gen tgsd.gsd &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; test.out &lt;span class=&quot;c&quot;&gt;# Windows&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Note that the last argument &lt;cmd&gt;&amp;gt; test.out&lt;/cmd&gt; specifies the output file to Tephra2.&lt;/p&gt;

&lt;h3 id=&quot;common-errors-1&quot;&gt;Common errors&lt;/h3&gt;

&lt;h4 id=&quot;permission-denied&quot;&gt;Permission denied&lt;/h4&gt;
&lt;p&gt;If a &lt;cmd&gt;Permission denied&lt;/cmd&gt; error is returned upon using the &lt;cmd&gt;./tephra2-2012&lt;/cmd&gt; command, try changing the access permissions:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;chmod &lt;/span&gt;755 tephra2-2012&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;other-problems&quot;&gt;Other problems&lt;/h2&gt;
&lt;p&gt;I am trying to build a database of common problems faced by TephraProb / Tephra2 users. Contact me (if you haven’t already done it) and we will post the answer here for other people.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Plot the output of Tephra2 in Matlab</title>
   <link href="https://e5k.github.io/codes/utilities/2017/12/10/plot_tephra2/"/>
   <updated>2017-12-10T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/utilities/2017/12/10/plot_tephra2</id>
   <content type="html">&lt;p&gt;This function plots the output of Tephra2 runs on a map. Output files generated by Tephra2 are in a &lt;em&gt;column&lt;/em&gt; format (i.e. easting, northing, elevation and mass accumulation), with the number of rows equal to the total number of points in the grid. For some obscure reason, most of Matlab’s plotting functions only accept inputs in a &lt;em&gt;matrix&lt;/em&gt; format, i.e. separate &lt;cmd&gt;m x n&lt;/cmd&gt; matrices for easting, northing, elevation and mass accumulation, where &lt;cmd&gt;m&lt;/cmd&gt; and &lt;cmd&gt;n&lt;/cmd&gt; are the numbers of northing and easting values, respectively. Matlab, unlike other plotting tools (e.g. GMT, Python), therefore requires a transformation the data.&lt;/p&gt;

&lt;p&gt;Additionally, Tephra works with UTM coordinates. This function accepts optional arguments to convert the output of Tephra2 to lat/lon coordinates. For this, two additional functions published on the Matlab File Exchange are required:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://uk.mathworks.com/matlabcentral/fileexchange/45699-ll2utm-and-utm2ll&quot; target=&quot;_blank&quot;&gt;utm2ll&lt;/a&gt; by François Beauducel&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://uk.mathworks.com/matlabcentral/fileexchange/27627-zoharby-plot-google-map&quot; target=&quot;_blank&quot;&gt;plot_google_map&lt;/a&gt; by Zohar Bar-Yehuda&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;the-function&quot;&gt;The function&lt;/h2&gt;
&lt;p&gt;The function &lt;cmd&gt;plotT2&lt;/cmd&gt; can be downloaded&lt;a href=&quot;https://github.com/e5k/Tephra2Utils&quot; target=&quot;_blank&quot;&gt; here&lt;/a&gt;. One argument is required, which is a string containing the path to the file. Outputs are then matrices of easting (&lt;var&gt;E&lt;/var&gt;), northing (&lt;var&gt;N&lt;/var&gt;) and mass accumulation (&lt;var&gt;M&lt;/var&gt;):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-matlab&quot; data-lang=&quot;matlab&quot;&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;M&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Carea&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Pmass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cont&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;varargout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plotT2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pathToFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;varargin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;required-argument&quot;&gt;Required argument&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Argument&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;pathToFile&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Path to Tephra2 output file&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;optional-name-value-pairs-of-arguments&quot;&gt;Optional name-value pairs of arguments&lt;/h3&gt;
&lt;p&gt;The optional pairs of name-value arguments are summarised below:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Argument&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;'zone'&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;UTM zone of the Tephra2 output, used to convert projected to geographic coordinates and plot a Google Map background if both &lt;a href=&quot;https://uk.mathworks.com/matlabcentral/fileexchange/45699-ll2utm-and-utm2ll&quot;&gt;utm2ll&lt;/a&gt; and &lt;a href=&quot;https://uk.mathworks.com/matlabcentral/fileexchange/27627-zoharby-plot-google-map&quot;&gt;plot_google_map&lt;/a&gt; are available. Should be a double, positive in the N hemisphere, negative in the S hemisphere&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;'plot'&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Defines if accumulation is plotted as log10 (&lt;pth&gt;'log10'&lt;/pth&gt;, default) or linear (&lt;pth&gt;'linear'&lt;/pth&gt;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;'contours'&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Vector containing the values (kg/m&lt;sup&gt;2&lt;/sup&gt;) of accumulation to contour. By default set to &lt;cmd&gt;[1,10,100,1000]&lt;/cmd&gt;&amp;lt;/td&amp;gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;'minVal'&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Minimum value to be represented on the continuous color surface (kg/m&lt;sup&gt;2&lt;/sup&gt;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;'vent'&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Plot the vent, entered as &lt;pth&gt;[easting, northing]&lt;/pth&gt; coordinates.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;'points'&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Additional points to plot, entered as a 2-columns &lt;pth&gt;[easting,northing]&lt;/pth&gt; matrix. If entered as a 3-columns &lt;pth&gt;[easting,northing,value]&lt;/pth&gt; matrix, value is used as a label&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;output-arguments&quot;&gt;Output arguments&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Argument&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;E&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Easting matrix (m)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;N&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Northing matrix (m)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;M&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Mass accumulation matrix (kg/m&lt;sup&gt;2&lt;/sup&gt;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;Carea&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Area of each isomass contour (km&lt;sup&gt;2&lt;/sup&gt;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;Pmass&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Mass contained within each contour (kg)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;contour&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Contours (kg/m&lt;sup&gt;2&lt;/sup&gt;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;lat&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Optional - latitude matrix, if &lt;var&gt;'zone'&lt;/var&gt; is specified&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;var&gt;lon&lt;/var&gt;&lt;/td&gt;
      &lt;td&gt;Optional - longitude matrix, if &lt;var&gt;'zone'&lt;/var&gt; is specified&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;/h3&gt;

&lt;p&gt;When the argument &lt;cmd&gt;'zone'&lt;/cmd&gt; is passed, it is possible to request the matrix versions of latitude and longitude:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-matlab&quot; data-lang=&quot;matlab&quot;&gt;&lt;span class=&quot;n&quot;&gt;plotT2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'example.out'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plotT2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'example.out'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'zone'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plotT2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'example.out'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'plot'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'linear'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plotT2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'example.out'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'contours'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
 </entry>
 
 <entry>
   <title>Quantifying probabilities from ballistic models</title>
   <link href="https://e5k.github.io/codes/2017/10/09/ballistic-post-processing/"/>
   <updated>2017-10-09T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/2017/10/09/ballistic-post-processing</id>
   <content type="html">&lt;p&gt;Here is presented an extended version of the Matlab post-processing function developed for the &lt;strong&gt;&lt;a href=&quot;/pages/gbf&quot;&gt;Great Balls of Fire&lt;/a&gt;&lt;/strong&gt; model for the probabilistic hazard assessment of ballistic impact.&lt;/p&gt;

&lt;h3 id=&quot;table-of-content&quot;&gt;Table of content&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#tags-gbf&quot;&gt;tags: gbf&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#table-of-content&quot;&gt;Table of content&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#requirements&quot;&gt;Requirements&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#source-material&quot;&gt;Source material&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dependencies&quot;&gt;Dependencies&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#access-the-code&quot;&gt;Access the code&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#1-from-ballistic-modelling-to-probabilistic-hazard-assessment&quot;&gt;1. From ballistic modelling to probabilistic hazard assessment&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#11-the-need-of-a-reference-area&quot;&gt;1.1 The need of a reference area&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#12-what-probabilities&quot;&gt;1.2 What probabilities?&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2-using-the-function&quot;&gt;2 Using the function&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#21-input-arguments&quot;&gt;2.1 Input arguments&lt;/a&gt;
        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#211-using-the-gui&quot;&gt;2.1.1 Using the GUI&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#212-using-arguments&quot;&gt;2.1.2 Using arguments&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#213-using-an-input-structure&quot;&gt;2.1.3 Using an input structure&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#22-output-argument&quot;&gt;2.2 Output argument&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3-outputs-and-results&quot;&gt;3 Outputs and results&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#31-ascii-grid-format&quot;&gt;3.1 ASCII grid format&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#32-matlab-format&quot;&gt;3.2 Matlab format&lt;/a&gt;
        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#bal&quot;&gt;.bal&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#pixel&quot;&gt;.pixel&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#concentric&quot;&gt;.concentric&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#radial&quot;&gt;.radial&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#4-displaying-results&quot;&gt;4 Displaying results&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;requirements&quot;&gt;Requirements&lt;/h3&gt;
&lt;p&gt;The initial function provided with the &lt;strong&gt;Great Balls of Fire&lt;/strong&gt; model has been modified so output files of virtually any model can be loaded and processed through methods described &lt;a href=&quot;https://www.researchgate.net/publication/304243833_Great_Balls_of_Fire_A_probabilistic_approach_to_quantify_the_hazard_related_to_ballistics_-_A_case_study_at_La_Fossa_volcano_Vulcano_Island_Italy&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. Requirements are:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Impact coordinates must be defined in UTM WGS84&lt;/li&gt;
  &lt;li&gt;Files must be ascii and tab delimited&lt;/li&gt;
  &lt;li&gt;Columns in the output file should be organised as indicated in the table below. Note that adding extra columns is acceptable&lt;/li&gt;
&lt;/ol&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Column&lt;/th&gt;
      &lt;th&gt;Data&lt;/th&gt;
      &lt;th&gt;Unit&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;Easting&lt;/td&gt;
      &lt;td&gt;m&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Northing&lt;/td&gt;
      &lt;td&gt;m&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;Altitude&lt;/td&gt;
      &lt;td&gt;m asl&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;Mass&lt;/td&gt;
      &lt;td&gt;kg&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;5&lt;/td&gt;
      &lt;td&gt;Diameter&lt;/td&gt;
      &lt;td&gt;m&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;6&lt;/td&gt;
      &lt;td&gt;Kinetic energy&lt;/td&gt;
      &lt;td&gt;kJ&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;figcaption&gt;&lt;b&gt;Table 1&lt;/b&gt;: Example of an input file for the &lt;b&gt;processGBF&lt;/b&gt; function.&lt;/figcaption&gt;

&lt;h3 id=&quot;source-material&quot;&gt;Source material&lt;/h3&gt;
&lt;p&gt;Source material includes:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Our JVGR &lt;a href=&quot;https://www.researchgate.net/publication/304243833_Great_Balls_of_Fire_A_probabilistic_approach_to_quantify_the_hazard_related_to_ballistics_-_A_case_study_at_La_Fossa_volcano_Vulcano_Island_Italy&quot; target=&quot;_blank&quot;&gt;paper&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;The GBF &lt;a href=&quot;/files/gbf_man.pdf&quot; target=&quot;_blank&quot;&gt;user manual&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;This 2017 &lt;a href=&quot;https://www.researchgate.net/publication/320005132_Ballistic_hazard_assessment&quot; target=&quot;_blank&quot;&gt;IAVCEI presentation&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;dependencies&quot;&gt;Dependencies&lt;/h3&gt;
&lt;p&gt;The post-processing functions rely on two files published on the Matlab File Exchange:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://uk.mathworks.com/matlabcentral/fileexchange/45699-ll2utm-and-utm2ll&quot; target=&quot;_blank&quot;&gt;utm2ll&lt;/a&gt; by François Beauducel&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://uk.mathworks.com/matlabcentral/fileexchange/27627-zoharby-plot-google-map&quot; target=&quot;_blank&quot;&gt;plot_google_map&lt;/a&gt; by Zohar Bar-Yehuda&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;access-the-code&quot;&gt;Access the code&lt;/h3&gt;
&lt;p&gt;The post-processing function can be obtained &lt;a href=&quot;https://github.com/e5k/GBF-Post-Processing&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;1-from-ballistic-modelling-to-probabilistic-hazard-assessment&quot;&gt;1. From ballistic modelling to probabilistic hazard assessment&lt;/h2&gt;

&lt;h3 id=&quot;11-the-need-of-a-reference-area&quot;&gt;1.1 The need of a reference area&lt;/h3&gt;
&lt;p&gt;Unlike for tephra deposits, the discrete nature of ballistic impacts requires to average single ballistic impacts on a grid. Grids can fall in two main categories that are &lt;strong&gt;polar&lt;/strong&gt; and &lt;strong&gt;cartesian&lt;/strong&gt;. However, averaging impacts on a grid creates a dependancy of the final result to the spatial resolution. In other words:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Is it acceptable for a grid to have pixels areas that vary with distance from the vent (e.g., polar grids)?&lt;/li&gt;
  &lt;li&gt;Since increasing the pixel area increases the probability of impact, is there a threshold of grid resolution that provides stable results?&lt;/li&gt;
  &lt;li&gt;How does the grid shape/resolution interacts with the number of simulated ballistics and affect the stability of results?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Probabilistic hazard assessment for ballistic impacts should therefore address these issues, one possible way to do so being through &lt;em&gt;sensitivity analysis&lt;/em&gt;. This new post-processing function can be accessed either through a GUI or programatically, which facilitates sensitivity analyses. Refer to our &lt;a href=&quot;https://www.researchgate.net/publication/304243833_Great_Balls_of_Fire_A_probabilistic_approach_to_quantify_the_hazard_related_to_ballistics_-_A_case_study_at_La_Fossa_volcano_Vulcano_Island_Italy&quot; target=&quot;_blank&quot;&gt;JVGR&lt;/a&gt; paper for more information.&lt;/p&gt;

&lt;figure&gt;
	&lt;img src=&quot;/img/blog/201709/bal_grid.jpg&quot; /&gt;
	&lt;figcaption&gt;&lt;b&gt;Fig. 1&lt;/b&gt; Illustration of the different approaches to average ballistics including i) polar grids with constant concentric distance from the vent, ii) polar grids with increasing distance from the vent, iii) cartesian grids and iv) area of interests&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;In this post-processing function, a true polar grid is not implemented. Instead, probabilities of impact are calculated using both &lt;strong&gt;a given distance from the vent&lt;/strong&gt; (i.e., concentric rings) and at &lt;strong&gt;a given radial sector around the vent&lt;/strong&gt;. The union probability of both approaches will result in a polar grid.&lt;/p&gt;

&lt;h3 id=&quot;12-what-probabilities&quot;&gt;1.2 What probabilities?&lt;/h3&gt;
&lt;p&gt;In frequentist analyses, probabilities must represent a ratio between a &lt;em&gt;number of ballistic impacts&lt;/em&gt; satisfying a given characteristics (e.g., a kinetic energy at impact that exceeds a threshold) and a &lt;em&gt;total number of ballistics&lt;/em&gt;. Depending on our definition of the second term, let’s call it &lt;strong&gt;B&lt;sub&gt;TOT&lt;/sub&gt;&lt;/strong&gt;, probabilities are going to express a different message.&lt;/p&gt;

&lt;p&gt;If &lt;strong&gt;B&lt;sub&gt;TOT&lt;/sub&gt;&lt;/strong&gt; is the total number of simulated ballistics, the probability expresses &lt;strong&gt;P(Z, E&lt;sub&gt;T&lt;/sub&gt;)&lt;/strong&gt;, that is:&lt;/p&gt;
&lt;div class=&quot;message&quot;&gt;
  What is the probability of a zone Z to be impacted by a ballistic impact with an energy threshold greater than E&lt;sub&gt;T&lt;/sub&gt;?
&lt;/div&gt;

&lt;p&gt;If &lt;strong&gt;B&lt;sub&gt;TOT&lt;/sub&gt;&lt;/strong&gt; is the total number of ballistics impacting a given zone, the probability expresses &lt;strong&gt;P(E&lt;sub&gt;T&lt;/sub&gt;|Z)&lt;/strong&gt;, that is:&lt;/p&gt;
&lt;div class=&quot;message&quot;&gt;
	What is the probability of a ballistic impacting zone Z to exceed an impact energy greater than E&lt;sub&gt;T&lt;/sub&gt;?
&lt;/div&gt;

&lt;p&gt;These probabilities are significantly different, and both are considered in the post-processing approach presented here. For simplicity, we will refer to &lt;strong&gt;B&lt;sub&gt;TOT&lt;/sub&gt;&lt;/strong&gt; as &lt;strong&gt;absolute probabilities&lt;/strong&gt; and &lt;strong&gt;B&lt;sub&gt;TOT&lt;/sub&gt;&lt;/strong&gt; as &lt;strong&gt;relative probabilities&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;2-using-the-function&quot;&gt;2 Using the function&lt;/h2&gt;
&lt;h3 id=&quot;21-input-arguments&quot;&gt;2.1 Input arguments&lt;/h3&gt;
&lt;p&gt;Table 2 summarises the input parameters required by the &lt;strong&gt;processGBF&lt;/strong&gt; function. Functions can be called using a &lt;strong&gt;GUI&lt;/strong&gt;, &lt;strong&gt;arguments&lt;/strong&gt; or a &lt;strong&gt;structure&lt;/strong&gt;. The following steps assume that you are in the root of the folder containing the functions.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Variable&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
      &lt;th&gt;Unit&lt;/th&gt;
      &lt;th&gt;Type&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;pth&lt;/td&gt;
      &lt;td&gt;Path to the output file&lt;/td&gt;
      &lt;td&gt;-&lt;/td&gt;
      &lt;td&gt;String&lt;/td&gt;
    &lt;/tr&gt;
		&lt;tr&gt;
		  &lt;td&gt;name&lt;/td&gt;
		  &lt;td&gt;Run name&lt;/td&gt;
		  &lt;td&gt;-&lt;/td&gt;
		  &lt;td&gt;String&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		  &lt;td&gt;gridRes&lt;/td&gt;
		  &lt;td&gt;Resolution of the cartesian grid, which can be enter either as a single value or a 1x2 vector. In the case of a 1x2 vector, the first value is the resolution of the grid used for the pixel approach and the second value is the resolution of the grid used to map the result of the concentric and radial approaches. If only one value is entered, the resolution of the grid for the concentric and radial approaches is arbitrarily set to be 10% finer than the grid used for the pixel approach. This is only done to ensure smooth display on maps.&lt;/td&gt;
		  &lt;td&gt;m&lt;/td&gt;
		  &lt;td&gt;Numeric&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		  &lt;td&gt;subset&lt;/td&gt;
		  &lt;td&gt;Subset of the total population of VBPs. Default is 100%, but can be decreased for sensitivity analyses&lt;/td&gt;
		  &lt;td&gt;%&lt;/td&gt;
		  &lt;td&gt;Numeric&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		  &lt;td&gt;eT&lt;/td&gt;
		  &lt;td&gt;Energy threshold(s) used to calculate exceedance probabilities. Multiple values can be defined as a vector&lt;/td&gt;
		  &lt;td&gt;J&lt;/td&gt;
		  &lt;td&gt;Numeric&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		  &lt;td&gt;pT&lt;/td&gt;
		  &lt;td&gt;Probability threshold(s) used to calculate energies occurring at a given exeedance probability. Multiple values can be defined as a vector&lt;/td&gt;
		  &lt;td&gt;%&lt;/td&gt;
		  &lt;td&gt;Numeric&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		  &lt;td&gt;dI&lt;/td&gt;
		  &lt;td&gt;Distance interval used to define concentring rings&lt;/td&gt;
		  &lt;td&gt;m&lt;/td&gt;
		  &lt;td&gt;Numeric&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		  &lt;td&gt;rI&lt;/td&gt;
		  &lt;td&gt;Angle interval used to define radial sectors&lt;/td&gt;
		  &lt;td&gt;Degrees&lt;/td&gt;
		  &lt;td&gt;Numeric&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		  &lt;td&gt;vE&lt;/td&gt;
		  &lt;td&gt;Vent easting&lt;/td&gt;
		  &lt;td&gt;m&lt;/td&gt;
		  &lt;td&gt;Numeric&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		  &lt;td&gt;vN&lt;/td&gt;
		  &lt;td&gt;Vent northing&lt;/td&gt;
		  &lt;td&gt;m&lt;/td&gt;
		  &lt;td&gt;Numeric&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		  &lt;td&gt;vZ&lt;/td&gt;
		  &lt;td&gt;Vent zone defined as a numeric value only (i.e., do not enter the letter) and *positive* in the N hemisphere and *negative* in the S hemisphere (numeric)&lt;/td&gt;
		  &lt;td&gt;-&lt;/td&gt;
		  &lt;td&gt;Numeric&lt;/td&gt;
		&lt;/tr&gt;	
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;div class=&quot;figcaption&quot;&gt;
&lt;figcaption&gt;&lt;b&gt;Table 2&lt;/b&gt;: Input variables required by the &lt;b&gt;processGBF&lt;/b&gt; function.&lt;/figcaption&gt;
&lt;/div&gt;

&lt;h4 id=&quot;211-using-the-gui&quot;&gt;2.1.1 Using the GUI&lt;/h4&gt;

&lt;p&gt;In the Matlab command, type:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-matlab&quot; data-lang=&quot;matlab&quot;&gt;&lt;span class=&quot;n&quot;&gt;processGBF&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This approach will open two consecutive GUIs that will prompt you to i) locate the input file and ii) define the additional variables described above.&lt;/p&gt;

&lt;h4 id=&quot;212-using-arguments&quot;&gt;2.1.2 Using arguments&lt;/h4&gt;
&lt;p&gt;This approach allows the user to enter all input argument separately from the command line:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-matlab&quot; data-lang=&quot;matlab&quot;&gt;&lt;span class=&quot;n&quot;&gt;processGBF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gridRes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;subset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;eT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vZ&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;All variables refer to Table 1.&lt;/p&gt;

&lt;h4 id=&quot;213-using-an-input-structure&quot;&gt;2.1.3 Using an input structure&lt;/h4&gt;
&lt;p&gt;The structure approach combines the arguments 2-9 of the argument approach into a structure. It is useful to use to output of a GBF post-processing run.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-matlab&quot; data-lang=&quot;matlab&quot;&gt;&lt;span class=&quot;n&quot;&gt;processGBF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;where &lt;var&gt;run&lt;/var&gt; is a Matlab structure named as the arguments 2-9 of the argument approach.&lt;/p&gt;

&lt;h3 id=&quot;22-output-argument&quot;&gt;2.2 Output argument&lt;/h3&gt;
&lt;p&gt;Calling:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-matlab&quot; data-lang=&quot;matlab&quot;&gt;&lt;span class=&quot;n&quot;&gt;project&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;processGBF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;returns a Matlab structure containing all the output data… but stick around until the next section!&lt;/p&gt;

&lt;h2 id=&quot;3-outputs-and-results&quot;&gt;3 Outputs and results&lt;/h2&gt;
&lt;p&gt;Upon completion of the &lt;var&gt;processGBF&lt;/var&gt; function, a folder named after the &lt;var&gt;name&lt;/var&gt; variable is created, which contains results in a Matlab format (i.e., &lt;em&gt;name&lt;/em&gt;.mat) and in a ESRI ASCII grid format. All probabilities are expressed in % and all energies are expressed in Joules.&lt;/p&gt;

&lt;h3 id=&quot;31-ascii-grid-format&quot;&gt;3.1 ASCII grid format&lt;/h3&gt;
&lt;p&gt;Three main categories of ASCII files are written:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;var&gt;pixel&lt;/var&gt;, which use a cartesian grid&lt;/li&gt;
  &lt;li&gt;&lt;var&gt;concentric&lt;/var&gt;, which use concentric zones around the vent&lt;/li&gt;
  &lt;li&gt;&lt;var&gt;radial&lt;/var&gt;, which use radial sectors around the vent&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each of these categories have sub-categories defined by:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;var&gt;prob&lt;/var&gt;, which contain the exceedence probabilities (%) for ballistic impacts to exceed a given threshold of kinetic energy&lt;/li&gt;
  &lt;li&gt;&lt;var&gt;en&lt;/var&gt;, which contain the typical kinetic energy (J) at impact for a given exceedance probabillity&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The probability files are themselves differentiated between:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;var&gt;abs&lt;/var&gt;, which contain absolute probabilities and&lt;/li&gt;
  &lt;li&gt;&lt;var&gt;rel&lt;/var&gt;, which contain relative probabilities&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;32-matlab-format&quot;&gt;3.2 Matlab format&lt;/h3&gt;
&lt;p&gt;The Matlab output file, i.e. &lt;em&gt;name&lt;/em&gt;.mat, contains the most comprehensive output. It is compiled as a Matlab &lt;em&gt;structure&lt;/em&gt; containing:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;var&gt;inBal&lt;/var&gt;, which is a duplicate of the input arguments shown in Table 1&lt;/li&gt;
  &lt;li&gt;&lt;var&gt;bal&lt;/var&gt;, which contains the data of all simulated particles&lt;/li&gt;
  &lt;li&gt;&lt;var&gt;pixel&lt;/var&gt;, which contains the result of the processing performed using a cartesian grid&lt;/li&gt;
  &lt;li&gt;&lt;var&gt;concentric&lt;/var&gt;, which contains the result of the processing performed  using concentric zones around the vent&lt;/li&gt;
  &lt;li&gt;&lt;var&gt;radial&lt;/var&gt;, which contains the result of the processing performed using radial sectors around the vent&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;bal&quot;&gt;.bal&lt;/h4&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Field&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;x&lt;/td&gt;
  	  &lt;td&gt;Easting of each ballistic (n x 1 vector, where n is the total number of simulated ballistics)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;y&lt;/td&gt;
  	  &lt;td&gt;Northing of each ballistic (n x 1 vector)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;lat&lt;/td&gt;
  	  &lt;td&gt;Latitude of each ballistic (n x 1 vector)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;lon&lt;/td&gt;
  	  &lt;td&gt;Longitude of each ballistic (n x 1 vector)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;e&lt;/td&gt;
  	  &lt;td&gt;Kinetic energy (J) at impact of each ballistic (n x 1 vector)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;n&lt;/td&gt;
  	  &lt;td&gt;Total number of simulated ballistics&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;d&lt;/td&gt;
  	  &lt;td&gt;Distance from the vent of each ballistic (n x 1 vector)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;r&lt;/td&gt;
  	  &lt;td&gt;Angle from the vent of each ballistic (n x 1 vector)&lt;/td&gt;
  	&lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;xi&lt;/td&gt;
      &lt;td&gt;X coordinate of each ballistic on the cartesian grid (n x 1 vector)&lt;/td&gt;
    &lt;/tr&gt;    
    &lt;tr&gt;
      &lt;td&gt;yi&lt;/td&gt;
      &lt;td&gt;Y coordinate of each ballistic on the cartesian grid (n x 1 vector)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;data&lt;/td&gt;
      &lt;td&gt;Original data contained in the user-defined input file&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h4 id=&quot;pixel&quot;&gt;.pixel&lt;/h4&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Field&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;east&lt;/td&gt;
  	  &lt;td&gt;Easting coordinates of the cartesian grid (i x j matrix, where i and j represent the northing and easting intervals of a grid of resolution gridRes covering the entire ballistic field, respectively)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;north&lt;/td&gt;
  	  &lt;td&gt;Northing coordinates of the cartesian grid (i x j matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;lat&lt;/td&gt;
  	  &lt;td&gt;Latitude of the cartesian grid (i x j matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;lon&lt;/td&gt;
  	  &lt;td&gt;Longitude of the cartesian grid (i x j matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;Nt&lt;/td&gt;
  	  &lt;td&gt;Number of ballistics in each pixel of the cartesian grid (i x j matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;E&lt;/td&gt;
  	  &lt;td&gt;Kinetic energy (J) at impact for a given exceedance probability computed on the cartesian grid (i x j x pT matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;N&lt;/td&gt;
  	  &lt;td&gt;Number of ballistics with kinetic energies exceeding a given energy threshold in each pixel of the cartesian grid (i x j x eT matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;Pabs&lt;/td&gt;
  	  &lt;td&gt;Absolute probability (%) for ballistic impacts to exceed an energy threshold (i x j x eT matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;Prel&lt;/td&gt;
  	  &lt;td&gt;Relative probability (%) for ballistic impacts to exceed an energy threshold &lt;/td&gt;
  	&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h4 id=&quot;concentric&quot;&gt;.concentric&lt;/h4&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Field&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;bin&lt;/td&gt;
  	  &lt;td&gt;Distances of the concentric rings around the vent (m)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;Nt&lt;/td&gt;
  	  &lt;td&gt;Number of ballistics in each concentric ring (length(bin) x 1 vector)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;N&lt;/td&gt;
  	  &lt;td&gt;Number of ballistics with kinetic energies exceeding a given energy threshold in each concentric ring (length(bin) x eT matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;E&lt;/td&gt;
  	  &lt;td&gt;Kinetic energy (J) at impact for a given exceedance probability computed in each concentric ring (length(bin) x pT matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;Pabs&lt;/td&gt;
  	  &lt;td&gt;Absolute probability (%) for ballistic impacts to exceed an energy threshold (length(bin) x eT matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;Prel&lt;/td&gt;
  	  &lt;td&gt;Relative probability (%) for ballistic impacts to exceed an energy threshold (length(bin) x eT matrix)&lt;/td&gt;
  	&lt;/tr&gt;

  	&lt;tr&gt;
  	  &lt;td&gt;east&lt;/td&gt;
  	  &lt;td&gt;Easting coordinates of the cartesian grid used to represent the concentric rings on a map (i x j matrix). i and j represent the northing and easting intervals of a grid of resolution gridRes(2) (or 10% of gridRes(1) covering the entire ballistic field, respectively&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;north&lt;/td&gt;
  	  &lt;td&gt;Northing coordinates of the cartesian grid used to represent the concentric rings on a map (i x j matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;lat&lt;/td&gt;
  	  &lt;td&gt;Latitude of the cartesian grid used to represent the concentric rings on a map (i x j matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;lon&lt;/td&gt;
  	  &lt;td&gt;Longitude of the cartesian grid used to represent the concentric rings on a map (i x j matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Note that &lt;strong&gt;binM&lt;/strong&gt;, &lt;strong&gt;NtM&lt;/strong&gt;, &lt;strong&gt;NM&lt;/strong&gt;, &lt;strong&gt;EM&lt;/strong&gt;, &lt;strong&gt;PabsM&lt;/strong&gt; and &lt;strong&gt;PrelM&lt;/strong&gt; contain the same data as &lt;strong&gt;bin&lt;/strong&gt;, &lt;strong&gt;Nt&lt;/strong&gt;, &lt;strong&gt;N&lt;/strong&gt;, &lt;strong&gt;E&lt;/strong&gt;, &lt;strong&gt;Pabs&lt;/strong&gt; and &lt;strong&gt;Prel&lt;/strong&gt; gridded on a matrix, which can be used along &lt;strong&gt;east/north&lt;/strong&gt; or &lt;strong&gt;lon/lat&lt;/strong&gt; for plotting on a map.&lt;/p&gt;

&lt;h4 id=&quot;radial&quot;&gt;.radial&lt;/h4&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Field&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;bin&lt;/td&gt;
  	  &lt;td&gt;Distances of the radial sectors around the vent (m)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;Nt&lt;/td&gt;
  	  &lt;td&gt;Number of ballistics in each radial sector (length(bin) x 1 vector)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;N&lt;/td&gt;
  	  &lt;td&gt;Number of ballistics with kinetic energies exceeding a given energy threshold in each radial sector (length(bin) x eT matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;E&lt;/td&gt;
  	  &lt;td&gt;Kinetic energy (J) at impact for a given exceedance probability computed in each radial sector (length(bin) x pT matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;Pabs&lt;/td&gt;
  	  &lt;td&gt;Absolute probability (%) for ballistic impacts to exceed an energy threshold (length(bin) x eT matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;Prel&lt;/td&gt;
  	  &lt;td&gt;Relative probability (%) for ballistic impacts to exceed an energy threshold (length(bin) x eT matrix)&lt;/td&gt;
  	&lt;/tr&gt;

  	&lt;tr&gt;
  	  &lt;td&gt;east&lt;/td&gt;
  	  &lt;td&gt;Easting coordinates of the cartesian grid used to represent the radial sectors on a map (i x j matrix). i and j represent the northing and easting intervals of a grid of resolution gridRes(2) (or 10% of gridRes(1) covering the entire ballistic field, respectively&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;north&lt;/td&gt;
  	  &lt;td&gt;Northing coordinates of the cartesian grid used to represent the radial sectors on a map (i x j matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	
  	&lt;tr&gt;
  	  &lt;td&gt;lat&lt;/td&gt;
  	  &lt;td&gt;Latitude of the cartesian grid used to represent the radial sectors on a map (i x j matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  	&lt;tr&gt;
  	  &lt;td&gt;lon&lt;/td&gt;
  	  &lt;td&gt;Longitude of the cartesian grid used to represent the radial sectors on a map (i x j matrix)&lt;/td&gt;
  	&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Here again, &lt;strong&gt;binM&lt;/strong&gt;, &lt;strong&gt;NtM&lt;/strong&gt;, &lt;strong&gt;NM&lt;/strong&gt;, &lt;strong&gt;EM&lt;/strong&gt;, &lt;strong&gt;PabsM&lt;/strong&gt; and &lt;strong&gt;PrelM&lt;/strong&gt; contain the same data as &lt;strong&gt;bin&lt;/strong&gt;, &lt;strong&gt;Nt&lt;/strong&gt;, &lt;strong&gt;N&lt;/strong&gt;, &lt;strong&gt;E&lt;/strong&gt;, &lt;strong&gt;Pabs&lt;/strong&gt; and &lt;strong&gt;Prel&lt;/strong&gt; gridded on a matrix, which can be used along &lt;strong&gt;east/north&lt;/strong&gt; or &lt;strong&gt;lon/lat&lt;/strong&gt; for plotting on a map.&lt;/p&gt;

&lt;h2 id=&quot;4-displaying-results&quot;&gt;4 Displaying results&lt;/h2&gt;
&lt;p&gt;The &lt;var&gt;displayGBF&lt;/var&gt; function offers an interactive GUI to plot the results of the &lt;var&gt;processGBF&lt;/var&gt; function. Start it by typing&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-matlab&quot; data-lang=&quot;matlab&quot;&gt;&lt;span class=&quot;n&quot;&gt;displayGBF&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;in the Matlab command. Then select the &lt;pth&gt;name*.mat&lt;/pth&gt; file output of the &lt;var&gt;processGBF&lt;/var&gt; function and you are good to go!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Manually importing ERA-Interim files in TephraProb</title>
   <link href="https://e5k.github.io/codes/2017/09/15/tephraprob-ecmwf-manual/"/>
   <updated>2017-09-15T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/2017/09/15/tephraprob-ecmwf-manual</id>
   <content type="html">&lt;p&gt;When accessing ERA-Interim data in batch, the behaviour of the ECMWF Python API is often unpredictable, which sometime complicates the automatic downloading of wind data in TephraProb. If the API does not work for you, the option of importing NetCDF files that were manually downloaded from the ERA-Interim website was added to TephraProb. Ain’t that nice?&lt;/p&gt;

&lt;p&gt;Note that you still will have to:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://apps.ecmwf.int/registration/&quot; target=&quot;_blank&quot;&gt;Create an account&lt;/a&gt; on the ECMWF website&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://apps.ecmwf.int/auth/login/&quot; target=&quot;_blank&quot;&gt;Login&lt;/a&gt; to the ECMWF website&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://api.ecmwf.int/v1/key/&quot; target=&quot;_blank&quot;&gt;Retrieve&lt;/a&gt; an API key&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://apps.ecmwf.int/datasets/licences/general/&quot; target=&quot;_blank&quot;&gt;Accept&lt;/a&gt; the license&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;1-download-the-data&quot;&gt;1 Download the data&lt;/h2&gt;
&lt;h3 id=&quot;select-variables&quot;&gt;Select variables&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;Go to &lt;a href=&quot;http://apps.ecmwf.int/datasets/data/interim-full-daily/levtype=pl/&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt; page. On the top left corner of the page, be sure the type of level is &lt;strong&gt;pressure level&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;In the &lt;strong&gt;Select date&lt;/strong&gt; box, select the date interval. You can either manually enter the dates or click in the grid. In any case, two things to keep in mind:
    &lt;ul&gt;
      &lt;li&gt;Time ranges &lt;strong&gt;must be continuous&lt;/strong&gt;&lt;/li&gt;
      &lt;li&gt;Requesting longer time periods result in longer request times on their servers. With TephraProb, you can split your time range in smaller subsets.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;In the &lt;strong&gt;Select time&lt;/strong&gt; box, select the four time intervals.&lt;/li&gt;
  &lt;li&gt;In the &lt;strong&gt;Select level and parameter&lt;/strong&gt; box, click on (which should select all levels):
    &lt;ul&gt;
      &lt;li&gt;&lt;em&gt;Geopotential&lt;/em&gt;&lt;/li&gt;
      &lt;li&gt;&lt;em&gt;U component of wind&lt;/em&gt;&lt;/li&gt;
      &lt;li&gt;&lt;em&gt;V component of wind&lt;/em&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;At the bottom of the page, click the &lt;strong&gt;Retrieve NetCDF&lt;/strong&gt; button&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;customise-the-grid&quot;&gt;Customise the grid&lt;/h3&gt;
&lt;p&gt;The next page appears and a few customisations need to be done:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Change the &lt;strong&gt;grid&lt;/strong&gt; resolution to 0.25x0.25.&lt;/li&gt;
  &lt;li&gt;Enter a custom &lt;strong&gt;area&lt;/strong&gt;. TephraProb interpolates the wind above the vent, so it is a good practice to define a grid that spans a few (typically ≥ 2) points around the vent, knowing the grid resolution defined above.&lt;/li&gt;
  &lt;li&gt;Click the &lt;strong&gt;Retrieve now&lt;/strong&gt; button and the request will start.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;retrieving-your-request&quot;&gt;Retrieving your request&lt;/h3&gt;
&lt;p&gt;Right, so depending on the size of your request, the processing on the ECMWF servers might take a while (a whole year usually takes me between 15-30 minutes). If you quit your browser’s page, no worries! &lt;a href=&quot;http://apps.ecmwf.int/webmars/joblist/&quot; target=&quot;_blank&quot;&gt;This page&lt;/a&gt; provides you with an history of your requests.&lt;/p&gt;

&lt;h2 id=&quot;2-processing&quot;&gt;2 Processing&lt;/h2&gt;
&lt;p&gt;Once you’ve got all your data ready, switch back to TephraProb and use the &lt;cmd&gt;Input &amp;gt; Wind &amp;gt; Download wind data&lt;/cmd&gt; tool. Select the &lt;strong&gt;ECMWF ERA-Interim Offline&lt;/strong&gt; Reanalysis dataset and fill the required inputs and here you go!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>The effect of particle shape on the estimation of plume height</title>
   <link href="https://e5k.github.io/codes/2017/09/15/effect-of-shape-on-height/"/>
   <updated>2017-09-15T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/2017/09/15/effect-of-shape-on-height</id>
   <content type="html">&lt;p&gt;The method of &lt;a href=&quot;https://link.springer.com/article/10.1007%2FBF01046546?LI=true&quot; target=&quot;_blank&quot;&gt;Carey and Sparks (1986)&lt;/a&gt; allows to estimate the height of strong plumes based on the geometry of isopleth maps. Although the method has its limitations, it is still the most used in the literature and remains important for the characterisation of eruption source parameters for eruptions that have no direct observations.&lt;/p&gt;

&lt;p&gt;Commonly, the contouring of the lithic isopleths is preferred over the juvenile fraction because lithics are less likely to break and because the drag of smooth particles is easier to estimate. Computations behind the method of Carey and Sparks (1986) are somehow obscure and difficult to reproduce and is based on a fixed value of drag coefficient of &lt;b&gt;1.054&lt;/b&gt; and the assumption of spherical particles.&lt;/p&gt;

&lt;p&gt;The method relies on a manual plotting on downwind vs. crosswind ranges for four values of diameters/densities. For the needs of the &lt;a href=&quot;/pages/terror&quot;&gt;TError&lt;/a&gt; package, we implemented the method of Carey and Sparks (1986) as a Matlab function in order to use it routinely and to be able to work with a continuum of particle sizes and densities (see the reference page for more details). But then, during a long flight back from Japan with my buddy Mohssen Bagheri in which the best movie Lufthansa could propose was the biopic on Jimi Hendrix (sacrilege!), we started wondering how much would the shape parameter of the particle influence the estimate of the plume height.&lt;/p&gt;

&lt;h2 id=&quot;method&quot;&gt;Method&lt;/h2&gt;
&lt;p&gt;Ok, remember that the two assumptions of the model of Carey and Sparks we would like to test are:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;The use of spherical particles&lt;/li&gt;
  &lt;li&gt;The use of a fixed drag coefficient of 1.054 (note that even our method does not account for a variable drag coefficient).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here, I won’t re-write Bagheri’s papers - which you can find at the bottom of the page - but just give an idea of the method taken.&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;For a given diameter and density, the corresponding plume height and wind speed are calculated with the method of Carey and Sparks (1986)&lt;/li&gt;
  &lt;li&gt;For the same diameter and density, we calculate the terminal fall velocity for a range of elongation and a flatness values as described in Bagheri and Bonadonna (2016). Note that the elongation is the ration between the intermediate and the longest axes (I/L) whereas the flatness is the ratio between the shortest and the intermediate axes (S/I) (Bagheri et al., 2015).&lt;/li&gt;
  &lt;li&gt;Equation 3 of Carey and Sparks is inverted to convert this terminal fall velocity to an equivalent diameter.&lt;/li&gt;
  &lt;li&gt;This equivalent diameter is in turn used to calculate the plume height and the wind speed through the method of Carey and Sparks (1986).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Voilà!&lt;/p&gt;

&lt;h2 id=&quot;results&quot;&gt;Results&lt;/h2&gt;
&lt;p&gt;This process is implemented in a Matlab function named &lt;a href=&quot;/pages/cs86&quot;&gt;CareySparks86&lt;/a&gt;. Figure 1 shows the output of the process for elongation and flatness values ranging from 0.1 to 1.0. The square box shows the range of shapes typically relevant for volcanic lapilli (Bagheri et al., 2015) and the red curve shows a fixed value of drag coefficient of 1.054.&lt;/p&gt;

&lt;figure&gt;
	&lt;img src=&quot;/img/blog/201709/cs86.jpg&quot; /&gt;
	&lt;figcaption&gt;&lt;b&gt;Fig. 1&lt;/b&gt; Illustration of the effect of particle shape on the estimation of the plume height (left) and wind speed (right). The red lines contour a drag coefficient of 1.054 specified in Carey and Sparks (1986) for a given clast diameter and density.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&quot;recommendations&quot;&gt;Recommendations&lt;/h2&gt;
&lt;p&gt;The plume height is a critical source parameter, and although recent method help estimating it more precisely when observed, older deposit still strongly depends on the method of Carey and Sparks (1986) and the characterisation of the maximum clasts. The work of Mohssen Bagheri really reduces the uncertainty on the estimation of the drag coefficient and here are the recommendations that come out of his papers for estimating an equivalent diameter:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;For a given clast, look for the projection with the maximum area.&lt;/li&gt;
  &lt;li&gt;The largest axis from this projection defines L and the smallest axis defines I. Note that they &lt;b&gt;do not need&lt;/b&gt; to be perpendicular.&lt;/li&gt;
  &lt;li&gt;Look for the projection with the smallest area. The smallest axis on this projection defines S.&lt;/li&gt;
  &lt;li&gt;Use the geometric mean of L, I and S as your equivalent diameter.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;further-reading&quot;&gt;Further reading&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;Bagheri GH, Bonadonna C, Manzella I, Vonlanthen P (2015) On the characterization of size and shape of irregular particles. Powder Technol 270:141–153.&lt;/li&gt;
  &lt;li&gt;Bagheri G, Bonadonna C (2016) On the drag of freely falling non-spherical particles. Powder Technol 301:526–544. doi: https://doi.org/10.1016/j.powtec.2016.06.015&lt;/li&gt;
  &lt;li&gt;Biass S, Bagheri G, Aeberhard W, Bonadonna C (2014) TError: towards a better quantification of the uncertainty propagated during the characterization of tephra deposits. Stat Volcanol 1:1–27.&lt;/li&gt;
  &lt;li&gt;Carey S, Sparks R (1986) Quantitative models of the fallout and dispersal of tephra from volcanic eruption columns. Bull Volcanol 48:109–125.&lt;/li&gt;
&lt;/ol&gt;
</content>
 </entry>
 
 <entry>
   <title>Manually importing NOAA Reanalysis files in TephraProb</title>
   <link href="https://e5k.github.io/codes/2017/09/12/tephraprob-noaa-manual/"/>
   <updated>2017-09-12T00:00:00+00:00</updated>
   <id>https://e5k.github.io/codes/2017/09/12/tephraprob-noaa-manual</id>
   <content type="html">&lt;p&gt;It is sometime necessary to import into TephraProb some NOAA Reanalysis NetCDF files downloaded manually. One of the reasons is that the NOAA server is accessed via FTP, and firewalls (such as those installed in University networks) might result in an error such as this:&lt;/p&gt;

&lt;p&gt;Firewalls - such as those installed in University networks- can block the FTP access to NOAA servers and result in this kind of error:&lt;/p&gt;

&lt;div class=&quot;language-matlab highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;ftp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mget&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;109&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;FTP&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;425.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this case, it is necessary to manually download the NOAA Reanalysis NetCDF files. When working with the NOAA Reanalysis dataset (either the &lt;a href=&quot;https://psl.noaa.gov/data/gridded/data.ncep.reanalysis.html&quot;&gt;NCEP/NCAR Reanalysis 1&lt;/a&gt; or &lt;a href=&quot;https://psl.noaa.gov/data/gridded/data.ncep.reanalysis2.html&quot;&gt;NCEP-DOE Reanalysis 2&lt;/a&gt; versions), TephraProb will look for NetCDF files located in the folder &lt;pth&gt;WIND/_Reanalysis1_Rawdata/&lt;/pth&gt; or &lt;pth&gt;WIND/_Reanalysis2_Rawdata/&lt;/pth&gt;. Each file is named &lt;pth&gt;variable/year.nc&lt;/pth&gt;, where &lt;em&gt;variable&lt;/em&gt; can be &lt;var&gt;hgt&lt;/var&gt; (i.e. geopotential height), &lt;var&gt;uwnd&lt;/var&gt; (i.e. u wind component) and &lt;var&gt;vwnd&lt;/var&gt; (i.e. v wind component). Each of this file contains data for an entire year for the Global Grid defined by NOAA.&lt;/p&gt;

&lt;p&gt;When using the function &lt;cmd&gt;Input &amp;gt; Wind &amp;gt; Download&lt;/cmd&gt; wind data from the TephraProb GUI, the code will first check whether files for the requested time period already exist in the &lt;pth&gt;_Rawdata/&lt;/pth&gt; folder in order to avoid multiple downloads. If they do not, well, then they are downloaded, else the downloading part is skipped and files are automatically processed, where temporal and spatial subsets are extracted.&lt;/p&gt;

&lt;p&gt;What we will do is manually download files from the NOAA website from a usual web browser in order to bypass the use of FTP and manually place them in the &lt;pth&gt;_Rawdata/&lt;/pth&gt; to cheat the downloading part.&lt;/p&gt;

&lt;h2 id=&quot;1-download-the-data&quot;&gt;1 Download the data&lt;/h2&gt;
&lt;p&gt;Download the raw NetCDF files from the following links:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Reanalysis 1: &lt;a href=&quot;https://psl.noaa.gov/cgi-bin/db_search/DBListFiles.pl?did=192&amp;amp;tid=88827&amp;amp;vid=14&quot; target=&quot;_blank&quot; class=&quot;tag&quot;&gt;hgt&lt;/a&gt;&lt;a href=&quot;https://psl.noaa.gov/cgi-bin/db_search/DBListFiles.pl?did=192&amp;amp;tid=88827&amp;amp;vid=18&quot; target=&quot;_blank&quot; class=&quot;tag&quot;&gt;uwnd&lt;/a&gt;&lt;a href=&quot;https://psl.noaa.gov/cgi-bin/db_search/DBListFiles.pl?did=192&amp;amp;tid=88827&amp;amp;vid=19&quot; target=&quot;_blank&quot; class=&quot;tag&quot;&gt;vwnd&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Reanalysis 2: &lt;a href=&quot;https://psl.noaa.gov/cgi-bin/db_search/DBListFiles.pl?did=61&amp;amp;tid=81619&amp;amp;vid=1454&quot; target=&quot;_blank&quot; class=&quot;tag&quot;&gt;hgt&lt;/a&gt;&lt;a href=&quot;https://psl.noaa.gov/cgi-bin/db_search/DBListFiles.pl?did=61&amp;amp;tid=81619&amp;amp;vid=4300&quot; target=&quot;_blank&quot; class=&quot;tag&quot;&gt;uwnd&lt;/a&gt;&lt;a href=&quot;https://psl.noaa.gov/cgi-bin/db_search/DBListFiles.pl?did=61&amp;amp;tid=81619&amp;amp;vid=4306&quot; target=&quot;_blank&quot; class=&quot;tag&quot;&gt;vwnd&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;2-processing&quot;&gt;2 Processing&lt;/h2&gt;
&lt;p&gt;Move the downloaded NetCDF files to the folders &lt;pth&gt;WIND/_Reanalysis1_Rawdata/&lt;/pth&gt; or &lt;pth&gt;WIND/_Reanalysis2_Rawdata/&lt;/pth&gt;. Now use the &lt;cmd&gt;Input &amp;gt; Wind &amp;gt; Download wind data&lt;/cmd&gt; from the TephraProb GUI as you would normally do, specify the right dataset and voila!&lt;/p&gt;
</content>
 </entry>
 

</feed>
