/usr/share/doc/python-mpop/html/quickstart.html is in python-mpop 1.5.0-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Quickstart — mpop v1.5.0 documentation</title>
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: 'v1.5.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Making use of the mpop package" href="pp.html" />
<link rel="prev" title="Installation instructions" href="install.html" />
</head>
<body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pp.html" title="Making use of the mpop package"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="install.html" title="Installation instructions"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">mpop v1.5.0 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="quickstart">
<h1>Quickstart<a class="headerlink" href="#quickstart" title="Permalink to this headline">¶</a></h1>
<p>The software uses OOP extensively, to allow higher level metaobject handling.</p>
<p>For this tutorial, we will use the Meteosat plugin and data.</p>
<p>Don’t forget to first source the <cite>profile</cite> file of interest located in the
source <cite>etc</cite> directory.</p>
<div class="section" id="first-example">
<h2>First example<a class="headerlink" href="#first-example" title="Permalink to this headline">¶</a></h2>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.10.0: </span>The factory-based loading was added in 0.10.0</p>
</div>
<p>Ok, let’s get it on:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">mpop.satellites</span> <span class="k">import</span> <span class="n">GeostationaryFactory</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">mpop.projector</span> <span class="k">import</span> <span class="n">get_area_def</span>
<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">datetime</span>
<span class="gp">>>> </span><span class="n">time_slot</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="p">(</span><span class="mi">2009</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">14</span><span class="p">,</span> <span class="mi">30</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">global_data</span> <span class="o">=</span> <span class="n">GeostationaryFactory</span><span class="o">.</span><span class="n">create_scene</span><span class="p">(</span><span class="s2">"Meteosat-9"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"seviri"</span><span class="p">,</span> <span class="n">time_slot</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">europe</span> <span class="o">=</span> <span class="n">get_area_def</span><span class="p">(</span><span class="s2">"EuropeCanary"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">global_data</span><span class="o">.</span><span class="n">load</span><span class="p">([</span><span class="mf">0.6</span><span class="p">,</span> <span class="mf">0.8</span><span class="p">,</span> <span class="mf">10.8</span><span class="p">],</span> <span class="n">area_extent</span><span class="o">=</span><span class="n">europe</span><span class="o">.</span><span class="n">area_extent</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span> <span class="n">global_data</span>
<span class="go">'IR_097: (9.380,9.660,9.940)μm, resolution 3000.40316582m, not loaded'</span>
<span class="go">'IR_016: (1.500,1.640,1.780)μm, resolution 3000.40316582m, not loaded'</span>
<span class="go">'VIS008: (0.740,0.810,0.880)μm, shape (1200, 3000), resolution 3000.40316582m'</span>
<span class="go">'VIS006: (0.560,0.635,0.710)μm, shape (1200, 3000), resolution 3000.40316582m'</span>
<span class="go">'WV_062: (5.350,6.250,7.150)μm, resolution 3000.40316582m, not loaded'</span>
<span class="go">'IR_120: (11.000,12.000,13.000)μm, resolution 3000.40316582m, not loaded'</span>
<span class="go">'WV_073: (6.850,7.350,7.850)μm, resolution 3000.40316582m, not loaded'</span>
<span class="go">'IR_087: (8.300,8.700,9.100)μm, resolution 3000.40316582m, not loaded'</span>
<span class="go">'IR_039: (3.480,3.920,4.360)μm, resolution 3000.40316582m, not loaded'</span>
<span class="go">'HRV: (0.500,0.700,0.900)μm, resolution 1000.13434887m, not loaded'</span>
<span class="go">'IR_134: (12.400,13.400,14.400)μm, resolution 3000.40316582m, not loaded'</span>
<span class="go">'IR_108: (9.800,10.800,11.800)μm, shape (1200, 3000), resolution 3000.40316582m'</span>
</pre></div>
</div>
<p>In this example, we create a scene object for the seviri instrument onboard
Meteosat-9, specifying the time of the snapshot of interest. The time is
defined as a datetime object.</p>
<p>The next step is loading the data. This is done using mipp, which takes care of
reading the HRIT data, and slicing the data so that we read just what is
needed. Calibration is also done with mipp. In order to slice the data, we
retreive the area we will work on, here set to variable <em>europe</em>.</p>
<p>Here we call the <code class="xref py py-meth docutils literal"><span class="pre">load()</span></code> function with a list of the wavelengths of the
channels we are interested in, and the area extent in satellite projection of
the area of interest. Each retrieved channel is the closest in terms of central
wavelength, provided that the required wavelength is within the bounds of the
channel.</p>
<p>The wavelengths are given in micrometers and have to be given as a floating
point number (<em>i.e.</em>, don’t type ‘1’, but ‘1.0’). Using an integer number
instead returns a channel based on resolution, while using a string retrieves a
channels based on its name.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">img</span> <span class="o">=</span> <span class="n">global_data</span><span class="o">.</span><span class="n">image</span><span class="o">.</span><span class="n">overview</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">img</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s2">"./myoverview.png"</span><span class="p">)</span>
<span class="go">>>></span>
</pre></div>
</div>
<p>Once the channels are loaded, we generate an overview RGB composite image, and
save it as a png image. Instead of <code class="xref py py-meth docutils literal"><span class="pre">save()</span></code>, one could also use
<code class="xref py py-meth docutils literal"><span class="pre">show()</span></code> if the only purpose is to display the image on screen.</p>
<p>Available composites are listed in the <code class="xref py py-mod docutils literal"><span class="pre">mpop.satellites.visir</span></code> module
in the mpop documentation.</p>
</div>
<div class="section" id="we-want-more">
<h2>We want more!<a class="headerlink" href="#we-want-more" title="Permalink to this headline">¶</a></h2>
<p>In the last example, the composite generation worked because the channels
needed for the overview (0.6, 0.8, 10.8 μm) were loaded. If we try to generate
a day natural color composite, which requires also the 1.6 μm channel, it will
result in an error:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">img</span> <span class="o">=</span> <span class="n">global_data</span><span class="o">.</span><span class="n">image</span><span class="o">.</span><span class="n">natural</span><span class="p">()</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">NotLoadedError</span>: <span class="n">Required channel 1.63 not loaded, aborting.</span>
</pre></div>
</div>
<p>So it means that we have to load the missing channel first. To do this we could
enter the channels list to load manually, as we did for the overview, but we
provide a way to get the list of channels needed by a given method using the
<cite>prerequisites</cite> method attribute:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">global_data</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">global_data</span><span class="o">.</span><span class="n">image</span><span class="o">.</span><span class="n">natural</span><span class="o">.</span><span class="n">prerequisites</span><span class="p">,</span> <span class="n">area_extent</span><span class="o">=</span><span class="n">europe</span><span class="o">.</span><span class="n">area_extent</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">img</span> <span class="o">=</span> <span class="n">global_data</span><span class="o">.</span><span class="n">image</span><span class="o">.</span><span class="n">natural</span><span class="p">()</span>
<span class="go">>>></span>
</pre></div>
</div>
<p>Now you can save the image:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">img</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s2">"./mynaturalcolors.png"</span><span class="p">)</span>
<span class="go">>>></span>
</pre></div>
</div>
<p>If you want to combine several prerequisites for channel loading, since
prerequisites are python sets, you can do:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">global_data</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">global_data</span><span class="o">.</span><span class="n">image</span><span class="o">.</span><span class="n">overview</span><span class="o">.</span><span class="n">prerequisites</span> <span class="o">|</span>
<span class="gp">... </span> <span class="n">global_data</span><span class="o">.</span><span class="n">image</span><span class="o">.</span><span class="n">natural</span><span class="o">.</span><span class="n">prerequisites</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">area_extent</span><span class="o">=</span><span class="n">europe</span><span class="o">.</span><span class="n">area_extent</span><span class="p">)</span>
<span class="go">>>></span>
</pre></div>
</div>
<p>and add as many <cite>| global_data.image.mymethod.prerequisites</cite> as needed.</p>
</div>
<div class="section" id="retrieving-channels">
<h2>Retrieving channels<a class="headerlink" href="#retrieving-channels" title="Permalink to this headline">¶</a></h2>
<p>Retrieving channels is dead easy. From the center wavelength:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span> <span class="n">global_data</span><span class="p">[</span><span class="mf">0.6</span><span class="p">]</span>
<span class="go">'VIS006: (0.560,0.635,0.710)μm, shape (1200, 3000), resolution 3000.40316582m'</span>
</pre></div>
</div>
<p>or from the channel name:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span> <span class="n">global_data</span><span class="p">[</span><span class="s2">"VIS006"</span><span class="p">]</span>
<span class="go">'VIS006: (0.560,0.635,0.710)μm, shape (1200, 3000), resolution 3000.40316582m'</span>
</pre></div>
</div>
<p>or from the resolution:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span> <span class="n">global_data</span><span class="p">[</span><span class="mi">3000</span><span class="p">]</span>
<span class="go">'VIS006: (0.560,0.635,0.710)μm, shape (1200, 3000), resolution 3000.40316582m'</span>
</pre></div>
</div>
<p>or more than one at the time:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span> <span class="n">global_data</span><span class="p">[</span><span class="mi">3000</span><span class="p">,</span> <span class="mf">0.8</span><span class="p">]</span>
<span class="go">'VIS008: (0.740,0.810,0.880)μm, shape (1200, 3000), resolution 3000.40316582m'</span>
</pre></div>
</div>
<p>The printed lines consists of the following values:</p>
<ul class="simple">
<li>First the name is displayed,</li>
<li>then the triplet gives the min-, center-, and max-wavelength of the
channel,</li>
<li>follows the shape of the loaded data, or <cite>None</cite> if the data is not loaded,</li>
<li>and finally the theoretical resolution of the channel is shown.</li>
</ul>
<p>The data of the channel can be retrieved as an numpy (masked) array using the
data property:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span> <span class="n">global_data</span><span class="p">[</span><span class="mf">0.6</span><span class="p">]</span><span class="o">.</span><span class="n">data</span>
<span class="go">[[-- -- -- ..., -- -- --]</span>
<span class="go"> [-- -- -- ..., -- -- --]</span>
<span class="go"> [-- -- -- ..., -- -- --]</span>
<span class="go"> ...,</span>
<span class="go"> [7.37684259374 8.65549530999 6.58997938374 ..., 0.29507370375 0.1967158025</span>
<span class="go"> 0.1967158025]</span>
<span class="go"> [7.18012679124 7.86863209999 6.19654777874 ..., 0.29507370375</span>
<span class="go"> 0.29507370375 0.29507370375]</span>
<span class="go"> [5.80311617374 7.57355839624 6.88505308749 ..., 0.29507370375</span>
<span class="go"> 0.29507370375 0.29507370375]]</span>
</pre></div>
</div>
</div>
<div class="section" id="channel-arithmetics">
<h2>Channel arithmetics<a class="headerlink" href="#channel-arithmetics" title="Permalink to this headline">¶</a></h2>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.10.0: </span>Channel arithmetics added.</p>
</div>
<p>The common arithmetical operators are supported on channels, so that one can
run for example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">cool_channel</span> <span class="o">=</span> <span class="p">(</span><span class="n">global_data</span><span class="p">[</span><span class="mf">0.6</span><span class="p">]</span> <span class="o">-</span> <span class="n">global_data</span><span class="p">[</span><span class="mf">0.8</span><span class="p">])</span> <span class="o">*</span> <span class="n">global_data</span><span class="p">[</span><span class="mf">10.8</span><span class="p">]</span>
</pre></div>
</div>
</div>
<div class="section" id="pges">
<h2>PGEs<a class="headerlink" href="#pges" title="Permalink to this headline">¶</a></h2>
<p>From the satellite data PGEs <a class="footnote-reference" href="#f1" id="id1">[1]</a> are generated by the accompanying program.
The loading procedure for PGEs is exactly the same as with regular channels:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">global_data</span><span class="o">.</span><span class="n">area</span> <span class="o">=</span> <span class="s2">"EuropeCanary"</span>
<span class="gp">>>> </span><span class="n">global_data</span><span class="o">.</span><span class="n">load</span><span class="p">([</span><span class="s2">"CTTH"</span><span class="p">])</span>
<span class="go">>>></span>
</pre></div>
</div>
<p>and they can be retrieved as simply as before:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span> <span class="n">global_data</span><span class="p">[</span><span class="s2">"CTTH"</span><span class="p">]</span>
<span class="go">'CTTH: shape (1200, 3000), resolution 3000.40316582m'</span>
</pre></div>
</div>
</div>
<div class="section" id="making-custom-composites">
<h2>Making custom composites<a class="headerlink" href="#making-custom-composites" title="Permalink to this headline">¶</a></h2>
<p>Building custom composites makes use of the <code class="xref py py-mod docutils literal"><span class="pre">imageo</span></code> module. For example,
building an overview composite can be done manually with:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">mpop.imageo.geo_image</span> <span class="k">import</span> <span class="n">GeoImage</span>
<span class="gp">>>> </span><span class="n">img</span> <span class="o">=</span> <span class="n">GeoImage</span><span class="p">((</span><span class="n">global_data</span><span class="p">[</span><span class="mf">0.6</span><span class="p">]</span><span class="o">.</span><span class="n">data</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">global_data</span><span class="p">[</span><span class="mf">0.8</span><span class="p">]</span><span class="o">.</span><span class="n">data</span><span class="p">,</span>
<span class="gp">... </span> <span class="o">-</span><span class="n">global_data</span><span class="p">[</span><span class="mf">10.8</span><span class="p">]</span><span class="o">.</span><span class="n">data</span><span class="p">),</span>
<span class="gp">... </span> <span class="s2">"EuropeCanary"</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">time_slot</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">mode</span> <span class="o">=</span> <span class="s2">"RGB"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">img</span><span class="o">.</span><span class="n">enhance</span><span class="p">(</span><span class="n">stretch</span><span class="o">=</span><span class="s2">"crude"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">img</span><span class="o">.</span><span class="n">enhance</span><span class="p">(</span><span class="n">gamma</span><span class="o">=</span><span class="mf">1.7</span><span class="p">)</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.10.0: </span>Custom composites module added.</p>
</div>
<p>In order to have mpop automatically use the composites you create, it is
possible to write them in a python module which name has to be specified in the
<cite>mpop.cfg</cite> configuration file, under the <em>composites</em> section:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">composites</span><span class="p">]</span>
<span class="n">module</span><span class="o">=</span><span class="n">mpop</span><span class="o">.</span><span class="n">smhi_composites</span>
</pre></div>
</div>
<p>The module has to be importable (i.e. it has to be in the pythonpath).
Here is an example of such a module:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">overview</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""Make an overview RGB image composite.</span>
<span class="sd"> """</span>
<span class="bp">self</span><span class="o">.</span><span class="n">check_channels</span><span class="p">(</span><span class="mf">0.635</span><span class="p">,</span> <span class="mf">0.85</span><span class="p">,</span> <span class="mf">10.8</span><span class="p">)</span>
<span class="n">ch1</span> <span class="o">=</span> <span class="bp">self</span><span class="p">[</span><span class="mf">0.635</span><span class="p">]</span><span class="o">.</span><span class="n">check_range</span><span class="p">()</span>
<span class="n">ch2</span> <span class="o">=</span> <span class="bp">self</span><span class="p">[</span><span class="mf">0.85</span><span class="p">]</span><span class="o">.</span><span class="n">check_range</span><span class="p">()</span>
<span class="n">ch3</span> <span class="o">=</span> <span class="o">-</span><span class="bp">self</span><span class="p">[</span><span class="mf">10.8</span><span class="p">]</span><span class="o">.</span><span class="n">data</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">geo_image</span><span class="o">.</span><span class="n">GeoImage</span><span class="p">((</span><span class="n">ch1</span><span class="p">,</span> <span class="n">ch2</span><span class="p">,</span> <span class="n">ch3</span><span class="p">),</span>
<span class="bp">self</span><span class="o">.</span><span class="n">area</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">time_slot</span><span class="p">,</span>
<span class="n">fill_value</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
<span class="n">mode</span><span class="o">=</span><span class="s2">"RGB"</span><span class="p">)</span>
<span class="n">img</span><span class="o">.</span><span class="n">enhance</span><span class="p">(</span><span class="n">stretch</span> <span class="o">=</span> <span class="p">(</span><span class="mf">0.005</span><span class="p">,</span> <span class="mf">0.005</span><span class="p">))</span>
<span class="k">return</span> <span class="n">img</span>
<span class="n">overview</span><span class="o">.</span><span class="n">prerequisites</span> <span class="o">=</span> <span class="nb">set</span><span class="p">([</span><span class="mf">0.6</span><span class="p">,</span> <span class="mf">0.8</span><span class="p">,</span> <span class="mf">10.8</span><span class="p">])</span>
<span class="k">def</span> <span class="nf">hr_visual</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""Make a High Resolution visual BW image composite from Seviri</span>
<span class="sd"> channel.</span>
<span class="sd"> """</span>
<span class="bp">self</span><span class="o">.</span><span class="n">check_channels</span><span class="p">(</span><span class="s2">"HRV"</span><span class="p">)</span>
<span class="n">img</span> <span class="o">=</span> <span class="n">geo_image</span><span class="o">.</span><span class="n">GeoImage</span><span class="p">(</span><span class="bp">self</span><span class="p">[</span><span class="s2">"HRV"</span><span class="p">]</span><span class="o">.</span><span class="n">data</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">area</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">time_slot</span><span class="p">,</span>
<span class="n">fill_value</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
<span class="n">mode</span><span class="o">=</span><span class="s2">"L"</span><span class="p">)</span>
<span class="n">img</span><span class="o">.</span><span class="n">enhance</span><span class="p">(</span><span class="n">stretch</span><span class="o">=</span><span class="s2">"crude"</span><span class="p">)</span>
<span class="k">return</span> <span class="n">img</span>
<span class="n">hr_visual</span><span class="o">.</span><span class="n">prerequisites</span> <span class="o">=</span> <span class="nb">set</span><span class="p">([</span><span class="s2">"HRV"</span><span class="p">])</span>
<span class="n">seviri</span> <span class="o">=</span> <span class="p">[</span><span class="n">overview</span><span class="p">,</span>
<span class="n">hr_visual</span><span class="p">]</span>
</pre></div>
</div>
</div>
<div class="section" id="projections">
<h2>Projections<a class="headerlink" href="#projections" title="Permalink to this headline">¶</a></h2>
<p>Until now, we have used the channels directly as provided by the satellite,
that is in satellite projection. Generating composites thus produces views in
satellite projection, <em>i.e.</em> as viewed by the satellite.</p>
<p>Most often however, we will want to project the data onto a specific area so
that only the area of interest is depicted in the RGB composites.</p>
<p>Here is how we do that:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">local_data</span> <span class="o">=</span> <span class="n">global_data</span><span class="o">.</span><span class="n">project</span><span class="p">(</span><span class="s2">"eurol"</span><span class="p">)</span>
<span class="go">>>></span>
</pre></div>
</div>
<p>Now we have projected data onto the “eurol” area in the <cite>local_data</cite> variable
and we can operate as before to generate and play with RGB composites:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">img</span> <span class="o">=</span> <span class="n">local_data</span><span class="o">.</span><span class="n">image</span><span class="o">.</span><span class="n">overview</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">img</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s2">"./local_overview.tif"</span><span class="p">)</span>
<span class="go">>>></span>
</pre></div>
</div>
<p>The image is saved here in <a class="reference external" href="http://trac.osgeo.org/geotiff/">GeoTiff</a> format.</p>
<p>On projected images, one can also add contour overlay with the
<code class="xref py py-meth docutils literal"><span class="pre">imageo.geo_image.add_overlay()</span></code>.</p>
<p class="rubric">Footnotes</p>
<table class="docutils footnote" frame="void" id="f1" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>PGEs in Meteosat : CloudType and CTTH</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Quickstart</a><ul>
<li><a class="reference internal" href="#first-example">First example</a></li>
<li><a class="reference internal" href="#we-want-more">We want more!</a></li>
<li><a class="reference internal" href="#retrieving-channels">Retrieving channels</a></li>
<li><a class="reference internal" href="#channel-arithmetics">Channel arithmetics</a></li>
<li><a class="reference internal" href="#pges">PGEs</a></li>
<li><a class="reference internal" href="#making-custom-composites">Making custom composites</a></li>
<li><a class="reference internal" href="#projections">Projections</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="install.html"
title="previous chapter">Installation instructions</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="pp.html"
title="next chapter">Making use of the <code class="docutils literal"><span class="pre">mpop</span></code> package</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/quickstart.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pp.html" title="Making use of the mpop package"
>next</a> |</li>
<li class="right" >
<a href="install.html" title="Installation instructions"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">mpop v1.5.0 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2018, The pytroll crew.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.7.
</div>
</body>
</html>
|