Light pre-calculation based on real data (urban data and sun position) with 3DTiles. pySunlight wrap the Sunlight project using SWIG for its calculations to get the performance of C++ in Python and use py3DTilers, a Python library, to read geospatial datas. Sunlight is present in a git submodule to ensure correct versions between the two projects.
pySunlight is one repository of the Sunlight project, including :
- Python 3.9, only version supported by our dependency with py3DTilers (a 3DTiles parsers).
- PostgreSQL / PostGIS, as it's required by py3DTilers even if pySunlight doesn't use any database functionality.
- Same CMake version as Sunlight 3.27.
- SWIG 4.0.
-
Install python 3.9.
apt-get install python3.9 python3.9-dev
-
Install libpq, the client interface with PostgreSQL in C (required by psycopg2 within py3dtilers).
apt-get install -y libpq-dev
-
Clone the repository.
git clone --recursive https://github.com/VCityTeam/pySunlight.git && cd pySunlight/
-
Create your virtual environment.
python3.9 -m venv venv
-
Enable your virtual environment.
. venv/bin/activate
-
Install all prerequisites.
pip install -e .
brew install python@3.9
brew install swig # Assert you got version 4.X with "swig -version"
Additionnaly, and because py3dTilers requires it (although pySunlight doesn't),
brew install postgresql@14
brew install postgis
-
Clone the repository.
git clone --recursive https://github.com/VCityTeam/pySunlight.git && cd pySunlight/
-
Create your virtual environment.
python3.9 -m venv venv # Because venv doesn't seem to consider linking to the ad-hoc # version of python-config that is required by swig within the # cmake context at build time ln -s /usr/local/bin/python3.9-config venv/bin/python-config
-
Enable your virtual environment.
. venv/bin/activate
-
Install all prerequisites.
pip install -e .
-
Download and install python 3.9 from the official website.
-
Clone the repository.
git clone --recursive https://github.com/VCityTeam/pySunlight.git && cd pySunlight/
-
Create your virtual environment.
python3.9 -m venv venv
-
Enable your virtual environment.
. venv/Scripts/activate
-
Install all prerequisites.
pip install -e .
-
You can create 3DTiles Sunlight using arguments, we are compatile with Tileset Reader arguments :
python3.9 src/main.py -i ./datas/testing/b3dm_tileset --output_dir junk --start-date 403224 --end-date 403248
The result will be the computation of sunlight between two dates and it will be exported in the output directory given.
Here is a full list of all options available :
Arguments | Description | Example |
---|---|---|
--file_path, -i | Input directory containing 3D Tiles | -i "C:\Sunlight\Sample-Datas\Lyon-1_2015" |
--output_dir, -o | Export directory of Sunlight computation | -o "C:\Sunlight\Export\Lyon-1_2015" |
--start-date, -s | Start date of sunlight computation | -s 403224 |
--end-date, -e | End date of sunlight computation | -e 403248 |
--with-aggregate | Add aggregate to 3DTiles export, heavely impact performance | --with-aggregate |
--log-level, -log | Provide logging level depending on logging module | -log DEBUG |
-
Install the additional dev requirements.
pip install -e .[dev]
-
To check if the code follows the coding style, run
flake8
flake8 .
-
To check the program, run at the root folder :
pytest tests
-
Configure your IDE with autopep8 formatting extension.
In VS Code, follow this tutorial by replacing prettier with autopep8.
Here is the pipeline we follow for pySunlight :
pySunlight (repo)
├── datas # Datas use for testing
├── docs # Documentations (original charts...)
├── src # Source code
├── Sunlight # Sunlight repository as git submodule
├── tests # Unit tests
├── .flake8 # Flake8 Configuration
├── .gitignore # Files/folders ignored by Git
├── .gitmodules # Sunlight module commit version
├── CMakeLists.txt # CMake file to create a crossplatform software
├── README.md
├── pySunlight.i # SWIG interface file to expose Sunlight in python
├── setup.py # Install python requirements
Distributed under the LGPL-2.1 License. See LICENSE
and Libraries Licenses
for more information.
- Wesley Petit - Website - wesley.petit.lemoine@gmail.com