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
TANL: Structured Prediction as Translation between Augmented Natural Languages

TANL: Structured Prediction as Translation between Augmented Natural Languages Code for the paper "Structured Prediction as Translation between Augmen

98 Dec 15, 2022
Learning Representational Invariances for Data-Efficient Action Recognition

Learning Representational Invariances for Data-Efficient Action Recognition Official PyTorch implementation for Learning Representational Invariances

Virginia Tech Vision and Learning Lab 27 Nov 22, 2022
NHL 94 AI contests

nhl94-ai The end goals of this project is to: Train Models that play NHL 94 Support AI vs AI contests in NHL 94 Provide an improved AI opponent for NH

Mathieu Poliquin 2 Dec 06, 2021
Machine Learning From Scratch. Bare bones NumPy implementations of machine learning models and algorithms with a focus on accessibility. Aims to cover everything from linear regression to deep learning.

Machine Learning From Scratch About Python implementations of some of the fundamental Machine Learning models and algorithms from scratch. The purpose

Erik Linder-Norén 21.8k Jan 09, 2023
Pytorch implementation of paper "Learning Co-segmentation by Segment Swapping for Retrieval and Discovery"

SegSwap Pytorch implementation of paper "Learning Co-segmentation by Segment Swapping for Retrieval and Discovery" [PDF] [Project page] If our project

xshen 41 Dec 10, 2022
Code for BMVC2021 "MOS: A Low Latency and Lightweight Framework for Face Detection, Landmark Localization, and Head Pose Estimation"

MOS-Multi-Task-Face-Detect Introduction This repo is the official implementation of "MOS: A Low Latency and Lightweight Framework for Face Detection,

104 Dec 08, 2022
Reporting and Visualization for Hazardous Events

Reporting and Visualization for Hazardous Events

Jv Kyle Eclarin 2 Oct 03, 2021
PyTorch/TorchScript compiler for NVIDIA GPUs using TensorRT

PyTorch/TorchScript compiler for NVIDIA GPUs using TensorRT

NVIDIA Corporation 1.8k Dec 30, 2022
MazeRL is an application oriented Deep Reinforcement Learning (RL) framework

MazeRL is an application oriented Deep Reinforcement Learning (RL) framework, addressing real-world decision problems. Our vision is to cover the complete development life cycle of RL applications ra

EnliteAI GmbH 222 Dec 24, 2022
An optimization and data collection toolbox for convenient and fast prototyping of computationally expensive models.

An optimization and data collection toolbox for convenient and fast prototyping of computationally expensive models. Hyperactive: is very easy to lear

Simon Blanke 422 Jan 04, 2023
Data reduction pipeline for KOALA on the AAT.

KOALA KOALA, the Kilofibre Optical AAT Lenslet Array, is a wide-field, high efficiency, integral field unit used by the AAOmega spectrograph on the 3.

4 Sep 26, 2022
Differentiable scientific computing library

xitorch: differentiable scientific computing library xitorch is a PyTorch-based library of differentiable functions and functionals that can be widely

98 Dec 26, 2022
Mengzi Pretrained Models

中文 | English Mengzi 尽管预训练语言模型在 NLP 的各个领域里得到了广泛的应用,但是其高昂的时间和算力成本依然是一个亟需解决的问题。这要求我们在一定的算力约束下,研发出各项指标更优的模型。 我们的目标不是追求更大的模型规模,而是轻量级但更强大,同时对部署和工业落地更友好的模型。

Langboat 424 Jan 04, 2023
Official PyTorch Implementation of "Self-supervised Auxiliary Learning with Meta-paths for Heterogeneous Graphs". NeurIPS 2020.

Self-supervised Auxiliary Learning with Meta-paths for Heterogeneous Graphs This repository is the implementation of SELAR. Dasol Hwang* , Jinyoung Pa

MLV Lab (Machine Learning and Vision Lab at Korea University) 48 Nov 09, 2022
An implementation of RetinaNet in PyTorch.

RetinaNet An implementation of RetinaNet in PyTorch. Installation Training COCO 2017 Pascal VOC Custom Dataset Evaluation Todo Credits Installation In

Conner Vercellino 297 Jan 04, 2023
NaturalProofs: Mathematical Theorem Proving in Natural Language

NaturalProofs: Mathematical Theorem Proving in Natural Language NaturalProofs: Mathematical Theorem Proving in Natural Language Sean Welleck, Jiacheng

Sean Welleck 83 Jan 05, 2023
This is the official source code for SLATE. We provide the code for the model, the training code, and a dataset loader for the 3D Shapes dataset. This code is implemented in Pytorch.

SLATE This is the official source code for SLATE. We provide the code for the model, the training code and a dataset loader for the 3D Shapes dataset.

Gautam Singh 66 Dec 26, 2022
Roger Labbe 13k Dec 29, 2022
Black box hyperparameter optimization made easy.

BBopt BBopt aims to provide the easiest hyperparameter optimization you'll ever do. Think of BBopt like Keras (back when Theano was still a thing) for

Evan Hubinger 70 Nov 03, 2022
Code for Contrastive-Geometry Networks for Generalized 3D Pose Transfer

CGTransformer Code for our AAAI 2022 paper "Contrastive-Geometry Transformer network for Generalized 3D Pose Transfer" Contrastive-Geometry Transforme

18 Jun 28, 2022