Skip to content

Commit

Permalink
deploy: 8de98f2
Browse files Browse the repository at this point in the history
  • Loading branch information
erexer committed Feb 21, 2024
1 parent 7fcdeb4 commit b0ee23a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 32 deletions.
37 changes: 23 additions & 14 deletions _sources/quickstarter.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@ Data input

The only input data required for *naturf* is a shapefile with building footprints and height data. There should be a field with a unique ID for each building the shapefile, and it should be in a projected coordinate system such as Alber Equal Area Conic. For input to the Weather Research and Forecasting model (WRF), the computed parameters for each building will be projected into WGS 84.

Clone git repository
--------------------
Either check out our interactive `quickstarter <quickstarter.rst>`_, or continue below to run `naturf` using a python file.

.. code:: bash
git clone https://github.com/IMMM-SFA/naturf.git
Install dependencies
--------------------
In the directory where the *naturf* repository was cloned, run the following command to install all dependencies in the current environment.
Install ``naturf`
-----------------
.. code:: bash
pip install .
pip install naturf
Edit config file
----------------
Expand All @@ -33,11 +27,26 @@ The *config.py* file in the naturf/ directory sets the default names for variabl
data_id_field_name
data_height_field_name
Create a python script called `run.py` to run `naturf`
.. code:: python3
from importlib.resources import files
from naturf import driver
input_shapefile_path = str(files("naturf.data").joinpath("C-5.shp"))
inputs = {"input_shapefile": input_shapefile_path}
outputs = ["write_binary", "write_index"]
model = driver.Model(inputs, outputs)
df = model.execute()
model.graph()
Run `naturf` using hamilton
---------------------------
This will run all functions required to create the output specified in `hamilton_run.py` `output_columns` variable. Currently `write_binary` and `write_index`. The `path` variable should point towards the input shapefile.
Run `naturf`
------------
This will run all functions required to create the output specified in the `run.py` `output_columns` variable. Currently `write_binary` and `write_index`. The `path` variable should point towards the input shapefile.
.. code:: bash
python hamilton_run.py
python run.py
Binary file modified objects.inv
Binary file not shown.
40 changes: 23 additions & 17 deletions quickstarter.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Quickstarter</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#data-input">Data input</a></li>
<li class="toctree-l2"><a class="reference internal" href="#clone-git-repository">Clone git repository</a></li>
<li class="toctree-l2"><a class="reference internal" href="#install-dependencies">Install dependencies</a></li>
<li class="toctree-l2"><a class="reference internal" href="#install-naturf">Install ``naturf`</a></li>
<li class="toctree-l2"><a class="reference internal" href="#edit-config-file">Edit config file</a></li>
<li class="toctree-l2"><a class="reference internal" href="#run-naturf-using-hamilton">Run <cite>naturf</cite> using hamilton</a></li>
<li class="toctree-l2"><a class="reference internal" href="#run-naturf">Run <cite>naturf</cite></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="user_guide.html">User guide</a></li>
Expand Down Expand Up @@ -106,17 +105,11 @@ <h1>Quickstarter<a class="headerlink" href="#quickstarter" title="Link to this h
<section id="data-input">
<h2>Data input<a class="headerlink" href="#data-input" title="Link to this heading"></a></h2>
<p>The only input data required for <em>naturf</em> is a shapefile with building footprints and height data. There should be a field with a unique ID for each building the shapefile, and it should be in a projected coordinate system such as Alber Equal Area Conic. For input to the Weather Research and Forecasting model (WRF), the computed parameters for each building will be projected into WGS 84.</p>
<p>Either check out our interactive <a class="reference internal" href="#"><span class="doc">quickstarter</span></a>, or continue below to run <cite>naturf</cite> using a python file.</p>
</section>
<section id="clone-git-repository">
<h2>Clone git repository<a class="headerlink" href="#clone-git-repository" title="Link to this heading"></a></h2>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/IMMM-SFA/naturf.git
</pre></div>
</div>
</section>
<section id="install-dependencies">
<h2>Install dependencies<a class="headerlink" href="#install-dependencies" title="Link to this heading"></a></h2>
<p>In the directory where the <em>naturf</em> repository was cloned, run the following command to install all dependencies in the current environment.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>.
<section id="install-naturf">
<h2>Install <a href="#id2"><span class="problematic" id="id3">``</span></a>naturf`<a class="headerlink" href="#install-naturf" title="Link to this heading"></a></h2>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>naturf
</pre></div>
</div>
</section>
Expand All @@ -127,11 +120,24 @@ <h2>Edit config file<a class="headerlink" href="#edit-config-file" title="Link t
<span class="n">data_height_field_name</span>
</pre></div>
</div>
<p>Create a python script called <cite>run.py</cite> to run <cite>naturf</cite></p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">importlib.resources</span> <span class="kn">import</span> <span class="n">files</span>
<span class="kn">from</span> <span class="nn">naturf</span> <span class="kn">import</span> <span class="n">driver</span>

<span class="n">input_shapefile_path</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">files</span><span class="p">(</span><span class="s2">&quot;naturf.data&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">joinpath</span><span class="p">(</span><span class="s2">&quot;C-5.shp&quot;</span><span class="p">))</span>
<span class="n">inputs</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;input_shapefile&quot;</span><span class="p">:</span> <span class="n">input_shapefile_path</span><span class="p">}</span>
<span class="n">outputs</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;write_binary&quot;</span><span class="p">,</span> <span class="s2">&quot;write_index&quot;</span><span class="p">]</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">driver</span><span class="o">.</span><span class="n">Model</span><span class="p">(</span><span class="n">inputs</span><span class="p">,</span> <span class="n">outputs</span><span class="p">)</span>

<span class="n">df</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">execute</span><span class="p">()</span>
<span class="n">model</span><span class="o">.</span><span class="n">graph</span><span class="p">()</span>
</pre></div>
</div>
</section>
<section id="run-naturf-using-hamilton">
<h2>Run <cite>naturf</cite> using hamilton<a class="headerlink" href="#run-naturf-using-hamilton" title="Link to this heading"></a></h2>
<p>This will run all functions required to create the output specified in <cite>hamilton_run.py</cite> <cite>output_columns</cite> variable. Currently <cite>write_binary</cite> and <cite>write_index</cite>. The <cite>path</cite> variable should point towards the input shapefile.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>hamilton_run.py
<section id="run-naturf">
<h2>Run <cite>naturf</cite><a class="headerlink" href="#run-naturf" title="Link to this heading"></a></h2>
<p>This will run all functions required to create the output specified in the <cite>run.py</cite> <cite>output_columns</cite> variable. Currently <cite>write_binary</cite> and <cite>write_index</cite>. The <cite>path</cite> variable should point towards the input shapefile.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>run.py
</pre></div>
</div>
</section>
Expand Down
Loading

0 comments on commit b0ee23a

Please sign in to comment.