Skip to content

Commit

Permalink
[skip ci] Update latest
Browse files Browse the repository at this point in the history
  • Loading branch information
Azure Pipelines committed Apr 12, 2024
1 parent 2c0072a commit 72b4d2b
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 18 deletions.
27 changes: 22 additions & 5 deletions latest/_modules/mpas_analysis/sea_ice/time_series.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ <h1>Source code for mpas_analysis.sea_ice.time_series</h1><div class="highlight"
<span class="c1"># distributed with this code, or at</span>
<span class="c1"># https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/main/LICENSE</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="k">as</span> <span class="nn">xr</span>

<span class="kn">from</span> <span class="nn">mpas_analysis.shared</span> <span class="kn">import</span> <span class="n">AnalysisTask</span>
Expand Down Expand Up @@ -694,6 +695,14 @@ <h1>Source code for mpas_analysis.sea_ice.time_series</h1><div class="highlight"
<span class="n">config</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">config</span>
<span class="n">chunkYears</span> <span class="o">=</span> <span class="n">config</span><span class="o">.</span><span class="n">getint</span><span class="p">(</span><span class="s1">&#39;timeSeriesSeaIceAreaVol&#39;</span><span class="p">,</span> <span class="s1">&#39;chunkYears&#39;</span><span class="p">)</span>

<span class="n">maxAllowedSeaIceThickness</span> <span class="o">=</span> <span class="n">config</span><span class="o">.</span><span class="n">get</span><span class="p">(</span>
<span class="s1">&#39;timeSeriesSeaIceAreaVol&#39;</span><span class="p">,</span> <span class="s1">&#39;maxAllowedSeaIceThickness&#39;</span><span class="p">)</span>

<span class="k">if</span> <span class="n">maxAllowedSeaIceThickness</span> <span class="o">==</span> <span class="s1">&#39;None&#39;</span><span class="p">:</span>
<span class="n">maxAllowedSeaIceThickness</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">maxAllowedSeaIceThickness</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">maxAllowedSeaIceThickness</span><span class="p">)</span>

<span class="n">outFileNames</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">hemisphere</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;NH&#39;</span><span class="p">,</span> <span class="s1">&#39;SH&#39;</span><span class="p">]:</span>
<span class="n">baseDirectory</span> <span class="o">=</span> <span class="n">build_config_full_path</span><span class="p">(</span>
Expand All @@ -716,6 +725,10 @@ <h1>Source code for mpas_analysis.sea_ice.time_series</h1><div class="highlight"
<span class="n">startDate</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">startDate</span><span class="p">,</span>
<span class="n">endDate</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">endDate</span><span class="p">)</span>

<span class="n">ds</span> <span class="o">=</span> <span class="n">ds</span><span class="o">.</span><span class="n">rename</span><span class="p">(</span>
<span class="p">{</span><span class="s1">&#39;timeMonthly_avg_iceAreaCell&#39;</span><span class="p">:</span> <span class="s1">&#39;iceConc&#39;</span><span class="p">,</span>
<span class="s1">&#39;timeMonthly_avg_iceVolumeCell&#39;</span><span class="p">:</span> <span class="s1">&#39;iceThick&#39;</span><span class="p">})</span>

<span class="n">nTime</span> <span class="o">=</span> <span class="n">ds</span><span class="o">.</span><span class="n">sizes</span><span class="p">[</span><span class="s1">&#39;Time&#39;</span><span class="p">]</span>
<span class="c1"># chunk into 10-year seguments so we don&#39;t run out of memory</span>
<span class="k">if</span> <span class="n">nTime</span> <span class="o">&gt;</span> <span class="mi">12</span> <span class="o">*</span> <span class="n">chunkYears</span><span class="p">:</span>
Expand All @@ -728,22 +741,26 @@ <h1>Source code for mpas_analysis.sea_ice.time_series</h1><div class="highlight"
<span class="k">else</span><span class="p">:</span>
<span class="n">mask</span> <span class="o">=</span> <span class="n">dsMesh</span><span class="o">.</span><span class="n">latCell</span> <span class="o">&lt;</span> <span class="mi">0</span>

<span class="k">if</span> <span class="n">maxAllowedSeaIceThickness</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">mask</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">logical_and</span><span class="p">(</span><span class="n">mask</span><span class="p">,</span>
<span class="n">ds</span><span class="o">.</span><span class="n">iceThick</span> <span class="o">&lt;=</span> <span class="n">maxAllowedSeaIceThickness</span><span class="p">)</span>

<span class="n">dsAreaSum</span> <span class="o">=</span> <span class="p">(</span><span class="n">ds</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">mask</span><span class="p">)</span> <span class="o">*</span> <span class="n">dsMesh</span><span class="o">.</span><span class="n">areaCell</span><span class="p">)</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="s1">&#39;nCells&#39;</span><span class="p">)</span>
<span class="n">dsAreaSum</span> <span class="o">=</span> <span class="n">dsAreaSum</span><span class="o">.</span><span class="n">rename</span><span class="p">(</span>
<span class="p">{</span><span class="s1">&#39;timeMonthly_avg_iceAreaCell&#39;</span><span class="p">:</span> <span class="s1">&#39;iceArea&#39;</span><span class="p">,</span>
<span class="s1">&#39;timeMonthly_avg_iceVolumeCell&#39;</span><span class="p">:</span> <span class="s1">&#39;iceVolume&#39;</span><span class="p">})</span>
<span class="p">{</span><span class="s1">&#39;iceConc&#39;</span><span class="p">:</span> <span class="s1">&#39;iceArea&#39;</span><span class="p">,</span>
<span class="s1">&#39;iceThick&#39;</span><span class="p">:</span> <span class="s1">&#39;iceVolume&#39;</span><span class="p">})</span>
<span class="n">dsAreaSum</span><span class="p">[</span><span class="s1">&#39;iceThickness&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">dsAreaSum</span><span class="o">.</span><span class="n">iceVolume</span> <span class="o">/</span>
<span class="n">dsMesh</span><span class="o">.</span><span class="n">areaCell</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="s1">&#39;nCells&#39;</span><span class="p">))</span>

<span class="n">dsAreaSum</span><span class="p">[</span><span class="s1">&#39;iceArea&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">attrs</span><span class="p">[</span><span class="s1">&#39;units&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;m$^2$&#39;</span>
<span class="n">dsAreaSum</span><span class="p">[</span><span class="s1">&#39;iceArea&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">attrs</span><span class="p">[</span><span class="s1">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> \
<span class="s1">&#39;Total </span><span class="si">{}</span><span class="s1"> sea ice area&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">hemisphere</span><span class="p">)</span>
<span class="sa">f</span><span class="s1">&#39;Total </span><span class="si">{</span><span class="n">hemisphere</span><span class="si">}</span><span class="s1"> sea ice area&#39;</span>
<span class="n">dsAreaSum</span><span class="p">[</span><span class="s1">&#39;iceVolume&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">attrs</span><span class="p">[</span><span class="s1">&#39;units&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;m$^3$&#39;</span>
<span class="n">dsAreaSum</span><span class="p">[</span><span class="s1">&#39;iceVolume&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">attrs</span><span class="p">[</span><span class="s1">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> \
<span class="s1">&#39;Total </span><span class="si">{}</span><span class="s1"> sea ice volume&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">hemisphere</span><span class="p">)</span>
<span class="sa">f</span><span class="s1">&#39;Total </span><span class="si">{</span><span class="n">hemisphere</span><span class="si">}</span><span class="s1"> sea ice volume&#39;</span>
<span class="n">dsAreaSum</span><span class="p">[</span><span class="s1">&#39;iceThickness&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">attrs</span><span class="p">[</span><span class="s1">&#39;units&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;m&#39;</span>
<span class="n">dsAreaSum</span><span class="p">[</span><span class="s1">&#39;iceThickness&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">attrs</span><span class="p">[</span><span class="s1">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> \
<span class="s1">&#39;Mean </span><span class="si">{}</span><span class="s1"> sea ice volume&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">hemisphere</span><span class="p">)</span>
<span class="sa">f</span><span class="s1">&#39;Mean </span><span class="si">{</span><span class="n">hemisphere</span><span class="si">}</span><span class="s1"> sea ice volume&#39;</span>

<span class="n">dsTimeSeries</span><span class="p">[</span><span class="n">hemisphere</span><span class="p">]</span> <span class="o">=</span> <span class="n">dsAreaSum</span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ <h1>mpas_analysis.shared.climatology.RemapMpasClimatologySubtask.customize_maske
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>climatology</strong> (<a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html#xarray.Dataset" title="(in xarray v2024.2.1.dev0)"><em>xarray.Dataset</em></a>) – The MPAS climatology data set that has had a mask added but has
<li><p><strong>climatology</strong> (<a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html#xarray.Dataset" title="(in xarray v2024.3.1.dev0)"><em>xarray.Dataset</em></a>) – The MPAS climatology data set that has had a mask added but has
not yet been remapped</p></li>
<li><p><strong>season</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><em>str</em></a>) – The name of the season to be masked</p></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ <h1>mpas_analysis.shared.climatology.RemapMpasClimatologySubtask.customize_remap
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>climatology</strong> (<a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html#xarray.Dataset" title="(in xarray v2024.2.1.dev0)"><em>xarray.Dataset</em></a>) – The MPAS climatology data set that has been remapped</p></li>
<li><p><strong>climatology</strong> (<a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html#xarray.Dataset" title="(in xarray v2024.3.1.dev0)"><em>xarray.Dataset</em></a>) – The MPAS climatology data set that has been remapped</p></li>
<li><p><strong>comparisonGridNames</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><em>str</em></a>) – The name of the comparison grid to use for remapping.</p></li>
<li><p><strong>season</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><em>str</em></a>) – The name of the season to be remapped</p></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ <h1>mpas_analysis.shared.climatology.compute_climatology<a class="headerlink" hr
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ds</strong> (<a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html#xarray.Dataset" title="(in xarray v2024.2.1.dev0)"><em>xarray.Dataset</em></a><em> or </em><a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.DataArray.html#xarray.DataArray" title="(in xarray v2024.2.1.dev0)"><em>xarray.DataArray</em></a>) – A data set with a <code class="docutils literal notranslate"><span class="pre">Time</span></code> coordinate expressed as days since
<li><p><strong>ds</strong> (<a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html#xarray.Dataset" title="(in xarray v2024.3.1.dev0)"><em>xarray.Dataset</em></a><em> or </em><a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.DataArray.html#xarray.DataArray" title="(in xarray v2024.3.1.dev0)"><em>xarray.DataArray</em></a>) – A data set with a <code class="docutils literal notranslate"><span class="pre">Time</span></code> coordinate expressed as days since
0001-01-01 or <code class="docutils literal notranslate"><span class="pre">month</span></code> coordinate</p></li>
<li><p><strong>monthValues</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><em>int</em></a><em> or </em><em>array-like</em><em> of </em><em>ints</em>) – A single month or an array of months to be averaged together</p></li>
<li><p><strong>calendar</strong> (<em>{'gregorian'</em><em>, </em><em>'noleap'}</em><em>, </em><em>optional</em>) – The name of one of the calendars supported by MPAS cores, used to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ <h1>mpas_analysis.shared.climatology.compute_monthly_climatology<a class="header
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ds</strong> (<a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html#xarray.Dataset" title="(in xarray v2024.2.1.dev0)"><em>xarray.Dataset</em></a><em> or </em><a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.DataArray.html#xarray.DataArray" title="(in xarray v2024.2.1.dev0)"><em>xarray.DataArray</em></a>) – A data set with a <code class="docutils literal notranslate"><span class="pre">Time</span></code> coordinate expressed as days since
<li><p><strong>ds</strong> (<a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html#xarray.Dataset" title="(in xarray v2024.3.1.dev0)"><em>xarray.Dataset</em></a><em> or </em><a class="reference external" href="https://docs.xarray.dev/en/stable/generated/xarray.DataArray.html#xarray.DataArray" title="(in xarray v2024.3.1.dev0)"><em>xarray.DataArray</em></a>) – A data set with a <code class="docutils literal notranslate"><span class="pre">Time</span></code> coordinate expressed as days since
0001-01-01 or <code class="docutils literal notranslate"><span class="pre">month</span></code> coordinate</p></li>
<li><p><strong>calendar</strong> (<em>{'gregorian'</em><em>, </em><em>'noleap'}</em><em>, </em><em>optional</em>) – The name of one of the calendars supported by MPAS cores, used to
determine <code class="docutils literal notranslate"><span class="pre">month</span></code> from <code class="docutils literal notranslate"><span class="pre">Time</span></code> coordinate, so must be supplied if
Expand Down
Loading

0 comments on commit 72b4d2b

Please sign in to comment.