Skip to content

Commit

Permalink
deploy: a5577c2
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfidan committed Jan 24, 2024
1 parent 9941c39 commit 28c3965
Show file tree
Hide file tree
Showing 5 changed files with 1,294 additions and 33 deletions.
105 changes: 95 additions & 10 deletions notebooks/pyart/pyart-basics.html
Original file line number Diff line number Diff line change
Expand Up @@ -508,16 +508,15 @@ <h2>Imports<a class="headerlink" href="#imports" title="Permalink to this headin
</div>
</div>
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
<span class="ne">ModuleNotFoundError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
<span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">line</span> <span class="mi">8</span>
<span class="g g-Whitespace"> </span><span class="mi">4</span> <span class="kn">import</span> <span class="nn">cartopy.crs</span> <span class="k">as</span> <span class="nn">ccrs</span>
<span class="g g-Whitespace"> </span><span class="mi">5</span> <span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
<span class="ne">----&gt; </span><span class="mi">8</span> <span class="kn">import</span> <span class="nn">pyart</span>
<span class="g g-Whitespace"> </span><span class="mi">9</span> <span class="kn">from</span> <span class="nn">pyart.testing</span> <span class="kn">import</span> <span class="n">get_test_data</span>
<span class="g g-Whitespace"> </span><span class="mi">11</span> <span class="n">warnings</span><span class="o">.</span><span class="n">filterwarnings</span><span class="p">(</span><span class="s1">&#39;ignore&#39;</span><span class="p">)</span>

<span class="ne">ModuleNotFoundError</span>: No module named &#39;pyart&#39;
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>## You are using the Python ARM Radar Toolkit (Py-ART), an open source
## library for working with weather radar data. Py-ART is partly
## supported by the U.S. Department of Energy as part of the Atmospheric
## Radiation Measurement (ARM) Climate Research Facility, an Office of
## Science user facility.
##
## If you use this software to prepare a publication, please cite:
##
## JJ Helmus and SM Collis, JORS 2016, doi: 10.5334/jors.119
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -585,6 +584,14 @@ <h3>Reading data in using <code class="docutils literal notranslate"><span class
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Downloading file &#39;swx_20120520_0641.nc&#39; from &#39;https://adc.arm.gov/pyart/example_data/swx_20120520_0641.nc&#39; to &#39;/github/home/.cache/pyart-datasets&#39;.
</pre></div>
</div>
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;pyart.core.radar.Radar at 0x7f1a5aa0d760&gt;
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="investigate-the-pyart-radar-object">
Expand All @@ -598,6 +605,11 @@ <h3>Investigate the <a class="reference external" href="https://meteoswiss.githu
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>dict_keys([&#39;corrected_reflectivity_horizontal&#39;, &#39;reflectivity_horizontal&#39;, &#39;recalculated_diff_phase&#39;, &#39;specific_attenuation&#39;, &#39;unf_dp_phase_shift&#39;, &#39;mean_doppler_velocity&#39;, &#39;diff_phase&#39;, &#39;rain_rate_A&#39;, &#39;norm_coherent_power&#39;, &#39;dp_phase_shift&#39;, &#39;diff_reflectivity&#39;, &#39;proc_dp_phase_shift&#39;, &#39;copol_coeff&#39;])
</pre></div>
</div>
</div>
</div>
<div class="section" id="extract-a-sample-data-field">
<h4>Extract a sample data field<a class="headerlink" href="#extract-a-sample-data-field" title="Permalink to this heading"></a></h4>
Expand All @@ -612,6 +624,28 @@ <h4>Extract a sample data field<a class="headerlink" href="#extract-a-sample-dat
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>{&#39;_FillValue&#39;: -9999.0, &#39;least_significant_digit&#39;: 2, &#39;units&#39;: &#39;dBZ&#39;, &#39;long_name&#39;: &#39;equivalent_reflectivity_factor&#39;, &#39;valid_min&#39;: -45.0, &#39;valid_max&#39;: 80.0, &#39;standard_name&#39;: &#39;equivalent_reflectivity_factor&#39;, &#39;data&#39;: masked_array(
data=[[-5.671875, 2.28125, -8.1171875, ..., --, -13.4765625, --],
[-5.6171875, 1.8984375, -10.0703125, ..., -2.6796875, -1.5390625,
--],
[-5.0390625, 2.625, -11.484375, ..., -8.984375, --, --],
...,
[-5.9375, 1.46875, -12.3203125, ..., --, --, --],
[-5.9609375, 1.53125, -12.84375, ..., --, --, --],
[-8.7890625, 2.9140625, -12.09375, ..., --, --, --]],
mask=[[False, False, False, ..., True, False, True],
[False, False, False, ..., False, False, True],
[False, False, False, ..., False, True, True],
...,
[False, False, False, ..., True, True, True],
[False, False, False, ..., True, True, True],
[False, False, False, ..., True, True, True]],
fill_value=-9999.0,
dtype=float32)}
</pre></div>
</div>
</div>
</div>
<p>We can go even further in the dictionary and access the actual reflectivity data.</p>
<p>We use add <code class="docutils literal notranslate"><span class="pre">'data'</span></code> at the end, which will extract the <strong>data array</strong> (which is a masked numpy array) from the dictionary.</p>
Expand All @@ -622,6 +656,17 @@ <h4>Extract a sample data field<a class="headerlink" href="#extract-a-sample-dat
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;class &#39;numpy.ma.core.MaskedArray&#39;&gt; [[-5.671875 2.28125 -8.1171875 ... -- -13.4765625 --]
[-5.6171875 1.8984375 -10.0703125 ... -2.6796875 -1.5390625 --]
[-5.0390625 2.625 -11.484375 ... -8.984375 -- --]
...
[-5.9375 1.46875 -12.3203125 ... -- -- --]
[-5.9609375 1.53125 -12.84375 ... -- -- --]
[-8.7890625 2.9140625 -12.09375 ... -- -- --]]
</pre></div>
</div>
</div>
</div>
<p>Lets’ check the size of this array…</p>
<div class="cell docutils container">
Expand All @@ -630,6 +675,11 @@ <h4>Extract a sample data field<a class="headerlink" href="#extract-a-sample-dat
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>(8800, 667)
</pre></div>
</div>
</div>
</div>
<p>This reflectivity data array, numpy array, is a two-dimensional array with dimensions:</p>
<ul class="simple">
Expand All @@ -642,6 +692,11 @@ <h4>Extract a sample data field<a class="headerlink" href="#extract-a-sample-dat
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>8800 667
</pre></div>
</div>
</div>
</div>
<p>If we wanted to look the 300th ray, at the second gate, we would use something like the following:</p>
<div class="cell docutils container">
Expand All @@ -650,6 +705,11 @@ <h4>Extract a sample data field<a class="headerlink" href="#extract-a-sample-dat
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-4.8046875
</pre></div>
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -680,6 +740,11 @@ <h3>Use the <a class="reference external" href="https://arm-doe.github.io/pyart/
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;Figure size 1000x1000 with 0 Axes&gt;
</pre></div>
</div>
</div>
</div>
<p>Once we have a figure, let’s add our <code class="docutils literal notranslate"><span class="pre">RadarMapDisplay</span></code></p>
<div class="cell docutils container">
Expand All @@ -689,6 +754,11 @@ <h3>Use the <a class="reference external" href="https://arm-doe.github.io/pyart/
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;Figure size 1000x1000 with 0 Axes&gt;
</pre></div>
</div>
</div>
</div>
<p>Adding our map display without specifying a field to plot <strong>won’t do anything</strong> we need to specifically add a field to field using <code class="docutils literal notranslate"><span class="pre">.plot_ppi_map()</span></code></p>
<div class="cell docutils container">
Expand All @@ -697,6 +767,9 @@ <h3>Use the <a class="reference external" href="https://arm-doe.github.io/pyart/
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<img alt="../../_images/6cbed2a81aa33241e4cd71cf7207d05055ff740fd0dd442b1e6dea4b9fa73d61.png" src="../../_images/6cbed2a81aa33241e4cd71cf7207d05055ff740fd0dd442b1e6dea4b9fa73d61.png" />
</div>
</div>
<p>By default, it will plot the elevation scan, the the default colormap from <code class="docutils literal notranslate"><span class="pre">Matplotlib</span></code>… let’s customize!</p>
<p>We add the following arguements:</p>
Expand All @@ -721,6 +794,9 @@ <h3>Use the <a class="reference external" href="https://arm-doe.github.io/pyart/
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<img alt="../../_images/40b22aec8930106cd1fa8dbb48f894357dc743ad81efffe1ec601ac99f6cec45.png" src="../../_images/40b22aec8930106cd1fa8dbb48f894357dc743ad81efffe1ec601ac99f6cec45.png" />
</div>
</div>
<p>You can change many parameters in the graph by changing the arguments to plot_ppi_map. As you can recall from earlier. simply view these arguments in a Jupyter notebook by typing:</p>
<div class="cell docutils container">
Expand All @@ -745,6 +821,9 @@ <h3>Use the <a class="reference external" href="https://arm-doe.github.io/pyart/
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<img alt="../../_images/fbec13beeeb29e0178c0f49b7b6928cdd593647505ca89a1419f924f0c80a9ac.png" src="../../_images/fbec13beeeb29e0178c0f49b7b6928cdd593647505ca89a1419f924f0c80a9ac.png" />
</div>
</div>
<p>Or, let’s view a different elevation scan! To do this, change the sweep parameter in the plot_ppi_map function.</p>
<div class="cell docutils container">
Expand All @@ -761,6 +840,9 @@ <h3>Use the <a class="reference external" href="https://arm-doe.github.io/pyart/
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<img alt="../../_images/8ddab8ae31ddd6fa814a2602d6b88816e0d85c7e318605f36abd2fe165e4d2d6.png" src="../../_images/8ddab8ae31ddd6fa814a2602d6b88816e0d85c7e318605f36abd2fe165e4d2d6.png" />
</div>
</div>
<p>Let’s take a look at a different field - for example, correlation coefficient (<code class="docutils literal notranslate"><span class="pre">corr_coeff</span></code>)</p>
<div class="cell docutils container">
Expand All @@ -777,6 +859,9 @@ <h3>Use the <a class="reference external" href="https://arm-doe.github.io/pyart/
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<img alt="../../_images/5880a7ec905b8a2d404b4e9f103a5253771e1d402227df72690eb111e9178aeb.png" src="../../_images/5880a7ec905b8a2d404b4e9f103a5253771e1d402227df72690eb111e9178aeb.png" />
</div>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 28c3965

Please sign in to comment.