Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed May 13, 2024
1 parent d0c52f7 commit 3407219
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions latest/_modules/compass/ocean/plot.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@
<div itemprop="articleBody">

<h1>Source code for compass.ocean.plot</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">xarray</span>
<span class="kn">import</span> <span class="nn">xarray.plot</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">datetime</span>
<span></span><span class="kn">import</span> <span class="nn">datetime</span>

<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">xarray</span>
<span class="kn">import</span> <span class="nn">xarray.plot</span>
<span class="kn">from</span> <span class="nn">matplotlib.font_manager</span> <span class="kn">import</span> <span class="n">FontProperties</span>


Expand Down Expand Up @@ -224,6 +225,24 @@ <h1>Source code for compass.ocean.plot</h1><div class="highlight"><pre>
<span class="n">txt</span> <span class="o">=</span> <span class="s1">&#39;</span><span class="si">{}{:9.2e}</span><span class="s1"> </span><span class="si">{:9.2e}</span><span class="s1"> </span><span class="si">{}</span><span class="se">\n</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">txt</span><span class="p">,</span> <span class="n">var</span><span class="o">.</span><span class="n">min</span><span class="p">()</span><span class="o">.</span><span class="n">values</span><span class="p">,</span>
<span class="n">var</span><span class="o">.</span><span class="n">max</span><span class="p">()</span><span class="o">.</span><span class="n">values</span><span class="p">,</span> <span class="n">varName</span><span class="p">)</span>

<span class="n">plt</span><span class="o">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>
<span class="n">varName</span> <span class="o">=</span> <span class="s1">&#39;areaCell&#39;</span>
<span class="n">var</span> <span class="o">=</span> <span class="n">ds</span><span class="p">[</span><span class="n">varName</span><span class="p">]</span>
<span class="n">xarray</span><span class="o">.</span><span class="n">plot</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span><span class="mf">1e-6</span> <span class="o">*</span> <span class="n">var</span><span class="p">,</span> <span class="n">bins</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">log</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;frequency&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;cell area (km$^2$)&#39;</span><span class="p">)</span>
<span class="n">txt</span> <span class="o">=</span> <span class="s1">&#39;</span><span class="si">{}{:9.2e}</span><span class="s1"> </span><span class="si">{:9.2e}</span><span class="s1"> </span><span class="si">{}</span><span class="se">\n</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">txt</span><span class="p">,</span> <span class="n">var</span><span class="o">.</span><span class="n">min</span><span class="p">()</span><span class="o">.</span><span class="n">values</span><span class="p">,</span>
<span class="n">var</span><span class="o">.</span><span class="n">max</span><span class="p">()</span><span class="o">.</span><span class="n">values</span><span class="p">,</span> <span class="n">varName</span><span class="p">)</span>

<span class="n">plt</span><span class="o">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">9</span><span class="p">)</span>
<span class="n">varName</span> <span class="o">=</span> <span class="s1">&#39;dcEdge&#39;</span>
<span class="n">var</span> <span class="o">=</span> <span class="n">ds</span><span class="p">[</span><span class="n">varName</span><span class="p">]</span>
<span class="n">xarray</span><span class="o">.</span><span class="n">plot</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span><span class="mf">1e-3</span> <span class="o">*</span> <span class="n">var</span><span class="p">,</span> <span class="n">bins</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">log</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;frequency&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;dcEdge: cell-to-cell great-circle distance (km)&#39;</span><span class="p">)</span>
<span class="n">txt</span> <span class="o">=</span> <span class="s1">&#39;</span><span class="si">{}{:9.2e}</span><span class="s1"> </span><span class="si">{:9.2e}</span><span class="s1"> </span><span class="si">{}</span><span class="se">\n</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">txt</span><span class="p">,</span> <span class="n">var</span><span class="o">.</span><span class="n">min</span><span class="p">()</span><span class="o">.</span><span class="n">values</span><span class="p">,</span>
<span class="n">var</span><span class="o">.</span><span class="n">max</span><span class="p">()</span><span class="o">.</span><span class="n">values</span><span class="p">,</span> <span class="n">varName</span><span class="p">)</span>

<span class="n">font</span> <span class="o">=</span> <span class="n">FontProperties</span><span class="p">()</span>
<span class="n">font</span><span class="o">.</span><span class="n">set_family</span><span class="p">(</span><span class="s1">&#39;monospace&#39;</span><span class="p">)</span>
<span class="n">font</span><span class="o">.</span><span class="n">set_size</span><span class="p">(</span><span class="mi">12</span><span class="p">)</span>
Expand Down

0 comments on commit 3407219

Please sign in to comment.