Skip to content

Commit

Permalink
deploy: 12d848c
Browse files Browse the repository at this point in the history
  • Loading branch information
ecomodeller committed Mar 5, 2024
1 parent f20c1ad commit 045376e
Show file tree
Hide file tree
Showing 22 changed files with 234 additions and 258 deletions.
58 changes: 29 additions & 29 deletions examples/Dfsu-2D-interpolation.html

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions examples/Generic.html

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions examples/Time-interpolation.html
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,11 @@ <h1 class="title d-none d-lg-block">Time interpolation</h1>
</header>


<div id="692c9d36" class="cell" data-execution_count="1">
<div id="be56a075" class="cell" data-execution_count="1">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> numpy <span class="im">as</span> np</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> mikeio</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div id="d922032c" class="cell" data-execution_count="2">
<div id="195ed1b4" class="cell" data-execution_count="2">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>ds <span class="op">=</span> mikeio.read(<span class="st">"../data/waves.dfs2"</span>)</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>ds</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="2">
Expand All @@ -397,7 +397,7 @@ <h1 class="title d-none d-lg-block">Time interpolation</h1>
<section id="interpolate-to-specific-timestep" class="level2">
<h2 class="anchored" data-anchor-id="interpolate-to-specific-timestep">Interpolate to specific timestep</h2>
<p>A common use case is to interpolate to a shorter timestep, in this case 1h.</p>
<div id="b920d565" class="cell" data-execution_count="3">
<div id="993ac057" class="cell" data-execution_count="3">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>ds_h <span class="op">=</span> ds.interp_time(<span class="dv">3600</span>)</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>ds_h</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="3">
Expand All @@ -412,14 +412,14 @@ <h2 class="anchored" data-anchor-id="interpolate-to-specific-timestep">Interpola
</div>
</div>
<p>And to store the interpolated data in a new file.</p>
<div id="05b8b1b0" class="cell" data-execution_count="4">
<div id="ebd3f5bd" class="cell" data-execution_count="4">
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>ds_h.to_dfs(<span class="st">"waves_3h.dfs2"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="interpolate-to-time-axis-of-another-dataset" class="level2">
<h2 class="anchored" data-anchor-id="interpolate-to-time-axis-of-another-dataset">Interpolate to time axis of another dataset</h2>
<p>Read some non-equidistant data typically found in observed data.</p>
<div id="f792f03c" class="cell" data-execution_count="5">
<div id="9d4a033a" class="cell" data-execution_count="5">
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>ts <span class="op">=</span> mikeio.read(<span class="st">"../data/waves.dfs0"</span>)</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a>ts</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="5">
Expand All @@ -434,10 +434,10 @@ <h2 class="anchored" data-anchor-id="interpolate-to-time-axis-of-another-dataset
</div>
</div>
<p>The observed timeseries is longer than the modelled data. Default is to fill values with NaN.</p>
<div id="40e41ca5" class="cell" data-execution_count="6">
<div id="66a3aa98" class="cell" data-execution_count="6">
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>dsi <span class="op">=</span> ds.interp_time(ts)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div id="57a0cf56" class="cell" data-execution_count="7">
<div id="13673336" class="cell" data-execution_count="7">
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>dsi.time</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="7">
<pre><code>DatetimeIndex(['2004-01-01 01:00:00', '2004-01-01 02:00:00',
Expand All @@ -455,13 +455,13 @@ <h2 class="anchored" data-anchor-id="interpolate-to-time-axis-of-another-dataset
dtype='datetime64[ns]', freq=None)</code></pre>
</div>
</div>
<div id="f2ef6948" class="cell" data-execution_count="8">
<div id="04b396f0" class="cell" data-execution_count="8">
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>dsi[<span class="st">"Sign. Wave Height"</span>].shape</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="8">
<pre><code>(24, 31, 31)</code></pre>
</div>
</div>
<div id="f8a9d6d3" class="cell" data-execution_count="9">
<div id="a87f2b18" class="cell" data-execution_count="9">
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>ax <span class="op">=</span> dsi[<span class="st">"Sign. Wave Height"</span>].sel(x<span class="op">=</span><span class="dv">250</span>, y<span class="op">=</span><span class="dv">1200</span>).plot(marker<span class="op">=</span><span class="st">'+'</span>)</span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a>ts[<span class="st">"Sign. Wave Height"</span>].plot(ax<span class="op">=</span>ax,marker<span class="op">=</span><span class="st">'+'</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display">
Expand All @@ -479,7 +479,7 @@ <h2 class="anchored" data-anchor-id="model-validation">Model validation</h2>
<p>In the example below we calculate this metric using the model data interpolated to the observed times.</p>
<p>For a more elaborate model validation library which takes care of these things for you as well as calculating a number of relevant metrics, take a look at <a href="https://dhi.github.io/modelskill">`ModelSkill</a>.</p>
<p>Use <code>np.nanmean</code> to skip NaN.</p>
<div id="baa12a11" class="cell" data-execution_count="10">
<div id="e9970156" class="cell" data-execution_count="10">
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>ts[<span class="st">"Sign. Wave Height"</span>]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="10">
<pre><code>&lt;mikeio.DataArray&gt;
Expand All @@ -490,7 +490,7 @@ <h2 class="anchored" data-anchor-id="model-validation">Model validation</h2>
values: [0.06521, 0.06771, ..., 0.0576]</code></pre>
</div>
</div>
<div id="be951d06" class="cell" data-execution_count="11">
<div id="2cbff566" class="cell" data-execution_count="11">
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>dsi[<span class="st">"Sign. Wave Height"</span>].sel(x<span class="op">=</span><span class="dv">250</span>, y<span class="op">=</span><span class="dv">1200</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="11">
<pre><code>&lt;mikeio.DataArray&gt;
Expand All @@ -501,7 +501,7 @@ <h2 class="anchored" data-anchor-id="model-validation">Model validation</h2>
values: [0.0387, 0.03939, ..., nan]</code></pre>
</div>
</div>
<div id="f57a53db" class="cell" data-execution_count="12">
<div id="47b10965" class="cell" data-execution_count="12">
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a>diff <span class="op">=</span> (ts[<span class="st">"Sign. Wave Height"</span>] <span class="op">-</span> dsi[<span class="st">"Sign. Wave Height"</span>].sel(x<span class="op">=</span><span class="dv">250</span>, y<span class="op">=</span><span class="dv">1200</span>))</span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a>diff.plot()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display">
Expand All @@ -512,7 +512,7 @@ <h2 class="anchored" data-anchor-id="model-validation">Model validation</h2>
</div>
</div>
</div>
<div id="d63c0006" class="cell" data-execution_count="13">
<div id="d2775b0d" class="cell" data-execution_count="13">
<div class="sourceCode cell-code" id="cb20"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>mae <span class="op">=</span> np.<span class="bu">abs</span>(diff).nanmean().to_numpy()</span>
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a>mae</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="13">
Expand All @@ -522,7 +522,7 @@ <h2 class="anchored" data-anchor-id="model-validation">Model validation</h2>
</section>
<section id="clean-up" class="level1">
<h1>Clean up</h1>
<div id="2205b310" class="cell" data-execution_count="14">
<div id="153adeee" class="cell" data-execution_count="14">
<div class="sourceCode cell-code" id="cb22"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> os</span>
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a>os.remove(<span class="st">"waves_3h.dfs2"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
Expand Down
Loading

0 comments on commit 045376e

Please sign in to comment.