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
Does MAML Only Work via Feature Re-use? A Data Set Centric Perspective

Does-MAML-Only-Work-via-Feature-Re-use-A-Data-Set-Centric-Perspective Does MAML Only Work via Feature Re-use? A Data Set Centric Perspective Installin

2 Nov 07, 2022
A Novel Plug-in Module for Fine-grained Visual Classification

Pytorch implementation for A Novel Plug-in Module for Fine-Grained Visual Classification. fine-grained visual classification task.

ChouPoYung 109 Dec 20, 2022
Back to the Feature: Learning Robust Camera Localization from Pixels to Pose (CVPR 2021)

Back to the Feature with PixLoc We introduce PixLoc, a neural network for end-to-end learning of camera localization from an image and a 3D model via

Computer Vision and Geometry Lab 610 Jan 05, 2023
The fastai book, published as Jupyter Notebooks

English / Spanish / Korean / Chinese / Bengali / Indonesian The fastai book These notebooks cover an introduction to deep learning, fastai, and PyTorc

fast.ai 17k Jan 07, 2023
The official PyTorch code implementation of "Human Trajectory Prediction via Counterfactual Analysis" in ICCV 2021.

Human Trajectory Prediction via Counterfactual Analysis (CausalHTP) The official PyTorch code implementation of "Human Trajectory Prediction via Count

46 Dec 03, 2022
Motion and Shape Capture from Sparse Markers

MoSh++ This repository contains the official chumpy implementation of mocap body solver used for AMASS: AMASS: Archive of Motion Capture as Surface Sh

Nima Ghorbani 135 Dec 23, 2022
Predicting lncRNA–protein interactions based on graph autoencoders and collaborative training

Predicting lncRNA–protein interactions based on graph autoencoders and collaborative training Code for our paper "Predicting lncRNA–protein interactio

zhanglabNKU 1 Nov 29, 2022
Auto White-Balance Correction for Mixed-Illuminant Scenes

Auto White-Balance Correction for Mixed-Illuminant Scenes Mahmoud Afifi, Marcus A. Brubaker, and Michael S. Brown York University Video Reference code

Mahmoud Afifi 47 Nov 26, 2022
Multi-Agent Reinforcement Learning (MARL) method to learn scalable control polices for multi-agent target tracking.

scalableMARL Scalable Reinforcement Learning Policies for Multi-Agent Control CD. Hsu, H. Jeong, GJ. Pappas, P. Chaudhari. "Scalable Reinforcement Lea

Christopher Hsu 17 Nov 17, 2022
TorchDistiller - a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

This project is a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and i

yifan liu 147 Dec 03, 2022
(ImageNet pretrained models) The official pytorch implemention of the TPAMI paper "Res2Net: A New Multi-scale Backbone Architecture"

Res2Net The official pytorch implemention of the paper "Res2Net: A New Multi-scale Backbone Architecture" Our paper is accepted by IEEE Transactions o

Res2Net Applications 928 Dec 29, 2022
A simple and lightweight genetic algorithm for optimization of any machine learning model

geneticml This package contains a simple and lightweight genetic algorithm for optimization of any machine learning model. Installation Use pip to ins

Allan Barcelos 8 Aug 10, 2022
The codes I made while I practiced various TensorFlow examples

TensorFlow_Exercises The codes I made while I practiced various TensorFlow examples About the codes I didn't create these codes by myself, but re-crea

Terry Taewoong Um 614 Dec 08, 2022
Automatic differentiation with weighted finite-state transducers.

GTN: Automatic Differentiation with WFSTs Quickstart | Installation | Documentation What is GTN? GTN is a framework for automatic differentiation with

100 Dec 29, 2022
Optimus: the first large-scale pre-trained VAE language model

Optimus: the first pre-trained Big VAE language model This repository contains source code necessary to reproduce the results presented in the EMNLP 2

314 Dec 19, 2022
robomimic: A Modular Framework for Robot Learning from Demonstration

robomimic [Homepage]   [Documentation]   [Study Paper]   [Study Website]   [ARISE Initiative] Latest Updates [08/09/2021] v0.1.0: Initial code and pap

ARISE Initiative 178 Jan 05, 2023
Pytorch implementation of "Training a 85.4% Top-1 Accuracy Vision Transformer with 56M Parameters on ImageNet"

Token Labeling: Training an 85.4% Top-1 Accuracy Vision Transformer with 56M Parameters on ImageNet (arxiv) This is a Pytorch implementation of our te

蒋子航 383 Dec 27, 2022
PaddleViT: State-of-the-art Visual Transformer and MLP Models for PaddlePaddle 2.0+

PaddlePaddle Vision Transformers State-of-the-art Visual Transformer and MLP Models for PaddlePaddle 🤖 PaddlePaddle Visual Transformers (PaddleViT or

1k Dec 28, 2022
Code for paper ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization in the Loop.

Who Left the Dogs Out? Evaluation and demo code for our ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization

Benjamin Biggs 29 Dec 28, 2022
ViSER: Video-Specific Surface Embeddings for Articulated 3D Shape Reconstruction

ViSER: Video-Specific Surface Embeddings for Articulated 3D Shape Reconstruction. NeurIPS 2021.

Gengshan Yang 59 Nov 25, 2022