Skip to content

Commit beb5381

Browse files
authored
Merge pull request #7 from NRCan/dev
5.A Documentation Alpha (Dev)
2 parents 4765624 + c572bcb commit beb5381

28 files changed

+579
-21
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ instance/
6969
.scrapy
7070

7171
# Sphinx documentation
72-
docs/_build/
72+
docs/build/
7373

7474
# PyBuilder
7575
target/

.readthedocs.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: "2"
2+
3+
build:
4+
os: "ubuntu-22.04"
5+
tools:
6+
python: "3.10"
7+
8+
python:
9+
install:
10+
- requirements: docs/requirements.txt
11+
12+
sphinx:
13+
configuration: docs/source/conf.py

cancurve/bldgs/cc_bldgs_dialog.ui

+24-15
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>800</width>
10-
<height>800</height>
10+
<height>819</height>
1111
</rect>
1212
</property>
1313
<property name="palette">
@@ -140,14 +140,14 @@ QTabBar::tab:selected { /* Style for selected tabs */
140140
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
141141
p, li { white-space: pre-wrap; }
142142
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:14px; font-weight:400; font-style:normal;&quot;&gt;
143-
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Welcome to the CanCurve &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-style:italic;&quot;&gt;Buildings&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; tool! This tool is designed to create &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-style:italic;&quot;&gt;Depth Damage Functions&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; (DDF) for Canadian buildings.&lt;/span&gt;&lt;/p&gt;
143+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Welcome to the CanCurve &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Buildings Tool.&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; This tool is designed to create &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-style:italic;&quot;&gt;Depth Damage Functions&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; (DDF) for Canadian buildings.&lt;/span&gt;&lt;/p&gt;
144144
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/plugins/cancurve/img/icon.png&quot; /&gt;&lt;/p&gt;
145145
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
146146
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;The following inputs are required:&lt;/span&gt;&lt;/p&gt;
147-
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:16px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Building Metadata&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: These standard flood-related building properties are specified on the &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-style:italic;&quot;&gt;Building Metadata&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; tab. This metadata will be used to populate the metadata of your DDF. Some of the fields are also used in the calculation process.&lt;/span&gt;&lt;/p&gt;
148-
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:16px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Cost Information: &lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;This restoration item and cost data is specifed as a CSV file on the &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-style:italic;&quot;&gt;Data Input&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; tab. Click &lt;/span&gt;&lt;a href=&quot;https://github.com/NRCan/CanCurve/blob/main/tests/data/bldgs/case1/R_1-L-BD-CU_ABCA.csv&quot;&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline; color:#0000ff;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; for an example. &lt;/span&gt;&lt;span style=&quot; font-size:14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
147+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:16px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Metadata&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: These standard flood-related building properties are specified on the &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-style:italic;&quot;&gt;Metadata&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; tab. This metadata will be used to populate the metadata of your DDF. Some of the fields are also used in the calculation process.&lt;/span&gt;&lt;/p&gt;
148+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:16px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Cost-Item Table: &lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;This table of restoration items and their costs is specifed as a CSV file on the &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-style:italic;&quot;&gt;Data Input&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; tab. Click &lt;/span&gt;&lt;a href=&quot;https://github.com/NRCan/CanCurve/blob/main/tests/data/bldgs/case1/R_1-L-BD-CU_ABCA.csv&quot;&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline; color:#0000ff;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; for an example. &lt;/span&gt;&lt;span style=&quot; font-size:14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
149149
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;The following inputs are optional:&lt;/span&gt;&lt;/p&gt;
150-
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:16px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Depth-Replacement-Factor (DRF) dataset&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: This dataset relates flood depth to the percentage loss or damage of a restoration item and is specified on the &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-style:italic;&quot;&gt;Data Input&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; tab. By default, the DRF dataset shipped with CanCurve will be used.&lt;/span&gt;&lt;/p&gt;
150+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:16px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Depth Replacement-Factor (DRF) dataset&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: This dataset relates flood depth to the percentage loss or damage of a restoration item and is specified on the &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-style:italic;&quot;&gt;Data Input&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; tab. By default, the DRF dataset shipped with CanCurve will be used.&lt;/span&gt;&lt;/p&gt;
151151
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:16px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
152152
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Navigate through the tabs at the top of the window from left-to-right to create your own DDF.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
153153
</property>
@@ -201,7 +201,7 @@ p, li { white-space: pre-wrap; }
201201
</widget>
202202
<widget class="QWidget" name="tab2bldgDetils">
203203
<attribute name="title">
204-
<string>Building Metadata</string>
204+
<string>Metadata</string>
205205
</attribute>
206206
<layout class="QVBoxLayout" name="verticalLayout_7">
207207
<item>
@@ -220,7 +220,7 @@ p, li { white-space: pre-wrap; }
220220
<property name="geometry">
221221
<rect>
222222
<x>0</x>
223-
<y>-317</y>
223+
<y>0</y>
224224
<width>745</width>
225225
<height>976</height>
226226
</rect>
@@ -364,7 +364,7 @@ QGroupBox {
364364
<item row="9" column="0">
365365
<widget class="QLabel" name="buildingLayoutLabel">
366366
<property name="text">
367-
<string>Building Layout</string>
367+
<string>Building Layout*</string>
368368
</property>
369369
</widget>
370370
</item>
@@ -413,7 +413,7 @@ QGroupBox {
413413
<item row="1" column="0">
414414
<widget class="QLabel" name="basementHeightLabel_2">
415415
<property name="text">
416-
<string>Basement height (value)</string>
416+
<string>Basement height (value)*</string>
417417
</property>
418418
</widget>
419419
</item>
@@ -505,14 +505,14 @@ QGroupBox {
505505
<string>This value is used when 'RCV/Area' is selected to scale the replacement costs (e.g., to footprint area)</string>
506506
</property>
507507
<property name="text">
508-
<string>Area (value)</string>
508+
<string>Structure area (value)*</string>
509509
</property>
510510
</widget>
511511
</item>
512512
<item row="2" column="0">
513513
<widget class="QLabel" name="qualityOfBuildingMaterialsLabel">
514514
<property name="text">
515-
<string>Quality of Building Materials</string>
515+
<string>Quality of building materials</string>
516516
</property>
517517
</widget>
518518
</item>
@@ -726,7 +726,7 @@ QGroupBox {
726726
<item>
727727
<widget class="QLabel" name="label_6">
728728
<property name="text">
729-
<string>On this page, you'll load the data needed for CanCurve to create the depth-damage function</string>
729+
<string>Specify the settings and datasets for your project</string>
730730
</property>
731731
</widget>
732732
</item>
@@ -797,7 +797,7 @@ QGroupBox {
797797
<item>
798798
<widget class="QGroupBox" name="groupBox_t03_03">
799799
<property name="title">
800-
<string>Cost-Item File:</string>
800+
<string>Cost-Item Table:</string>
801801
</property>
802802
<layout class="QHBoxLayout" name="horizontalLayout_9">
803803
<item>
@@ -948,7 +948,7 @@ QGroupBox {
948948
<item>
949949
<widget class="QGroupBox" name="groupBox_t03_06">
950950
<property name="title">
951-
<string>Depth-Replacement-Fraction File</string>
951+
<string>Depth Replacement-Factor (DRF) Database:</string>
952952
</property>
953953
<layout class="QHBoxLayout" name="horizontalLayout_11">
954954
<item>
@@ -1403,6 +1403,9 @@ QLabel {
14031403
<verstretch>0</verstretch>
14041404
</sizepolicy>
14051405
</property>
1406+
<property name="toolTip">
1407+
<string>build project SQLite database and load data into it</string>
1408+
</property>
14061409
<property name="text">
14071410
<string>Run</string>
14081411
</property>
@@ -1511,6 +1514,9 @@ QLabel {
15111514
<verstretch>0</verstretch>
15121515
</sizepolicy>
15131516
</property>
1517+
<property name="toolTip">
1518+
<string>Join DRF to CI then multiply through to create fractional restoration costs</string>
1519+
</property>
15141520
<property name="text">
15151521
<string>Run</string>
15161522
</property>
@@ -1600,6 +1606,9 @@ QLabel {
16001606
<verstretch>0</verstretch>
16011607
</sizepolicy>
16021608
</property>
1609+
<property name="toolTip">
1610+
<string>group by story and assemble DDF</string>
1611+
</property>
16031612
<property name="text">
16041613
<string>Run</string>
16051614
</property>
@@ -1948,7 +1957,7 @@ QLabel {
19481957
</resources>
19491958
<connections/>
19501959
<buttongroups>
1951-
<buttongroup name="buttonGroup_runControl"/>
19521960
<buttongroup name="buttonGroup_costbasis"/>
1961+
<buttongroup name="buttonGroup_runControl"/>
19531962
</buttongroups>
19541963
</ui>

cancurve/bldgs/core.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ def c00_setup_project(
642642

643643

644644
):
645-
"""build project SQLite. load data into it
645+
"""build project SQLite database and load data into it
646646
647647
648648
Params
@@ -923,7 +923,7 @@ def c00_setup_project(
923923
def c01_join_drf(proj_db_fp,
924924
log=None,
925925
):
926-
"""Join DRF to CI then multiply through to create 'depth_rcv' table
926+
"""Join DRF to CI then multiply through to create fractional restoration costs
927927
928928
929929
Params

dev_tools/docs_build.bat

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
:: Building CanCurve sphinx documentation (w/o RTD)
2+
3+
4+
5+
:: activate docs environment
6+
call l:\09_REPOS\01_COMMON\sphinx\env\conda_activate.bat
7+
8+
:: call the shpinx make script
9+
:: call %~dp0..\docs\make.bat html
10+
:: difficult to customize
11+
12+
13+
:: change to documentation
14+
15+
cd %~dp0..\docs
16+
17+
:: call builder CLI
18+
ECHO on
19+
20+
sphinx-build -M html .\source .\build --jobs=4 --verbose --show-traceback --nitpicky --warning-file=.\build\sphinx_warnings.txt
21+
22+
23+
:: launch it
24+
call build\html\index.html
25+
26+
cmd.exe

docs/CONTRIBUTING.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#CanCurve documentation
2+
3+
CanCurve uses Sphinx and ReadTheDocs
4+
5+
## build sphinx documentation locally
6+
need a python environment w/ sphinx
7+
call .\dev_tools\docs_build.bat

docs/cspell.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"language": "en-CA",
3+
"dictionaries": ["en-CA"],
4+
"dictionaryDefinitions": [
5+
{
6+
"name": "en-CA",
7+
"path": "l:\\09_REPOS\\01_COMMON\\sphinx\\env\\sphinx\\node_modules\\@cspell\\dict-en-ca\\en_CA.trie"
8+
}
9+
],
10+
"enableFiletypes": [
11+
"rst"
12+
],
13+
"ignoreRegExpList": [
14+
"/<[^>]*>/g", // Ignore text within angle brackets
15+
"/^\\../" // Ignore lines that begin with ..
16+
],
17+
"ignorePaths": [
18+
"package-lock.json",
19+
"node_modules",
20+
"vscode-extension",
21+
".git/objects",
22+
".vscode",
23+
".vscode-insiders",
24+
".settings"
25+
],
26+
"userWords": [
27+
"operationalize",
28+
"QGIS",
29+
"Xactimate",
30+
"DDFP"
31+
]
32+
}

docs/source/01_getting-started.rst

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
.. _sec01-gettingStarted:
2+
3+
Getting Started
4+
==================
5+
The following sections will help you get started using CanCurve.
6+
We suggest reading these sections first.
7+
8+
9+
.. _sec01-install:
10+
11+
Installation
12+
------------
13+
14+
To install CanCurve, you first need to install QGIS, then you can install CanCurve from the Plugin Repository.
15+
16+
For detailed instructions, refer to the `project README <https://github.com/NRCan/CanCurve/tree/main?tab=readme-ov-file#installation>`_.
17+
For best performance, ensure you have the specified version of QGIS installed.
18+
19+
20+
.. _sec01-overview:
21+
22+
Overviews
23+
-----------------------
24+
CanCurve is a collection of tools for generating Depth Damage Functions (DDF) used by platforms like `CanFlood <https://github.com/NRCan/CanFlood>`_ to create flood risk models.
25+
CanCurve's :ref:`Buildings Tool <sec02-bldgs>` for example facilitates the creation of DDFs from detailed restoration cost data for archetypal buildings.
26+
This tool joins a table of restoration activities (e.g., repair dry-wall for $1000), called the :ref:`Cost-Item Table <sec02-costItem>`, to a database of information on the flood vulnerability of those items, called the :ref:`Depth-Replacement-Factor (DRF) Database <sec02-DRF>`.
27+
After identifying the target building or archetype for which a user would like to construct a DDF, typically a :ref:`Cost-Item Table <sec02-costItem>` is prepared using local pricing tables and expert knowledge on the restoration of the building.
28+
For the :ref:`DRF Database <sec02-DRF>`, either the version shipped with CanCurve can be used (default), or an alternate file can be specified.
29+
Once these inputs and the building metadata are prepared and entered into the Buildings Tool, the four :ref:`Curve Creation <sec02-Core>` steps can be run to create and export a DDF in :ref:`CanFlood format <sec02-CanFloodFormat>`.
30+
31+
32+
33+
34+
35+
.. _sec01-quick:
36+
37+
Quick-Start
38+
-----------------------
39+
After installation of the plugin, the |CanCurve_icon| icon should appear on your plugins toolbar.
40+
If you don't see the icon, first ensure the plugin is checked on the **Installed** tab of the **Manage and Install Plugins..** dialog; then ensure the **plugins toolbar** is enabled by right-clicking the QGIS toolbar.
41+
42+
.. |CanCurve_icon| image:: /assets/icon_solid.png
43+
:align: middle
44+
:width: 14
45+
46+
To start working with CanCurve, click the |CanCurve_icon| to open the :ref:`Buildings Tool <sec02-bldgs>` dialog.
47+
48+
49+
.. _fig01-dialog-welcome:
50+
51+
.. figure:: /assets/01-dialog-welcome.png
52+
:alt: Welcome Tab
53+
:align: center
54+
:width: 900px
55+
56+
Welcome tab of the Buildings Tool.
57+
58+
59+
To use the tool to create a DDF from data for your archetypal building, first populate the **Metadata** tab with whatever information is available (see the :ref:`Tutorials <sec03-tutorials>` section for example data).
60+
Note only fields marked with an asterisk (*) are required, but the more information you provide, the more complete your DDF will be.
61+
To specify settings, the :ref:`Cost-Item Table <sec02-costItem>`, the :ref:`Depth-Replacement Factor (DRF) Database <sec02-DRF>`, and the :ref:`Fixed Costs <sec02-fixedCosts>` data, complete the **Data Input** tab.
62+
Finally, the four curve creation steps can be executed from the **Create Curve** tab, ending in an export of your DDF in :ref:`CanFlood format <sec02-CanFloodFormat>`.
63+
64+
65+
See the :ref:`User Guide <sec02-userGuide>` and the :ref:`Tutorials <sec03-tutorials>` section to learn more.
66+
67+
68+
.. _sec01-faq:
69+
70+
Frequently Asked Questions
71+
--------------------------
72+
73+
**Where can I find Cost-Item data for my archetype?**
74+
Typically this information is obtained from cost restoration experts using specialized software like Xactimate and a detailed model of the structure.
75+
76+
**How can I add entries to my Depth-Replacement-Factor (DRF) Database**
77+
You'll need to use some software that allows editing of SQLite databases. We recommend `DB Browser for SQLite <https://sqlitebrowser.org/>`_.
78+
79+
**Where can I go to get help?**
80+
The best place to get help is the `CanCurve GitHub Issues <https://github.com/NRCan/CanCurve/issues>`_ page where you can read through questions posted by others or ask your own.
81+
82+
83+
**Do I really need to install an old version of QGIS to use CanCurve**
84+
No, but we recommend it for best performance. If you have a newer version of QGIS installed, you can try CanCurve with it, but you may experience issues.
85+
86+
87+
88+
89+
90+

0 commit comments

Comments
 (0)