A python package for generating, analyzing and visualizing building shadows

Overview

pybdshadow

1649074615552.png

Documentation Status Downloads codecov Tests Binder

Introduction

pybdshadow is a python package for generating, analyzing and visualizing building shadows from large scale building geographic data. pybdshadow support generate building shadows from both sun light and point light. pybdshadow provides an efficient and easy-to-use method to generate a new source of geospatial data with great application potential in urban study.

The latest stable release of the software can be installed via pip and full documentation can be found here.

Functionality

Currently, pybdshadow mainly provides the following methods:

  • Generating building shadow from sun light: With given location and time, the function in pybdshadow uses the properties of sun position obtained from suncalc-py and the building height to generate shadow geometry data.
  • Generating building shadow from point light: pybdshadow can generate the building shadow with given location and height of the point light, which can be potentially useful for visual area analysis in urban environment.
  • Analysis: pybdshadow integrated the analysing method based on the properties of sun movement to track the changing position of shadows within a fixed time interval. Based on the grid processing framework provided by TransBigData, pybdshadow is capable of calculating sunshine time on the ground and on the roof.
  • Visualization: Built-in visualization capabilities leverage the visualization package keplergl to interactively visualize building and shadow data in Jupyter notebooks with simple code.

The target audience of pybdshadow includes data science researchers and data engineers in the field of BIM, GIS, energy, environment, and urban computing.

Installation

It is recommended to use Python 3.7, 3.8, 3.9

Using pypi PyPI version

pybdshadow can be installed by using pip install. Before installing pybdshadow, make sure that you have installed the available geopandas package. If you already have geopandas installed, run the following code directly from the command prompt to install pybdshadow:

pip install pybdshadow

Usage

Shadow generated by Sun light

Detail usage can be found in this example. pybdshadow is capable of generating shadows from building geographic data. The buildings are usually store in the data as the form of Polygon object with height information (usually Shapefile or GeoJSON file).

import pandas as pd
import geopandas as gpd
#Read building GeoJSON data
buildings = gpd.read_file(r'data/bd_demo_2.json')

Given a building GeoDataFrame and UTC datetime, pybdshadow can calculate the building shadow based on the sun position obtained by suncalc-py.

import pybdshadow
#Given UTC datetime
date = pd.to_datetime('2022-01-01 12:45:33.959797119')\
    .tz_localize('Asia/Shanghai')\
    .tz_convert('UTC')
#Calculate building shadow for sun light
shadows = pybdshadow.bdshadow_sunlight(buildings,date)

Visualize buildings and shadows using matplotlib.

import matplotlib.pyplot as plt
fig = plt.figure(1, (12, 12))
ax = plt.subplot(111)
# plot buildings
buildings.plot(ax=ax)
# plot shadows
shadows['type'] += ' shadow'
shadows.plot(ax=ax, alpha=0.7,
             column='type',
             categorical=True,
             cmap='Set1_r',
             legend=True)
plt.show()

1651741110878.png

pybdshadow also provide visualization method supported by keplergl.

# visualize buildings and shadows
pybdshadow.show_bdshadow(buildings = buildings,shadows = shadows)

1649161376291.png

Shadow generated by Point light

pybdshadow can also calculate the building shadow generated by point light. Given coordinates and height of the point light:

#Calculate building shadow for point light
shadows = pybdshadow.bdshadow_pointlight(buildings,139.713319,35.552040,200)
#Visualize buildings and shadows
pybdshadow.show_bdshadow(buildings = buildings,shadows = shadows)

1649405838683.png

Shadow coverage analysis

pybdshadow provides the functionality to analysis sunshine time on the roof and on the ground.

Result of shadow coverage on the roof:

1651645524782.png1651975815798.png

Result of sunshine time on the ground:

1651645530892.png1651975824187.png

Dependency

pybdshadow depends on the following packages

Citation information status

Citation information can be found at CITATION.cff.

Contributing to pybdshadow GitHub contributors GitHub commit activity

All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome. A detailed overview on how to contribute can be found in the contributing guide on GitHub.

You might also like...
Code and data for the EMNLP 2021 paper "Just Say No: Analyzing the Stance of Neural Dialogue Generation in Offensive Contexts". Coming soon!

ToxiChat Code and data for the EMNLP 2021 paper "Just Say No: Analyzing the Stance of Neural Dialogue Generation in Offensive Contexts". Install depen

