GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — update docs index and ref. api · PRMS-Python/PRMS-Python@5498d4c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • docs
    • build
      • doctrees
        • api.doctree
        • cli.doctree
        • environment.pickle
        • index.doctree
        • tutorial.doctree
      • html
        • _modules
          • index.html
          • prms_python
            • data.html
            • optimizer.html
            • parameters.html
            • scenario.html
            • util.html
        • _sources
          • api.rst.txt
          • cli.rst.txt
          • index.rst.txt
        • _static
          • alabaster.css
        • api.html
        • cli.html
        • genindex.html
        • index.html
        • objects.inv
        • search.html
        • searchindex.js
        • tutorial.html
    • source
      • api.rst
      • cli.rst
      • index.rst
  • prms_python
    • data.py
    • parameters.py
    • util.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docs/build/doctrees/api.doctree‎

Copy file name to clipboard
52 KB
Binary file not shown.
Collapse file

‎docs/build/doctrees/cli.doctree‎

Copy file name to clipboard
295 Bytes
Binary file not shown.
Collapse file

‎docs/build/doctrees/environment.pickle‎

Copy file name to clipboard
3.83 KB
Binary file not shown.
Collapse file

‎docs/build/doctrees/index.doctree‎

Copy file name to clipboard
2.19 KB
Binary file not shown.
Collapse file

‎docs/build/doctrees/tutorial.doctree‎

Copy file name to clipboard
-149 Bytes
Binary file not shown.
Collapse file

‎docs/build/html/_modules/index.html‎

Copy file name to clipboardExpand all lines: docs/build/html/_modules/index.html
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<div class="document">
2626
<div class="documentwrapper">
2727
<div class="bodywrapper">
28+
29+
2830
<div class="body" role="main">
2931

3032
<h1>All modules for which code is available</h1>
@@ -36,6 +38,7 @@ <h1>All modules for which code is available</h1>
3638
</ul>
3739

3840
</div>
41+
3942
</div>
4043
</div>
4144
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
@@ -97,8 +100,8 @@ <h3>Quick search</h3>
97100
&copy;2016, John Volk and Matthew Turner.
98101

99102
|
100-
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.5</a>
101-
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
103+
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.6</a>
104+
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.11</a>
102105

103106
</div>
104107

Collapse file

‎docs/build/html/_modules/prms_python/data.html‎

Copy file name to clipboardExpand all lines: docs/build/html/_modules/prms_python/data.html
+74-36Lines changed: 74 additions & 36 deletions
Large diffs are not rendered by default.
Collapse file

‎docs/build/html/_modules/prms_python/optimizer.html‎

Copy file name to clipboardExpand all lines: docs/build/html/_modules/prms_python/optimizer.html
+11-8Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<div class="document">
2626
<div class="documentwrapper">
2727
<div class="bodywrapper">
28+
29+
2830
<div class="body" role="main">
2931

3032
<h1>Source code for prms_python.optimizer</h1><div class="highlight"><pre>
@@ -126,7 +128,7 @@ <h1>Source code for prms_python.optimizer</h1><div class="highlight"><pre>
126128
<span class="bp">self</span><span class="o">.</span><span class="n">statvar_name</span> <span class="o">=</span> <span class="kc">None</span>
127129
<span class="bp">self</span><span class="o">.</span><span class="n">arb_outputs</span> <span class="o">=</span> <span class="p">[]</span>
128130

129-
<span class="k">def</span> <span class="nf">monte_carlo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">reference_path</span><span class="p">,</span> <span class="n">param_names</span><span class="p">,</span> <span class="n">statvar_name</span><span class="p">,</span> \
131+
<div class="viewcode-block" id="Optimizer.monte_carlo"><a class="viewcode-back" href="../../api.html#prms_python.Optimizer.monte_carlo">[docs]</a> <span class="k">def</span> <span class="nf">monte_carlo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">reference_path</span><span class="p">,</span> <span class="n">param_names</span><span class="p">,</span> <span class="n">statvar_name</span><span class="p">,</span> \
130132
<span class="n">stage</span><span class="p">,</span> <span class="n">n_sims</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;uniform&#39;</span><span class="p">,</span> <span class="n">mu_factor</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>\
131133
<span class="n">noise_factor</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">nproc</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
132134
<span class="sd">&#39;&#39;&#39;</span>
@@ -225,9 +227,9 @@ <h1>Source code for prms_python.optimizer</h1><div class="highlight"><pre>
225227
<span class="n">ensure_ascii</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
226228

