Skip to content

Commit

Permalink
update v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ni1o1 committed Apr 6, 2022
1 parent 8c6391b commit 1c40301
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 56 deletions.
25 changes: 3 additions & 22 deletions docs/source/bdshadow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Building shadow
Shadow from sunlight
=============================

.. function:: pybdshadow.bdshadow_sunlight(buildings, date, height='height', ground=0, epsg=3857)
.. function:: pybdshadow.bdshadow_sunlight(buildings, date, merge=False, height='height', ground=0, epsg=3857)

Calculate the sunlight shadow of the buildings.

Expand All @@ -19,6 +19,8 @@ buildings : GeoDataFrame
Buildings. coordinate system should be WGS84
date : datetime
Datetime
merge : bool
whether to merge the wall shadows into the building shadows
height : string
Column name of building height
ground : number
Expand All @@ -30,24 +32,3 @@ epsg : number

shadows : GeoDataFrame
Building shadow

.. function:: pybdshadow.singlebdshadow_sunlight(building, height, sunPosition)

Calculate the sunlight shadow of a single building. The input data should be in
projection coordinate system


**Parameters**

building : shapely.geometry.Polygon
Building. coordinate system should be projection coordinate system
height : string
Building height
sunPosition : dict
Sun position calculated by suncalc

**Return**

shadow : shapely.geometry.Polygon
Building shadow geometry

4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
author = 'Qing Yu'

# The full version, including alpha/beta/rc tags
release = '0.1.0'
version = '0.1.0'
release = '0.1.1'
version = '0.1.1'
html_logo = "_static/logo-wordmark-light.png"
html_favicon = '_static/logo.ico'
# -- General configuration ---------------------------------------------------
Expand Down
18 changes: 18 additions & 0 deletions docs/source/preprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,21 @@ buildings : GeoDataFrame

allbds : GeoDataFrame
Polygon buildings

.. function:: pybdshadow.merge_shadow(data, col = 'building_id')

The input is the GeoDataFrame of polygon geometry, and the col
name. This function will merge the polygon based on the category
in the mentioned column

**Parameters**

data : GeoDataFrame
The polygon geometry
col : str
The column name for indicating category

**Return**

data1 : GeoDataFrame
The merged polygon
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pybdshadow",
version="0.1.0",
version="0.1.1",
author="Qing Yu",
author_email="[email protected]",
description="Python package to generate building shadow geometry",
Expand Down
2 changes: 1 addition & 1 deletion src/pybdshadow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""

__version__ = '0.1.0'
__version__ = '0.1.1'
__author__ = 'Qing Yu <[email protected]>'

# module level doc-string
Expand Down
58 changes: 28 additions & 30 deletions src/test_vector.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -25,7 +25,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -35,16 +35,10 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"from pybdshadow import *\n",
"from suncalc import get_position\n",
"date = pd.to_datetime('2015-01-01 02:45:33.959797119')\n",
"height = 'height'\n",
"ground = 0\n",
"epsg = 3857\n",
"\n",
"def bdshadow_sunlight_vector(buildings, date,merge = False, height='height', ground=0, epsg=3857):\n",
"\n",
Expand Down Expand Up @@ -93,26 +87,23 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"12.9657142162323\n",
"37.269726037979126\n",
"50.474833726882935\n"
]
}
],
"outputs": [],
"source": [
"shadows = bdshadow_sunlight_vector(buildings, date)"
"from pybdshadow import *\n",
"from suncalc import get_position\n",
"date = pd.to_datetime('2015-01-01 02:45:33.959797119')\n",
"height = 'height'\n",
"ground = 0\n",
"epsg = 3857\n",
"\n",
"shadows = pybdshadow.bdshadow_sunlight(buildings, date,merge = True)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -121,18 +112,25 @@
"text": [
"User Guide: https://docs.kepler.gl/docs/keplergl-jupyter\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ff725b0a3b534485aae2a9a7e2bce4b5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"KeplerGl(config={'version': 'v1', 'config': {'visState': {'filters': [], 'layers': [{'id': '4eo0v3', 'type': '…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"pybdshadow.show_bdshadow(buildings = buildings,shadows = shadows)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 1c40301

Please sign in to comment.