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 Jul 18, 2024
1 parent 6819e94 commit 3830932
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions latest/_modules/compass/ocean/mesh/cull.html
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ <h1>Source code for compass.ocean.mesh.cull</h1><div class="highlight"><pre>

<span class="k">if</span> <span class="n">has_remapped_topo</span><span class="p">:</span>
<span class="n">_cull_topo</span><span class="p">(</span><span class="n">with_cavities</span><span class="p">,</span> <span class="n">process_count</span><span class="p">,</span> <span class="n">logger</span><span class="p">,</span> <span class="n">latitude_threshold</span><span class="p">,</span>
<span class="n">sweep_count</span><span class="p">)</span>
<span class="n">sweep_count</span><span class="p">,</span> <span class="n">dsPreserve</span><span class="p">)</span>

<span class="k">if</span> <span class="n">with_cavities</span><span class="p">:</span>
<span class="n">dsMask</span> <span class="o">=</span> <span class="n">xr</span><span class="o">.</span><span class="n">open_dataset</span><span class="p">(</span><span class="s1">&#39;topography_culled.nc&#39;</span><span class="p">)</span>
Expand Down Expand Up @@ -604,7 +604,7 @@ <h1>Source code for compass.ocean.mesh.cull</h1><div class="highlight"><pre>


<span class="k">def</span> <span class="nf">_cull_topo</span><span class="p">(</span><span class="n">with_cavities</span><span class="p">,</span> <span class="n">process_count</span><span class="p">,</span> <span class="n">logger</span><span class="p">,</span> <span class="n">latitude_threshold</span><span class="p">,</span>
<span class="n">sweep_count</span><span class="p">):</span>
<span class="n">sweep_count</span><span class="p">,</span> <span class="n">ds_preserve</span><span class="p">):</span>

<span class="n">ds_topo</span> <span class="o">=</span> <span class="n">xr</span><span class="o">.</span><span class="n">open_dataset</span><span class="p">(</span><span class="s1">&#39;topography.nc&#39;</span><span class="p">)</span>
<span class="n">ds_base</span> <span class="o">=</span> <span class="n">xr</span><span class="o">.</span><span class="n">open_dataset</span><span class="p">(</span><span class="s1">&#39;base_mesh.nc&#39;</span><span class="p">)</span>
Expand All @@ -617,8 +617,9 @@ <h1>Source code for compass.ocean.mesh.cull</h1><div class="highlight"><pre>

<span class="k">if</span> <span class="n">with_cavities</span><span class="p">:</span>
<span class="n">_add_land_ice_mask_and_mask_draft</span><span class="p">(</span><span class="n">ds_topo</span><span class="p">,</span> <span class="n">ds_base</span><span class="p">,</span>
<span class="n">ds_map_culled_to_base</span><span class="p">,</span> <span class="n">logger</span><span class="p">,</span>
<span class="n">latitude_threshold</span><span class="p">,</span> <span class="n">sweep_count</span><span class="p">)</span>
<span class="n">ds_map_culled_to_base</span><span class="p">,</span> <span class="n">ds_preserve</span><span class="p">,</span>
<span class="n">logger</span><span class="p">,</span> <span class="n">latitude_threshold</span><span class="p">,</span>
<span class="n">sweep_count</span><span class="p">)</span>
<span class="n">write_netcdf</span><span class="p">(</span><span class="n">ds_topo</span><span class="p">,</span> <span class="s1">&#39;topography_with_land_ice_mask.nc&#39;</span><span class="p">)</span>

<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s1">&#39;Culling topography&#39;</span><span class="p">)</span>
Expand Down Expand Up @@ -653,9 +654,18 @@ <h1>Source code for compass.ocean.mesh.cull</h1><div class="highlight"><pre>


<span class="k">def</span> <span class="nf">_add_land_ice_mask_and_mask_draft</span><span class="p">(</span><span class="n">ds_topo</span><span class="p">,</span> <span class="n">ds_base_mesh</span><span class="p">,</span>
<span class="n">ds_map_culled_to_base</span><span class="p">,</span> <span class="n">logger</span><span class="p">,</span>
<span class="n">latitude_threshold</span><span class="p">,</span> <span class="n">sweep_count</span><span class="p">):</span>
<span class="n">ds_map_culled_to_base</span><span class="p">,</span> <span class="n">ds_perserve</span><span class="p">,</span>
<span class="n">logger</span><span class="p">,</span> <span class="n">latitude_threshold</span><span class="p">,</span> <span class="n">sweep_count</span><span class="p">):</span>

<span class="n">land_ice_frac</span> <span class="o">=</span> <span class="n">ds_topo</span><span class="o">.</span><span class="n">landIceFracObserved</span>
<span class="c1"># we don&#39;t what land ice where we are preserving critical passages</span>
<span class="k">for</span> <span class="n">ds</span> <span class="ow">in</span> <span class="n">ds_perserve</span><span class="p">:</span>
<span class="n">not_preserve</span> <span class="o">=</span> <span class="n">ds</span><span class="o">.</span><span class="n">transectCellMasks</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">dim</span><span class="o">=</span><span class="s1">&#39;nTransects&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span>
<span class="n">land_ice_frac</span> <span class="o">=</span> <span class="n">land_ice_frac</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">not_preserve</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">)</span>

<span class="n">land_ice_frac</span><span class="o">.</span><span class="n">to_netcdf</span><span class="p">(</span><span class="s1">&#39;land_ice_frac_without_critical_passages.nc&#39;</span><span class="p">)</span>

<span class="n">ds_topo</span><span class="p">[</span><span class="s1">&#39;landIceFracObserved&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">land_ice_frac</span>

<span class="c1"># we want the mask to be 1 where there&#39;s at least half land-ice</span>
<span class="n">land_ice_mask</span> <span class="o">=</span> <span class="n">xr</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">land_ice_frac</span> <span class="o">&gt;</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
Expand Down

0 comments on commit 3830932

Please sign in to comment.