227229
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;</span><span class="si">{0}</span><span class="se">\n</span><span class="s1">Output information sent to </span><span class="si">{1}</span><span class="se">\n</span><span class="s1">&#39;</span><span class="o">.</span>\
228-
<span class="nb">format</span><span class="p">(</span><span class="s1">&#39;-&#39;</span> <span class="o">*</span> <span class="mi">80</span><span class="p">,</span> <span class="n">json_outfile</span><span class="p">))</span>
230+
<span class="nb">format</span><span class="p">(</span><span class="s1">&#39;-&#39;</span> <span class="o">*</span> <span class="mi">80</span><span class="p">,</span> <span class="n">json_outfile</span><span class="p">))</span></div>
229231

230-
<span class="k">def</span> <span class="nf">plot_optimization</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">freq</span><span class="o">=</span><span class="s1">&#39;daily&#39;</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;time_series&#39;</span><span class="p">,</span>\
232+
<div class="viewcode-block" id="Optimizer.plot_optimization"><a class="viewcode-back" href="../../api.html#prms_python.Optimizer.plot_optimization">[docs]</a> <span class="k">def</span> <span class="nf">plot_optimization</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">freq</span><span class="o">=</span><span class="s1">&#39;daily&#39;</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;time_series&#39;</span><span class="p">,</span>\
231233
<span class="n">plot_vars</span><span class="o">=</span><span class="s1">&#39;both&#39;</span><span class="p">,</span> <span class="n">plot_1to1</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">return_fig</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>\
232234
<span class="n">n_plots</span><span class="o">=</span><span class="mi">4</span><span class="p">):</span>
233235
<span class="sd">&quot;&quot;&quot;</span>
@@ -364,7 +366,7 @@ <h1>Source code for prms_python.optimizer</h1><div class="highlight"><pre>
364366
<span class="n">fig</span><span class="o">.</span><span class="n">delaxes</span><span class="p">(</span><span class="n">axs</span><span class="p">[</span><span class="n">n</span><span class="p">])</span>
365367

366368
<span class="k">if</span> <span class="n">return_fig</span><span class="p">:</span>
367-
<span class="k">return</span> <span class="n">fig</span></div>
369+
<span class="k">return</span> <span class="n">fig</span></div></div>
368370

369371
<span class="k">def</span> <span class="nf">_create_metafile_name</span><span class="p">(</span><span class="n">out_dir</span><span class="p">,</span> <span class="n">opt_title</span><span class="p">,</span> <span class="n">stage</span><span class="p">):</span>
370372
<span class="sd">&quot;&quot;&quot;</span>
@@ -789,7 +791,7 @@ <h1>Source code for prms_python.optimizer</h1><div class="highlight"><pre>
789791

790792
<span class="k">return</span> <span class="n">ret</span>
791793

792-
<span class="k">def</span> <span class="nf">archive</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">remove_sims</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">remove_meta</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">metric_freq</span><span class="o">=</span><span class="s1">&#39;daily&#39;</span><span class="p">):</span>
794+
<div class="viewcode-block" id="OptimizationResult.archive"><a class="viewcode-back" href="../../api.html#prms_python.OptimizationResult.archive">[docs]</a> <span class="k">def</span> <span class="nf">archive</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">remove_sims</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">remove_meta</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">metric_freq</span><span class="o">=</span><span class="s1">&#39;daily&#39;</span><span class="p">):</span>
793795
<span class="sd">&quot;&quot;&quot;</span>
794796
<span class="sd"> Create archive directory to hold json files that contain </span>
795797
<span class="sd"> information of adjusted parameters, model output, and performance </span>
@@ -895,12 +897,13 @@ <h1>Source code for prms_python.optimizer</h1><div class="highlight"><pre>
895897
<span class="k">try</span><span class="p">:</span>
896898
<span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">meta_file</span><span class="p">)</span>
897899
<span class="k">except</span><span class="p">:</span>
898-
<span class="k">continue</span></div>
900+
<span class="k">continue</span></div></div>
899901

900902

901903
</pre></div>
902904

903905
</div>
906+
904907
</div>
905908
</div>
906909
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
@@ -964,8 +967,8 @@ <h3>Quick search</h3>
964967
&copy;2016, John Volk and Matthew Turner.
965968

966969
|
967-
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.5</a>
968-
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
970+
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.6</a>
971+
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.11</a>
969972

970973
</div>
971974

Collapse file

‎docs/build/html/_modules/prms_python/parameters.html‎

Copy file name to clipboardExpand all lines: docs/build/html/_modules/prms_python/parameters.html
+37-18Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<div class="document">
2626
<div class="documentwrapper">
2727
<div class="bodywrapper">
28+
29+
2830
<div class="body" role="main">
2931

3032
<h1>Source code for prms_python.parameters</h1><div class="highlight"><pre>
@@ -48,9 +50,18 @@ <h1>Source code for prms_python.parameters</h1><div class="highlight"><pre>
4850

4951
<div class="viewcode-block" id="Parameters"><a class="viewcode-back" href="../../api.html#prms_python.Parameters">[docs]</a><span class="k">class</span> <span class="nc">Parameters</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
5052
<span class="sd">&#39;&#39;&#39;</span>
51-
<span class="sd"> Disk-based representation of a PRMS parameter file. For the sake of</span>
53+
<span class="sd"> Disk-based representation of a PRMS parameter file. The ``Parameters``</span>
54+
<span class="sd"> object has the following instance attributes:</span>
55+
56+
<span class="sd"> :ivar base_file: initial value: ``base_file``</span>
57+
<span class="sd"> :ivar base_file_reader: initial value: ``open(base_file)``</span>
58+
<span class="sd"> :ivar dimensions: initial value: ``collections.OrderedDict`` returned from ``self.__read_base(base_file)`` </span>
59+
<span class="sd"> :ivar base_params: initial value: ``list()`` returned from ``self.__read_base(base_file)``</span>
60+
<span class="sd"> :ivar param_arrays: initial value: empty ``dict()`` </span>
61+
62+
<span class="sd"> For the sake of</span>
5263
<span class="sd"> memory efficiency, we only load parameters from ``base_file`` that get</span>
53-
<span class="sd"> modifified through item assignment, for example</span>
64+
<span class="sd"> modified through item assignment, for example</span>
5465

5566
<span class="sd"> &gt;&gt;&gt; p = Parameters(&#39;example_params&#39;)</span>
5667
<span class="sd"> &gt;&gt;&gt; p[&#39;jh_coef&#39;] = p[&#39;jh_coef&#39;]*1.1</span>
@@ -59,13 +70,19 @@ <h1>Source code for prms_python.parameters</h1><div class="highlight"><pre>
5970
<span class="sd"> will read parameter information from the params file to check that</span>
6071
<span class="sd"> ``jh_coef`` is present in the parameter file, read the lines corresponding</span>
6172
<span class="sd"> to ``jh_coef`` data and assign the new value as requested. Internally,</span>
62-
<span class="sd"> a reference is kept to only modified parameter data,</span>
63-
<span class="sd"> so when ``p.write(modified_params_file)`` is called, mostly this will copy</span>
64-
<span class="sd"> from ``base_file`` to ``modified_params_file``.</span>
73+
<span class="sd"> a reference is kept to only modified parameter data, so when </span>
74+
<span class="sd"> ``p.write(modified_params_file)`` is called most copying is from ``base_file``</span>
75+
<span class="sd"> to ``modified_params_file``. When parameters are accessed using the </span>
76+
<span class="sd"> dictionary-like syntax, a ``np.ndarray`` representation of the parameter is </span>
77+
<span class="sd"> returned. As a result ``numpy`` mathematical rules including efficient </span>
78+
<span class="sd"> vectorization of math applied to arrays can be applied to modify parameters </span>
79+
<span class="sd"> directly. The ``Parameter`` objects user methods allow for visualization of </span>
80+
<span class="sd"> most PRMS parameters, function based modification of parameters, and a write </span>
81+
<span class="sd"> function that writes the data back to PRMS text format. </span>
82+
6583
<span class="sd"> &#39;&#39;&#39;</span>
6684

6785
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">base_file</span><span class="p">):</span>
68-
6986
<span class="bp">self</span><span class="o">.</span><span class="n">base_file</span> <span class="o">=</span> <span class="n">base_file</span>
7087
<span class="bp">self</span><span class="o">.</span><span class="n">base_file_reader</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">base_file</span><span class="p">)</span>
7188
<span class="bp">self</span><span class="o">.</span><span class="n">dimensions</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">base_params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__read_base</span><span class="p">(</span><span class="n">base_file</span><span class="p">)</span>
@@ -133,15 +150,16 @@ <h1>Source code for prms_python.parameters</h1><div class="highlight"><pre>
133150
<div class="viewcode-block" id="Parameters.plot"><a class="viewcode-back" href="../../api.html#prms_python.Parameters.plot">[docs]</a> <span class="k">def</span> <span class="nf">plot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nrows</span><span class="p">,</span> <span class="n">which</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">,</span> <span class="n">out_dir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">xlabel</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>\
134151
<span class="n">ylabel</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">cbar_label</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mpl_style</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
135152
<span class="sd">&quot;&quot;&quot;</span>
136-
<span class="sd"> Plot PRMS parameters as time series or 2D spatial grid depending on </span>
137-
<span class="sd"> parameter dimension. The PRMS parameter file is assumed to represent </span>
138-
<span class="sd"> a model that was set up on a uniform rectangular grid with the spatial </span>
153+
<span class="sd"> Versatile method that plots series or 2D spatial grid depending on </span>
154+
<span class="sd"> parameter dimension. The PRMS parameter file is assumed to hold parameters </span>
155+
<span class="sd"> for a model that was set up on a uniform rectangular grid with the spatial </span>
139156
<span class="sd"> index of HRUs starting in the upper left corner and moving left to </span>
140-
<span class="sd"> right across columns and down rows. </span>
157+
<span class="sd"> right across columns and down rows. Default function is to print four</span>
158+
<span class="sd"> files, each with plots of varying parameter dimensions as explained </span>
159+
<span class="sd"> under Kwargs ``which`` and more detailed explanation in the example</span>
160+
<span class="sd"> `Jupyter notebook &lt;https://github.com/PRMS-Python/PRMS-Python/blob/master/notebooks/param_examples.ipynb&gt;`_.</span>
141161
<span class="sd"> </span>
142162
<span class="sd"> Arguments:</span>
143-
<span class="sd"> params (prms_python.Parameters): An instance of Parameters that </span>
144-
<span class="sd"> corresponds with the PRMS parameter file to plot. </span>
145163
<span class="sd"> nrows (int): The number of rows in the PRMS model grid for plotting </span>
146164
<span class="sd"> spatial parameters. Function will only work for rectangular </span>
147165
<span class="sd"> gridded models with HRU indices starting in the upper left cell </span>
@@ -152,14 +170,14 @@ <h1>Source code for prms_python.parameters</h1><div class="highlight"><pre>
152170
<span class="sd"> the function will print 3 multipage pdfs, one for nhru </span>
153171
<span class="sd"> dimensional parameters, one for nhru by monthly parameters, one </span>
154172
<span class="sd"> for other parameters of length &gt; 1, and one html file containing</span>
155-
<span class="sd"> single valued parameters</span>
173+
<span class="sd"> single valued parameters.</span>
174+
156175
<span class="sd"> out_dir (str): path to an output dir, default current directory</span>
157176
<span class="sd"> xlabel (str): x label for plot(s)</span>
158177
<span class="sd"> ylabel (str): y label for plot(s)</span>
159178
<span class="sd"> cbar_label (str): label for colorbar on spatial plot(s)</span>
160179
<span class="sd"> title (str): plot title</span>
161-
<span class="sd"> mpl_style (str, list): name or list of names of matplotlib style </span>
162-
<span class="sd"> sheets to use for plot(s)</span>
180+
<span class="sd"> mpl_style (str, list): name or list of names of matplotlib style sheets to use for plot(s).</span>
163181
<span class="sd"> </span>
164182
<span class="sd"> Returns: </span>
165183
<span class="sd"> None</span>
@@ -332,7 +350,7 @@ <h1>Source code for prms_python.parameters</h1><div class="highlight"><pre>
332350

333351
<span class="k">def</span> <span class="nf">__make_dimensions_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">base_file</span><span class="p">):</span>
334352
<span class="sd">&quot;&quot;&quot;</span>
335-
<span class="sd"> Extract dimensions and each dimension length. Run before</span>
353+
<span class="sd"> Extract dimensions and each dimension length. Runs before</span>
336354
<span class="sd"> __make_parameter_dict.</span>
337355
<span class="sd"> &quot;&quot;&quot;</span>
338356
<span class="n">ret</span> <span class="o">=</span> <span class="n">OrderedDict</span><span class="p">()</span>
@@ -535,6 +553,7 @@ <h1>Source code for prms_python.parameters</h1><div class="highlight"><pre>
535553
</pre></div>
536554

537555
</div>
556+
538557
</div>
539558
</div>
540559
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
@@ -598,8 +617,8 @@ <h3>Quick search</h3>
598617
&copy;2016, John Volk and Matthew Turner.
599618

600619
|
601-
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.5</a>
602-
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
620+
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.6</a>
621+
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.11</a>
603622

604623
</div>
605624

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.