Universal Adversarial Triggers for Attacking and Analyzing NLP (EMNLP 2019)

Universal Adversarial Triggers for Attacking and Analyzing NLP This is the official code for the EMNLP 2019 paper, Universal Adversarial Triggers for

Code for the paper
Code for the paper "Benchmarking and Analyzing Point Cloud Classification under Corruptions"

ModelNet-C Code for the paper "Benchmarking and Analyzing Point Cloud Classification under Corruptions". For the latest updates, see: sites.google.com

A framework for analyzing computer vision models with simulated data

3DB: A framework for analyzing computer vision models with simulated data Paper Quickstart guide Blog post Installation Follow instructions on: https:

Analyzing basic network responses to novel classes
Analyzing basic network responses to novel classes

novelty-detection Analyzing how AlexNet responds to novel classes with varying degrees of similarity to pretrained classes from ImageNet. If you find

Project page of the paper 'Analyzing Perception-Distortion Tradeoff using Enhanced Perceptual Super-resolution Network' (ECCVW 2018)
Project page of the paper 'Analyzing Perception-Distortion Tradeoff using Enhanced Perceptual Super-resolution Network' (ECCVW 2018)

EPSR (Enhanced Perceptual Super-resolution Network) paper This repo provides the test code, pretrained models, and results on benchmark datasets of ou

😇A pyTorch implementation of the DeepMoji model: state-of-the-art deep learning model for analyzing sentiment, emotion, sarcasm etc

------ Update September 2018 ------ It's been a year since TorchMoji and DeepMoji were released. We're trying to understand how it's being used such t

Cross Quality LFW: A database for Analyzing Cross-Resolution Image Face Recognition in Unconstrained Environments

Cross-Quality Labeled Faces in the Wild (XQLFW) Here, we release the database, evaluation protocol and code for the following paper: Cross Quality LFW

Official repository of the paper
Official repository of the paper "A Variational Approximation for Analyzing the Dynamics of Panel Data". Mixed Effect Neural ODE. UAI 2021.

Official repository of the paper (UAI 2021) "A Variational Approximation for Analyzing the Dynamics of Panel Data", Mixed Effect Neural ODE. Panel dat

Comments
  • Could you explain more on the data preparation pipeline?(How to get geojson file from OSM?) much appreciated!

    Could you explain more on the data preparation pipeline?(How to get geojson file from OSM?) much appreciated!

    Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

    Describe the solution you'd like A clear and concise description of what you want to happen.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

    opened by WanliQianKolmostar 4
  • Shadows also before sunrise and after sunset

    Shadows also before sunrise and after sunset

    Hi, thanks for this wonderful package, I'm really enjoying it!

    I've noticed that with pybdshadow.bdshadow_sunlight shadow results are also provided before sunrise and after sunset for the local time, it seems to me there should be an error thrown in this case, since the results are not meaningful (or simply a zero area shadow provided).

    I imagine this type of check is already implemented for the calculations of light/shadow daily hours on a surface.

    opened by gcaria 2
  • [ImgBot] Optimize images

    [ImgBot] Optimize images

    Beep boop. Your images are optimized!

    Your image file size has been reduced by 20% 🎉

    Details

    | File | Before | After | Percent reduction | |:--|:--|:--|:--| | /image/README/1649161376291_1.png | 373.42kb | 249.67kb | 33.14% | | /docs/source/_static/visualize.png | 142.65kb | 95.60kb | 32.98% | | /image/README/1649074615552.png | 25.86kb | 18.00kb | 30.41% | | /docs/source/_static/logo-wordmark-dark.png | 25.86kb | 18.00kb | 30.41% | | /docs/source/_static/logo-wordmark-light.png | 22.20kb | 16.06kb | 27.67% | | /image/README/1649405838683_1.png | 395.68kb | 297.10kb | 24.91% | | /docs/source/example/output_6_1.png | 283.05kb | 230.73kb | 18.48% | | /docs/source/example/output_31_0.png | 56.82kb | 46.96kb | 17.35% | | /image/README/1651975824187.png | 57.54kb | 47.80kb | 16.93% | | /docs/source/example/output_29_0.png | 57.54kb | 47.80kb | 16.93% | | /docs/source/example/output_14_0.png | 413.83kb | 349.48kb | 15.55% | | /image/README/1651741110878.png | 414.83kb | 350.63kb | 15.47% | | /docs/source/example/output_24_1.png | 16.54kb | 14.38kb | 13.09% | | /image/README/1651975815798.png | 37.59kb | 34.22kb | 8.98% | | /docs/source/example/output_27_0.png | 37.59kb | 34.22kb | 8.98% | | /image/README/1651645530892.png | 47.96kb | 46.13kb | 3.81% | | /image/README/1651506285290.png | 44.85kb | 43.24kb | 3.59% | | /image/README/1651645524782.png | 39.38kb | 38.19kb | 3.01% | | /image/README/1651490416315.png | 42.67kb | 41.57kb | 2.58% | | /image/README/1651490411329.png | 39.70kb | 38.88kb | 2.06% | | | | | | | Total : | 2,575.54kb | 2,058.63kb | 20.07% |


    📝 docs | :octocat: repo | 🙋🏾 issues | 🏪 marketplace

    ~Imgbot - Part of Optimole family

    opened by imgbot[bot] 1
  • Shadow on vertical walls

    Shadow on vertical walls

    Hi, As far as I understood from the documentation, pybdshadow is currently able to calculate shadows on the ground and on the roofs of buildings. I was just wondering, is it possible to calculate shadows also on vertical walls of buildings? For my use case, I would not need a complete shadow calculation, I would just need to know if a specific wall surface is shadowed or not (a binary output). To simplify, it would be enough to know if a single point of the wall surface (e.g. the center) is shadowed.

    opened by amaccarini 1
