ubc-solar-physics 0.1.11__tar.gz → 1.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ubc_solar_physics-1.0.5/.github/pull_request_template.md +1 -0
- ubc_solar_physics-1.0.5/.github/workflows/build_and_publish.yaml +110 -0
- ubc_solar_physics-1.0.5/.github/workflows/run_tests.yaml +43 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/.gitignore +4 -0
- ubc_solar_physics-1.0.5/.readthedocs.yaml +13 -0
- {ubc_solar_physics-0.1.11/ubc_solar_physics.egg-info → ubc_solar_physics-1.0.5}/PKG-INFO +67 -7
- ubc_solar_physics-1.0.5/README.md +65 -0
- ubc_solar_physics-1.0.5/docs/Makefile +20 -0
- ubc_solar_physics-1.0.5/docs/_generate_version.py +11 -0
- ubc_solar_physics-1.0.5/docs/docs_requirements.txt +53 -0
- ubc_solar_physics-1.0.5/docs/make.bat +35 -0
- ubc_solar_physics-1.0.5/docs/source/README.md +63 -0
- ubc_solar_physics-1.0.5/docs/source/api.rst +9 -0
- ubc_solar_physics-1.0.5/docs/source/conf.py +50 -0
- ubc_solar_physics-1.0.5/docs/source/environment/gis.rst +12 -0
- ubc_solar_physics-1.0.5/docs/source/environment/index.rst +9 -0
- ubc_solar_physics-1.0.5/docs/source/environment/meteorology.rst +17 -0
- ubc_solar_physics-1.0.5/docs/source/index.rst +20 -0
- ubc_solar_physics-1.0.5/docs/source/models/arrays.rst +12 -0
- ubc_solar_physics-1.0.5/docs/source/models/battery.rst +12 -0
- ubc_solar_physics-1.0.5/docs/source/models/index.rst +12 -0
- ubc_solar_physics-1.0.5/docs/source/models/lvs.rst +12 -0
- ubc_solar_physics-1.0.5/docs/source/models/motor.rst +12 -0
- ubc_solar_physics-1.0.5/docs/source/models/regen.rst +12 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/__init__.py +3 -3
- ubc_solar_physics-1.0.5/physics/_version.py +16 -0
- ubc_solar_physics-1.0.5/physics/environment/__init__.py +22 -0
- ubc_solar_physics-1.0.5/physics/environment/environment.rs +2 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/environment/gis/gis.py +29 -66
- ubc_solar_physics-1.0.5/physics/environment/meteorology/__init__.py +3 -0
- ubc_solar_physics-1.0.5/physics/environment/meteorology/base_meteorology.py +69 -0
- ubc_solar_physics-0.1.11/physics/environment/solar_calculations/OpenweatherSolarCalculations.py → ubc_solar_physics-1.0.5/physics/environment/meteorology/clouded_meteorology.py +132 -60
- ubc_solar_physics-1.0.5/physics/environment/meteorology/irradiant_meteorology.py +106 -0
- ubc_solar_physics-0.1.11/physics/environment/weather_forecasts/weather_forecasts.rs → ubc_solar_physics-1.0.5/physics/environment/meteorology/meteorology.rs +23 -1
- ubc_solar_physics-1.0.5/physics/environment/meteorology.rs +1 -0
- ubc_solar_physics-1.0.5/physics/environment.rs +2 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/lib.rs +24 -2
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/lvs/base_lvs.py +1 -1
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/motor/base_motor.py +1 -1
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/motor/basic_motor.py +1 -6
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/regen/base_regen.py +1 -1
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/pyproject.toml +16 -7
- ubc_solar_physics-1.0.5/tests/test_versioning.py +8 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5/ubc_solar_physics.egg-info}/PKG-INFO +67 -7
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/ubc_solar_physics.egg-info/SOURCES.txt +29 -15
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/ubc_solar_physics.egg-info/requires.txt +0 -3
- ubc_solar_physics-0.1.11/README.md +0 -2
- ubc_solar_physics-0.1.11/physics/environment/__init__.py +0 -33
- ubc_solar_physics-0.1.11/physics/environment/base_environment.py +0 -62
- ubc_solar_physics-0.1.11/physics/environment/environment.rs +0 -3
- ubc_solar_physics-0.1.11/physics/environment/openweather_environment.py +0 -18
- ubc_solar_physics-0.1.11/physics/environment/solar_calculations/SolcastSolarCalculations.py +0 -41
- ubc_solar_physics-0.1.11/physics/environment/solar_calculations/__init__.py +0 -9
- ubc_solar_physics-0.1.11/physics/environment/solar_calculations/base_solar_calculations.py +0 -9
- ubc_solar_physics-0.1.11/physics/environment/solar_calculations/solar_calculations.rs +0 -24
- ubc_solar_physics-0.1.11/physics/environment/solar_calculations.rs +0 -1
- ubc_solar_physics-0.1.11/physics/environment/solcast_environment.py +0 -18
- ubc_solar_physics-0.1.11/physics/environment/weather_forecasts/OpenWeatherForecast.py +0 -307
- ubc_solar_physics-0.1.11/physics/environment/weather_forecasts/SolcastForecasts.py +0 -235
- ubc_solar_physics-0.1.11/physics/environment/weather_forecasts/__init__.py +0 -9
- ubc_solar_physics-0.1.11/physics/environment/weather_forecasts/base_weather_forecasts.py +0 -56
- ubc_solar_physics-0.1.11/physics/environment/weather_forecasts.rs +0 -1
- ubc_solar_physics-0.1.11/physics/environment.rs +0 -3
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/Cargo.lock +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/Cargo.toml +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/LICENSE +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/environment/gis/__init__.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/environment/gis/base_gis.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/environment/gis/gis.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/environment/gis.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/environment/race.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/__init__.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/arrays/__init__.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/arrays/arrays.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/arrays/base_array.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/arrays/basic_array.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/arrays.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/battery/__init__.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/battery/base_battery.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/battery/basic_battery.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/battery/battery.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/battery.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/constants.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/lvs/__init__.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/lvs/basic_lvs.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/lvs/lvs.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/lvs.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/motor/__init__.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/motor/motor.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/motor.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/regen/__init__.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/regen/basic_regen.py +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/regen/regen.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models/regen.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/physics/models.rs +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/setup.cfg +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/ubc_solar_physics.egg-info/dependency_links.txt +0 -0
- {ubc_solar_physics-0.1.11 → ubc_solar_physics-1.0.5}/ubc_solar_physics.egg-info/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
# Physics Pull Request Template
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# This workflow is maintained according to STG Specification #2: Physics Publishing
|
2
|
+
|
3
|
+
name: Build and Publish Wheels
|
4
|
+
|
5
|
+
on:
|
6
|
+
# workflow_run: # THIS IS DISABLED BECAUSE IT PROBABLY DOESN'T WORK!
|
7
|
+
# workflows: ["Run Tests"]
|
8
|
+
# types:
|
9
|
+
# - completed
|
10
|
+
|
11
|
+
release: # This workflow will be triggered upon a release being published on GitHub
|
12
|
+
types:
|
13
|
+
- published
|
14
|
+
|
15
|
+
workflow_dispatch: # Enable manual dispatching of this workflow
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
build_sdist:
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- name: Checkout
|
23
|
+
uses: actions/checkout@v2
|
24
|
+
with:
|
25
|
+
fetch-depth: 0 # Required to fetch full history including tags, so setuptools_scm can determine version
|
26
|
+
|
27
|
+
- name: Setup Python
|
28
|
+
uses: actions/setup-python@v1
|
29
|
+
with:
|
30
|
+
python-version: '3.9'
|
31
|
+
|
32
|
+
- name: Install Dependencies
|
33
|
+
run: |
|
34
|
+
python -m pip install --upgrade pip
|
35
|
+
pip install build twine==5.1.1
|
36
|
+
|
37
|
+
- name: Build Source Distribution
|
38
|
+
run: |
|
39
|
+
python3 -m build --sdist
|
40
|
+
|
41
|
+
- name: Upload sdist to PyPI
|
42
|
+
run: twine upload dist/*
|
43
|
+
env:
|
44
|
+
TWINE_USERNAME: __token__
|
45
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
46
|
+
|
47
|
+
|
48
|
+
build_wheels:
|
49
|
+
runs-on: ${{ matrix.os }}
|
50
|
+
strategy:
|
51
|
+
fail-fast: false # Without this, one of the wheels failing for some reason would cancel all of the others.
|
52
|
+
matrix:
|
53
|
+
os: [macos-latest, windows-latest, ubuntu-latest] # Build wheels for macOS and Windows, and Linux.
|
54
|
+
|
55
|
+
steps:
|
56
|
+
- name: Checkout
|
57
|
+
uses: actions/checkout@v2
|
58
|
+
with:
|
59
|
+
fetch-depth: 0 # Required to fetch full history including tags, so setuptools_scm can determine version
|
60
|
+
|
61
|
+
- name: Set up Python
|
62
|
+
uses: actions/setup-python@v2
|
63
|
+
|
64
|
+
# We run `python -m setuptools_scm` and `git status` for debugging purposes, to verify that
|
65
|
+
# setuptools_scm is properly identifying the version based on the tag
|
66
|
+
- name: Install and prepare build dependencies
|
67
|
+
run: |
|
68
|
+
python -m pip install --upgrade pip
|
69
|
+
pip install setuptools_scm==8.1.0 twine==5.1.1 setuptools_rust cibuildwheel==2.20.0
|
70
|
+
python -m setuptools_scm
|
71
|
+
git status
|
72
|
+
|
73
|
+
# This gives us access to a Rust compiler
|
74
|
+
- name: Set up Rust
|
75
|
+
uses: actions-rs/toolchain@v1
|
76
|
+
with:
|
77
|
+
toolchain: stable
|
78
|
+
override: true
|
79
|
+
|
80
|
+
# We need to make all of possible architectures that we want wheels for available for Rust to compile for
|
81
|
+
- name: Add Rust targets
|
82
|
+
run: |
|
83
|
+
rustup target add x86_64-apple-darwin || echo "x86_64-apple-darwin target already added"
|
84
|
+
rustup target add aarch64-apple-darwin || echo "aarch64-apple-darwin target already added"
|
85
|
+
rustup target add x86_64-unknown-linux-gnu || echo "Linux target already added"
|
86
|
+
rustup target add x86_64-pc-windows-msvc || echo "Windows target already added"
|
87
|
+
shell: bash
|
88
|
+
|
89
|
+
# Now, we use cibuildwheel to build all the wheels that we want for the platforms we defined in matrix.os
|
90
|
+
# It will build wheels for Python versions that are allowed based on our pyproject.toml
|
91
|
+
- name: Build wheels
|
92
|
+
run: cibuildwheel --output-dir dist
|
93
|
+
env:
|
94
|
+
CIBW_ARCHS_MACOS: "x86_64 arm64" # Make sure both x86_64 and arm64 wheels are built for macOS
|
95
|
+
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"'
|
96
|
+
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
|
97
|
+
CIBW_BEFORE_BUILD: >
|
98
|
+
pip install -U setuptools-rust &&
|
99
|
+
rustup default nightly &&
|
100
|
+
rustup show
|
101
|
+
CIBW_BEFORE_BUILD_LINUX: >
|
102
|
+
pip install -U setuptools-rust &&
|
103
|
+
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y &&
|
104
|
+
rustup show
|
105
|
+
|
106
|
+
- name: Upload wheels to PyPI
|
107
|
+
run: twine upload dist/*
|
108
|
+
env:
|
109
|
+
TWINE_USERNAME: __token__
|
110
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# This workflow is maintained according to STG Specification #2: Physics Publishing
|
2
|
+
|
3
|
+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
4
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
5
|
+
|
6
|
+
name: Run Tests
|
7
|
+
|
8
|
+
on: [push]
|
9
|
+
|
10
|
+
permissions:
|
11
|
+
contents: read
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
build:
|
15
|
+
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v4
|
20
|
+
- name: Set up Python 3.10
|
21
|
+
uses: actions/setup-python@v3
|
22
|
+
with:
|
23
|
+
python-version: "3.10"
|
24
|
+
|
25
|
+
- name: Set up Rust
|
26
|
+
uses: actions-rs/toolchain@v1
|
27
|
+
with:
|
28
|
+
toolchain: stable
|
29
|
+
override: true
|
30
|
+
|
31
|
+
- name: Add Rust targets
|
32
|
+
run: |
|
33
|
+
rustup target add x86_64-unknown-linux-gnu || echo "Linux target already added"
|
34
|
+
|
35
|
+
- name: Install dependencies
|
36
|
+
run: |
|
37
|
+
python -m pip install --upgrade pip
|
38
|
+
pip install setuptools_scm setuptools_rust pytest==8.3.3
|
39
|
+
pip install .
|
40
|
+
|
41
|
+
- name: Test with pytest
|
42
|
+
run: |
|
43
|
+
pytest
|
@@ -20,6 +20,7 @@ parts/
|
|
20
20
|
sdist/
|
21
21
|
var/
|
22
22
|
wheels/
|
23
|
+
wheelhouse/
|
23
24
|
share/python-wheels/
|
24
25
|
*.egg-info/
|
25
26
|
.installed.cfg
|
@@ -160,3 +161,6 @@ cython_debug/
|
|
160
161
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
161
162
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
162
163
|
.idea/
|
164
|
+
|
165
|
+
# Setuptools_scm
|
166
|
+
physics/_version.py
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ubc-solar-physics
|
3
|
-
Version: 0.
|
3
|
+
Version: 1.0.5
|
4
4
|
Summary: UBC Solar's Simulation Environment
|
5
5
|
Author: Fisher Xue, Mihir Nimgade, Chris Chang, David Widjaja, Justin Hua, Ilya Veksler, Renu Rajamagesh, Ritchie Xia, Erik Langille, Chris Aung, Nicolas Ric, Ishaan Trivedi, Jason Liang, Felix Toft, Mack Wilson, Jonah Lee, Tamzeed Quazi, Joshua Riefman
|
6
6
|
Author-email: UBC Solar <strategy@ubcsolar.com>
|
@@ -30,7 +30,7 @@ License: MIT License
|
|
30
30
|
|
31
31
|
Project-URL: Homepage, https://ubcsolar.com
|
32
32
|
Project-URL: Repository, https://github.com/UBC-Solar/physics
|
33
|
-
Project-URL: Documentation, https://
|
33
|
+
Project-URL: Documentation, https://ubc-solar-physics.readthedocs.io/en/latest/
|
34
34
|
Keywords: car,simulation,solar
|
35
35
|
Classifier: Programming Language :: Python :: 3
|
36
36
|
Classifier: Programming Language :: Rust
|
@@ -43,7 +43,6 @@ Requires-Dist: backports.tarfile==1.2.0
|
|
43
43
|
Requires-Dist: certifi==2024.7.4
|
44
44
|
Requires-Dist: charset-normalizer==3.3.2
|
45
45
|
Requires-Dist: dill==0.3.8
|
46
|
-
Requires-Dist: docutils==0.21.2
|
47
46
|
Requires-Dist: haversine==2.8.1
|
48
47
|
Requires-Dist: idna==3.7
|
49
48
|
Requires-Dist: importlib_metadata==8.2.0
|
@@ -53,7 +52,6 @@ Requires-Dist: jaraco.functools==4.0.2
|
|
53
52
|
Requires-Dist: keyring==25.3.0
|
54
53
|
Requires-Dist: llvmlite==0.43.0
|
55
54
|
Requires-Dist: markdown-it-py==3.0.0
|
56
|
-
Requires-Dist: maturin==1.7.0
|
57
55
|
Requires-Dist: mdurl==0.1.2
|
58
56
|
Requires-Dist: more-itertools==10.4.0
|
59
57
|
Requires-Dist: nh3==0.2.18
|
@@ -67,9 +65,71 @@ Requires-Dist: requests-toolbelt==1.0.0
|
|
67
65
|
Requires-Dist: rfc3986==2.0.0
|
68
66
|
Requires-Dist: rich==13.7.1
|
69
67
|
Requires-Dist: tqdm==4.66.5
|
70
|
-
Requires-Dist: twine==5.1.1
|
71
68
|
Requires-Dist: urllib3==2.2.2
|
72
69
|
Requires-Dist: zipp==3.20.0
|
73
70
|
|
74
|
-
#
|
75
|
-
|
71
|
+
# UBC Solar Physics
|
72
|
+
|
73
|
+
<!-- marker-index-start -->
|
74
|
+
|
75
|
+
[](https://ubc-solar-physics.readthedocs.io/en/latest/?badge=latest)
|
76
|
+
|
77
|
+
UBC Solar's physics and environment models for simulating our groundbreaking solar cars.
|
78
|
+
|
79
|
+
The API is currently unstable, and backwards compatibility may not be maintained.
|
80
|
+
|
81
|
+
## Requirements
|
82
|
+
|
83
|
+
Versions indicated are recommended
|
84
|
+
|
85
|
+
* Git [^1]
|
86
|
+
* Python >=3.9 [^2]
|
87
|
+
* Rustc >=1.79.0 [^3]
|
88
|
+
* Cargo >=1.79.0 [^4]
|
89
|
+
|
90
|
+
## Installation
|
91
|
+
|
92
|
+
First, clone this repository.
|
93
|
+
|
94
|
+
```bash
|
95
|
+
git clone https://github.com/UBC-Solar/physics.git
|
96
|
+
```
|
97
|
+
Then, create and activate a virtual environment.
|
98
|
+
Next, install dependencies in editable mode.
|
99
|
+
|
100
|
+
```bash
|
101
|
+
pip3 install -e .
|
102
|
+
```
|
103
|
+
|
104
|
+
## Getting Started
|
105
|
+
|
106
|
+
Example of calculating solar arrays produced energy
|
107
|
+
|
108
|
+
```python
|
109
|
+
from physics.models.arrays import BasicArray
|
110
|
+
import numpy as np
|
111
|
+
|
112
|
+
efficiency = 0.25 # 25.0% efficient
|
113
|
+
panel_size = 4.0 # 4.0m^2 of panels
|
114
|
+
tick = 1.0 # 1.0s interval
|
115
|
+
|
116
|
+
arrays = BasicArray(panel_efficiency=efficiency, panel_size=panel_size)
|
117
|
+
|
118
|
+
irradiance = np.full([5], 400.0) # 10 seconds of 400.0W/m^2 irradiance
|
119
|
+
|
120
|
+
solar_power_produced = arrays.calculate_produced_energy(solar_irradiance=irradiance, tick=tick)
|
121
|
+
|
122
|
+
assert np.array_equal(solar_power_produced, np.array([400.0, 400.0, 400.0, 400.0, 400.0]))
|
123
|
+
```
|
124
|
+
|
125
|
+
## Appendix
|
126
|
+
|
127
|
+
[^1]: use `git --version` to verify version
|
128
|
+
|
129
|
+
[^2]: use `python3 --version` to verify version
|
130
|
+
|
131
|
+
[^3]: use `rustc --version` to verify version
|
132
|
+
|
133
|
+
[^4]: use `cargo --version` to verify version
|
134
|
+
|
135
|
+
<!-- marker-index-end -->
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# UBC Solar Physics
|
2
|
+
|
3
|
+
<!-- marker-index-start -->
|
4
|
+
|
5
|
+
[](https://ubc-solar-physics.readthedocs.io/en/latest/?badge=latest)
|
6
|
+
|
7
|
+
UBC Solar's physics and environment models for simulating our groundbreaking solar cars.
|
8
|
+
|
9
|
+
The API is currently unstable, and backwards compatibility may not be maintained.
|
10
|
+
|
11
|
+
## Requirements
|
12
|
+
|
13
|
+
Versions indicated are recommended
|
14
|
+
|
15
|
+
* Git [^1]
|
16
|
+
* Python >=3.9 [^2]
|
17
|
+
* Rustc >=1.79.0 [^3]
|
18
|
+
* Cargo >=1.79.0 [^4]
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
First, clone this repository.
|
23
|
+
|
24
|
+
```bash
|
25
|
+
git clone https://github.com/UBC-Solar/physics.git
|
26
|
+
```
|
27
|
+
Then, create and activate a virtual environment.
|
28
|
+
Next, install dependencies in editable mode.
|
29
|
+
|
30
|
+
```bash
|
31
|
+
pip3 install -e .
|
32
|
+
```
|
33
|
+
|
34
|
+
## Getting Started
|
35
|
+
|
36
|
+
Example of calculating solar arrays produced energy
|
37
|
+
|
38
|
+
```python
|
39
|
+
from physics.models.arrays import BasicArray
|
40
|
+
import numpy as np
|
41
|
+
|
42
|
+
efficiency = 0.25 # 25.0% efficient
|
43
|
+
panel_size = 4.0 # 4.0m^2 of panels
|
44
|
+
tick = 1.0 # 1.0s interval
|
45
|
+
|
46
|
+
arrays = BasicArray(panel_efficiency=efficiency, panel_size=panel_size)
|
47
|
+
|
48
|
+
irradiance = np.full([5], 400.0) # 10 seconds of 400.0W/m^2 irradiance
|
49
|
+
|
50
|
+
solar_power_produced = arrays.calculate_produced_energy(solar_irradiance=irradiance, tick=tick)
|
51
|
+
|
52
|
+
assert np.array_equal(solar_power_produced, np.array([400.0, 400.0, 400.0, 400.0, 400.0]))
|
53
|
+
```
|
54
|
+
|
55
|
+
## Appendix
|
56
|
+
|
57
|
+
[^1]: use `git --version` to verify version
|
58
|
+
|
59
|
+
[^2]: use `python3 --version` to verify version
|
60
|
+
|
61
|
+
[^3]: use `rustc --version` to verify version
|
62
|
+
|
63
|
+
[^4]: use `cargo --version` to verify version
|
64
|
+
|
65
|
+
<!-- marker-index-end -->
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
2
|
+
#
|
3
|
+
|
4
|
+
# You can set these variables from the command line, and also
|
5
|
+
# from the environment for the first two.
|
6
|
+
SPHINXOPTS ?=
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
8
|
+
SOURCEDIR = source
|
9
|
+
BUILDDIR = build
|
10
|
+
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
12
|
+
help:
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
14
|
+
|
15
|
+
.PHONY: help Makefile
|
16
|
+
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
19
|
+
%: Makefile
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from setuptools_scm import get_version
|
2
|
+
from pathlib import Path
|
3
|
+
|
4
|
+
# Get the version from setuptools_scm
|
5
|
+
version = get_version()
|
6
|
+
|
7
|
+
# Path to the version file specified in your pyproject.toml
|
8
|
+
version_file = Path('physics/_version.py')
|
9
|
+
|
10
|
+
# Write the version into _version.py
|
11
|
+
version_file.write_text(f"__version__ = '{version}'\n")
|
@@ -0,0 +1,53 @@
|
|
1
|
+
alabaster
|
2
|
+
babel
|
3
|
+
backports.tarfile
|
4
|
+
build
|
5
|
+
certifi
|
6
|
+
charset-normalizer
|
7
|
+
dill
|
8
|
+
docutils
|
9
|
+
haversine
|
10
|
+
idna
|
11
|
+
imagesize
|
12
|
+
importlib_metadata
|
13
|
+
jaraco.classes
|
14
|
+
jaraco.context
|
15
|
+
jaraco.functools
|
16
|
+
Jinja2
|
17
|
+
keyring
|
18
|
+
llvmlite
|
19
|
+
markdown-it-py
|
20
|
+
MarkupSafe
|
21
|
+
mdit-py-plugins
|
22
|
+
mdurl
|
23
|
+
more-itertools
|
24
|
+
myst-parser
|
25
|
+
nh3
|
26
|
+
numba
|
27
|
+
numpy
|
28
|
+
packaging
|
29
|
+
pkginfo
|
30
|
+
Pygments
|
31
|
+
pyproject_hooks
|
32
|
+
PyYAML
|
33
|
+
readme_renderer
|
34
|
+
requests
|
35
|
+
requests-toolbelt
|
36
|
+
rfc3986
|
37
|
+
rich
|
38
|
+
snowballstemmer
|
39
|
+
Sphinx
|
40
|
+
sphinx-autodoc-typehints
|
41
|
+
sphinx-rtd-theme==2.0.0
|
42
|
+
sphinxcontrib-applehelp
|
43
|
+
sphinxcontrib-devhelp
|
44
|
+
sphinxcontrib-htmlhelp
|
45
|
+
sphinxcontrib-jquery
|
46
|
+
sphinxcontrib-jsmath
|
47
|
+
sphinxcontrib-qthelp
|
48
|
+
sphinxcontrib-serializinghtml
|
49
|
+
tqdm
|
50
|
+
urllib3
|
51
|
+
zipp
|
52
|
+
setuptools_scm
|
53
|
+
pydata-sphinx-theme==0.15.4
|
@@ -0,0 +1,35 @@
|
|
1
|
+
@ECHO OFF
|
2
|
+
|
3
|
+
pushd %~dp0
|
4
|
+
|
5
|
+
REM Command file for Sphinx documentation
|
6
|
+
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
8
|
+
set SPHINXBUILD=sphinx-build
|
9
|
+
)
|
10
|
+
set SOURCEDIR=source
|
11
|
+
set BUILDDIR=build
|
12
|
+
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
14
|
+
if errorlevel 9009 (
|
15
|
+
echo.
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
20
|
+
echo.
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
22
|
+
echo.https://www.sphinx-doc.org/
|
23
|
+
exit /b 1
|
24
|
+
)
|
25
|
+
|
26
|
+
if "%1" == "" goto help
|
27
|
+
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
29
|
+
goto end
|
30
|
+
|
31
|
+
:help
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
33
|
+
|
34
|
+
:end
|
35
|
+
popd
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# UBC Solar Physics
|
2
|
+
|
3
|
+
<!-- marker-index-start -->
|
4
|
+
|
5
|
+
UBC Solar's physics and environment models for simulating our groundbreaking solar cars.
|
6
|
+
|
7
|
+
The API is currently unstable, and backwards compatibility may not be maintained.
|
8
|
+
|
9
|
+
## Requirements
|
10
|
+
|
11
|
+
Versions indicated are recommended
|
12
|
+
|
13
|
+
* Git [^1]
|
14
|
+
* Python >=3.9 [^2]
|
15
|
+
* Rustc >=1.79.0 [^3]
|
16
|
+
* Cargo >=1.79.0 [^4]
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
First, clone this repository.
|
21
|
+
|
22
|
+
```bash
|
23
|
+
git clone https://github.com/UBC-Solar/physics.git
|
24
|
+
```
|
25
|
+
Then, create and activate a virtual environment.
|
26
|
+
Next, install dependencies in editable mode.
|
27
|
+
|
28
|
+
```bash
|
29
|
+
pip3 install -e .
|
30
|
+
```
|
31
|
+
|
32
|
+
## Getting Started
|
33
|
+
|
34
|
+
Example of calculating solar arrays produced energy
|
35
|
+
|
36
|
+
```python
|
37
|
+
from physics.models.arrays import BasicArray
|
38
|
+
import numpy as np
|
39
|
+
|
40
|
+
efficiency = 0.25 # 25.0% efficient
|
41
|
+
panel_size = 4.0 # 4.0m^2 of panels
|
42
|
+
tick = 1.0 # 1.0s interval
|
43
|
+
|
44
|
+
arrays = BasicArray(panel_efficiency=efficiency, panel_size=panel_size)
|
45
|
+
|
46
|
+
irradiance = np.full([5], 400.0) # 10 seconds of 400.0W/m^2 irradiance
|
47
|
+
|
48
|
+
solar_power_produced = arrays.calculate_produced_energy(solar_irradiance=irradiance, tick=tick)
|
49
|
+
|
50
|
+
assert np.array_equal(solar_power_produced, np.array([400.0, 400.0, 400.0, 400.0, 400.0]))
|
51
|
+
```
|
52
|
+
|
53
|
+
## Appendix
|
54
|
+
|
55
|
+
[^1]: use `git --version` to verify version
|
56
|
+
|
57
|
+
[^2]: use `python3 --version` to verify version
|
58
|
+
|
59
|
+
[^3]: use `rustc --version` to verify version
|
60
|
+
|
61
|
+
[^4]: use `cargo --version` to verify version
|
62
|
+
|
63
|
+
<!-- marker-index-end -->
|
@@ -0,0 +1,50 @@
|
|
1
|
+
from setuptools_scm import get_version
|
2
|
+
from pathlib import Path
|
3
|
+
import importlib
|
4
|
+
|
5
|
+
# Generate the version file
|
6
|
+
version = get_version()
|
7
|
+
version_file = Path('physics/_version.py')
|
8
|
+
version_file.write_text(f"__version__ = '{version}'\n")
|
9
|
+
|
10
|
+
# Dynamically import the version
|
11
|
+
importlib.invalidate_caches()
|
12
|
+
physics_module = importlib.import_module("physics")
|
13
|
+
__version__ = physics_module.__version__
|
14
|
+
|
15
|
+
# Configuration file for the Sphinx documentation builder.
|
16
|
+
#
|
17
|
+
# For the full list of built-in configuration values, see the documentation:
|
18
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
19
|
+
|
20
|
+
# -- Project information -----------------------------------------------------
|
21
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
22
|
+
|
23
|
+
project = 'UBC Solar Physics'
|
24
|
+
copyright = '2024, UBC Solar'
|
25
|
+
author = 'Joshua Riefman'
|
26
|
+
release = __version__
|
27
|
+
|
28
|
+
# -- General configuration ---------------------------------------------------
|
29
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
30
|
+
|
31
|
+
extensions = [
|
32
|
+
'sphinx.ext.autodoc',
|
33
|
+
'sphinx.ext.napoleon', # For Google/NumPy style docstrings
|
34
|
+
'sphinx.ext.autosummary', # To generate summary tables for modules
|
35
|
+
'myst_parser', # For Markdown support if needed
|
36
|
+
]
|
37
|
+
|
38
|
+
html_theme = "pydata_sphinx_theme"
|
39
|
+
|
40
|
+
autodoc_mock_imports = ['core']
|
41
|
+
source_suffix = ['.rst', '.md']
|
42
|
+
|
43
|
+
templates_path = ['_templates']
|
44
|
+
exclude_patterns = []
|
45
|
+
autosummary_generate = True
|
46
|
+
|
47
|
+
# -- Options for HTML output -------------------------------------------------
|
48
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
49
|
+
|
50
|
+
html_static_path = ['_static']
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Meteorology
|
2
|
+
===========
|
3
|
+
|
4
|
+
.. autoclass:: physics.environment.meteorology.BaseMeteorology
|
5
|
+
:members:
|
6
|
+
:undoc-members:
|
7
|
+
:show-inheritance:
|
8
|
+
|
9
|
+
.. autoclass:: physics.environment.meteorology.IrradiantMeteorology
|
10
|
+
:members:
|
11
|
+
:undoc-members:
|
12
|
+
:show-inheritance:
|
13
|
+
|
14
|
+
.. autoclass:: physics.environment.meteorology.CloudedMeteorology
|
15
|
+
:members:
|
16
|
+
:undoc-members:
|
17
|
+
:show-inheritance:
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.. physics documentation master file, created by
|
2
|
+
sphinx-quickstart on Mon Aug 19 00:13:44 2024.
|
3
|
+
You can adapt this file completely to your liking, but it should at least
|
4
|
+
contain the root `toctree` directive.
|
5
|
+
|
6
|
+
UBC Solar Simulation Documentation
|
7
|
+
=====================
|
8
|
+
|
9
|
+
|
10
|
+
.. toctree::
|
11
|
+
:maxdepth: 3
|
12
|
+
:caption: Contents:
|
13
|
+
|
14
|
+
README.md
|
15
|
+
api
|
16
|
+
|
17
|
+
.. include:: ../../README.md
|
18
|
+
:parser: myst_parser.sphinx_
|
19
|
+
:start-after: <!-- marker-index-start -->
|
20
|
+
:end-before: <!-- marker-index-end -->
|