Spaces:
Runtime error
Runtime error
Commit
·
2c2341d
1
Parent(s):
76e4820
Added sphinx documentation skeleton
Browse files- docs/Makefile +20 -0
- docs/conf.py +11 -0
- docs/gui.rst +16 -0
- docs/index.rst +17 -0
- docs/install.rst +18 -0
- docs/make.bat +35 -0
- docs/quickstart.rst +22 -0
docs/Makefile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Minimal makefile for Sphinx documentation
|
| 2 |
+
#
|
| 3 |
+
|
| 4 |
+
# You can set these variables from the command line, and also
|
| 5 |
+
# from the environment for the first two.
|
| 6 |
+
SPHINXOPTS ?=
|
| 7 |
+
SPHINXBUILD ?= sphinx-build
|
| 8 |
+
SOURCEDIR = .
|
| 9 |
+
BUILDDIR = _build
|
| 10 |
+
|
| 11 |
+
# Put it first so that "make" without argument is like "make help".
|
| 12 |
+
help:
|
| 13 |
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
| 14 |
+
|
| 15 |
+
.PHONY: help Makefile
|
| 16 |
+
|
| 17 |
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
| 18 |
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
| 19 |
+
%: Makefile
|
| 20 |
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
docs/conf.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
project = 'TomorrowCities'
|
| 2 |
+
copyright = '2023, TomorrowCities'
|
| 3 |
+
author = 'H. Kaya'
|
| 4 |
+
|
| 5 |
+
extensions = []
|
| 6 |
+
|
| 7 |
+
templates_path = ['_templates']
|
| 8 |
+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
| 9 |
+
|
| 10 |
+
html_theme = 'sphinx_rtd_theme'
|
| 11 |
+
html_static_path = ['_static']
|
docs/gui.rst
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
:: _gui:
|
| 2 |
+
|
| 3 |
+
Graphical User Interfaces
|
| 4 |
+
=========================
|
| 5 |
+
There are several graphical user interfaces (GUIs)
|
| 6 |
+
prepared to show case the features of the library.
|
| 7 |
+
The codes related to GUIs are in the ``src/gui`` directory.
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
Launching
|
| 11 |
+
=========
|
| 12 |
+
There are different ways to launch the GUIs depending
|
| 13 |
+
on how you obtain the library.
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
docs/index.rst
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
TomorrowCities Python Package
|
| 2 |
+
=============================
|
| 3 |
+
|
| 4 |
+
.. toctree::
|
| 5 |
+
:maxdepth: 2
|
| 6 |
+
:caption: First Steps:
|
| 7 |
+
|
| 8 |
+
install
|
| 9 |
+
quickstart
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
Indices and tables
|
| 13 |
+
==================
|
| 14 |
+
|
| 15 |
+
* :ref:`genindex`
|
| 16 |
+
* :ref:`modindex`
|
| 17 |
+
* :ref:`search`
|
docs/install.rst
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
:: _install:
|
| 2 |
+
|
| 3 |
+
Installation
|
| 4 |
+
============
|
| 5 |
+
|
| 6 |
+
.. highlight:: bash
|
| 7 |
+
|
| 8 |
+
Prerequisites:
|
| 9 |
+
|
| 10 |
+
* Python >= 3.9
|
| 11 |
+
|
| 12 |
+
To install TomorrowCities Python package you can use `pip`:
|
| 13 |
+
|
| 14 |
+
.. code-block:: bash
|
| 15 |
+
|
| 16 |
+
pip install tomorrowcities
|
| 17 |
+
|
| 18 |
+
|
docs/make.bat
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@ECHO OFF
|
| 2 |
+
|
| 3 |
+
pushd %~dp0
|
| 4 |
+
|
| 5 |
+
REM Command file for Sphinx documentation
|
| 6 |
+
|
| 7 |
+
if "%SPHINXBUILD%" == "" (
|
| 8 |
+
set SPHINXBUILD=sphinx-build
|
| 9 |
+
)
|
| 10 |
+
set SOURCEDIR=.
|
| 11 |
+
set BUILDDIR=_build
|
| 12 |
+
|
| 13 |
+
%SPHINXBUILD% >NUL 2>NUL
|
| 14 |
+
if errorlevel 9009 (
|
| 15 |
+
echo.
|
| 16 |
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
| 17 |
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
| 18 |
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
| 19 |
+
echo.may add the Sphinx directory to PATH.
|
| 20 |
+
echo.
|
| 21 |
+
echo.If you don't have Sphinx installed, grab it from
|
| 22 |
+
echo.https://www.sphinx-doc.org/
|
| 23 |
+
exit /b 1
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
if "%1" == "" goto help
|
| 27 |
+
|
| 28 |
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
| 29 |
+
goto end
|
| 30 |
+
|
| 31 |
+
:help
|
| 32 |
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
| 33 |
+
|
| 34 |
+
:end
|
| 35 |
+
popd
|
docs/quickstart.rst
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Quick Start
|
| 2 |
+
===========
|
| 3 |
+
|
| 4 |
+
.. highlight:: python
|
| 5 |
+
|
| 6 |
+
After :doc:`/install`, you can import `tomorrowcities`
|
| 7 |
+
package and start generating exposure data or calculating
|
| 8 |
+
impact metrics.
|
| 9 |
+
|
| 10 |
+
.. code-block:: python
|
| 11 |
+
|
| 12 |
+
import tomorrowcities as tc
|
| 13 |
+
|
| 14 |
+
dg = tc.DataGenerator(parameter_file='distribution_table.xlsx',
|
| 15 |
+
land_use_file='landuse.zip')
|
| 16 |
+
|
| 17 |
+
building, household, individual, land_use = dg.generate(seed=42)
|
| 18 |
+
|
| 19 |
+
metrics = dg.run_engine(building, household, individual, land_use,
|
| 20 |
+
hazard_scenario="FLOOD", hazard_data="flood.xlsx", policies=None):
|
| 21 |
+
|
| 22 |
+
|