Releases(0.3.3)
Owner
Qing Yu
Python, JavaScript, Spatio-temporal big data, Data visualization
Qing Yu
API for RL algorithm design & testing of BCA (Building Control Agent) HVAC on EnergyPlus building energy simulator by wrapping their EMS Python API

RL - EmsPy (work In Progress...) The EmsPy Python package was made to facilitate Reinforcement Learning (RL) algorithm research for developing and tes

null 20 Jan 5, 2023
QuakeLabeler is a Python package to create and manage your seismic training data, processes, and visualization in a single place — so you can focus on building the next big thing.

QuakeLabeler Quake Labeler was born from the need for seismologists and developers who are not AI specialists to easily, quickly, and independently bu

Hao Mai 15 Nov 4, 2022
Simple tools for logging and visualizing, loading and training

TNT TNT is a library providing powerful dataloading, logging and visualization utilities for Python. It is closely integrated with PyTorch and is desi

null 1.5k Jan 2, 2023
A module for solving and visualizing Schrödinger equation.

qmsolve This is an attempt at making a solid, easy to use solver, capable of solving and visualize the Schrödinger equation for multiple particles, an

null 506 Dec 28, 2022
Your interactive network visualizing dashboard

Your interactive network visualizing dashboard Documentation: Here What is Jaal Jaal is a python based interactive network visualizing tool built usin

Mohit 177 Jan 4, 2023
Code for CVPR2021 "Visualizing Adapted Knowledge in Domain Transfer". Visualization for domain adaptation. #explainable-ai

Visualizing Adapted Knowledge in Domain Transfer @inproceedings{hou2021visualizing, title={Visualizing Adapted Knowledge in Domain Transfer}, auth

Yunzhong Hou 80 Dec 25, 2022
Code for visualizing the loss landscape of neural nets

Visualizing the Loss Landscape of Neural Nets This repository contains the PyTorch code for the paper Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer

Tom Goldstein 2.2k Jan 9, 2023
Improving Contrastive Learning by Visualizing Feature Transformation, ICCV 2021 Oral

Improving Contrastive Learning by Visualizing Feature Transformation This project hosts the codes, models and visualization tools for the paper: Impro

Bingchen Zhao 83 Dec 15, 2022
📦 PyTorch based visualization package for generating layer-wise explanations for CNNs.

Explainable CNNs ?? Flexible visualization package for generating layer-wise explanations for CNNs. It is a common notion that a Deep Learning model i

Ashutosh Hathidara 183 Dec 15, 2022
Implementation of Analyzing and Improving the Image Quality of StyleGAN (StyleGAN 2) in PyTorch

Implementation of Analyzing and Improving the Image Quality of StyleGAN (StyleGAN 2) in PyTorch

Kim Seonghyeon 2.2k Jan 1, 2023