ubc-solar-physics 0.1.1__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.
Files changed (101) hide show
  1. ubc_solar_physics-1.0.5/.github/pull_request_template.md +1 -0
  2. ubc_solar_physics-1.0.5/.github/workflows/build_and_publish.yaml +110 -0
  3. ubc_solar_physics-1.0.5/.github/workflows/run_tests.yaml +43 -0
  4. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/.gitignore +4 -0
  5. ubc_solar_physics-1.0.5/.readthedocs.yaml +13 -0
  6. ubc_solar_physics-1.0.5/PKG-INFO +135 -0
  7. ubc_solar_physics-1.0.5/README.md +65 -0
  8. ubc_solar_physics-1.0.5/docs/Makefile +20 -0
  9. ubc_solar_physics-1.0.5/docs/_generate_version.py +11 -0
  10. ubc_solar_physics-1.0.5/docs/docs_requirements.txt +53 -0
  11. ubc_solar_physics-1.0.5/docs/make.bat +35 -0
  12. ubc_solar_physics-1.0.5/docs/source/README.md +63 -0
  13. ubc_solar_physics-1.0.5/docs/source/api.rst +9 -0
  14. ubc_solar_physics-1.0.5/docs/source/conf.py +50 -0
  15. ubc_solar_physics-1.0.5/docs/source/environment/gis.rst +12 -0
  16. ubc_solar_physics-1.0.5/docs/source/environment/index.rst +9 -0
  17. ubc_solar_physics-1.0.5/docs/source/environment/meteorology.rst +17 -0
  18. ubc_solar_physics-1.0.5/docs/source/index.rst +20 -0
  19. ubc_solar_physics-1.0.5/docs/source/models/arrays.rst +12 -0
  20. ubc_solar_physics-1.0.5/docs/source/models/battery.rst +12 -0
  21. ubc_solar_physics-1.0.5/docs/source/models/index.rst +12 -0
  22. ubc_solar_physics-1.0.5/docs/source/models/lvs.rst +12 -0
  23. ubc_solar_physics-1.0.5/docs/source/models/motor.rst +12 -0
  24. ubc_solar_physics-1.0.5/docs/source/models/regen.rst +12 -0
  25. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/__init__.py +3 -3
  26. ubc_solar_physics-1.0.5/physics/_version.py +16 -0
  27. ubc_solar_physics-1.0.5/physics/environment/__init__.py +22 -0
  28. ubc_solar_physics-1.0.5/physics/environment/environment.rs +2 -0
  29. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/environment/gis/gis.py +29 -66
  30. ubc_solar_physics-1.0.5/physics/environment/meteorology/__init__.py +3 -0
  31. ubc_solar_physics-1.0.5/physics/environment/meteorology/base_meteorology.py +69 -0
  32. ubc_solar_physics-0.1.1/physics/environment/solar_calculations/OpenweatherSolarCalculations.py → ubc_solar_physics-1.0.5/physics/environment/meteorology/clouded_meteorology.py +132 -60
  33. ubc_solar_physics-1.0.5/physics/environment/meteorology/irradiant_meteorology.py +106 -0
  34. ubc_solar_physics-0.1.1/physics/environment/weather_forecasts/weather_forecasts.rs → ubc_solar_physics-1.0.5/physics/environment/meteorology/meteorology.rs +23 -1
  35. ubc_solar_physics-1.0.5/physics/environment/meteorology.rs +1 -0
  36. ubc_solar_physics-1.0.5/physics/environment.rs +2 -0
  37. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/lib.rs +24 -2
  38. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/lvs/base_lvs.py +1 -1
  39. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/motor/base_motor.py +1 -1
  40. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/motor/basic_motor.py +1 -6
  41. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/regen/base_regen.py +1 -1
  42. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/pyproject.toml +44 -20
  43. ubc_solar_physics-1.0.5/tests/test_versioning.py +8 -0
  44. ubc_solar_physics-1.0.5/ubc_solar_physics.egg-info/PKG-INFO +135 -0
  45. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/ubc_solar_physics.egg-info/SOURCES.txt +30 -16
  46. ubc_solar_physics-1.0.5/ubc_solar_physics.egg-info/requires.txt +28 -0
  47. ubc_solar_physics-0.1.1/PKG-INFO +0 -44
  48. ubc_solar_physics-0.1.1/README.md +0 -2
  49. ubc_solar_physics-0.1.1/physics/environment/__init__.py +0 -33
  50. ubc_solar_physics-0.1.1/physics/environment/base_environment.py +0 -62
  51. ubc_solar_physics-0.1.1/physics/environment/environment.rs +0 -3
  52. ubc_solar_physics-0.1.1/physics/environment/openweather_environment.py +0 -18
  53. ubc_solar_physics-0.1.1/physics/environment/solar_calculations/SolcastSolarCalculations.py +0 -41
  54. ubc_solar_physics-0.1.1/physics/environment/solar_calculations/__init__.py +0 -9
  55. ubc_solar_physics-0.1.1/physics/environment/solar_calculations/base_solar_calculations.py +0 -9
  56. ubc_solar_physics-0.1.1/physics/environment/solar_calculations/solar_calculations.rs +0 -24
  57. ubc_solar_physics-0.1.1/physics/environment/solar_calculations.rs +0 -1
  58. ubc_solar_physics-0.1.1/physics/environment/solcast_environment.py +0 -18
  59. ubc_solar_physics-0.1.1/physics/environment/weather_forecasts/OpenWeatherForecast.py +0 -308
  60. ubc_solar_physics-0.1.1/physics/environment/weather_forecasts/SolcastForecasts.py +0 -216
  61. ubc_solar_physics-0.1.1/physics/environment/weather_forecasts/__init__.py +0 -9
  62. ubc_solar_physics-0.1.1/physics/environment/weather_forecasts/base_weather_forecasts.py +0 -57
  63. ubc_solar_physics-0.1.1/physics/environment/weather_forecasts.rs +0 -1
  64. ubc_solar_physics-0.1.1/physics/environment.rs +0 -3
  65. ubc_solar_physics-0.1.1/poetry.lock +0 -856
  66. ubc_solar_physics-0.1.1/ubc_solar_physics.egg-info/PKG-INFO +0 -44
  67. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/Cargo.lock +0 -0
  68. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/Cargo.toml +0 -0
  69. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/LICENSE +0 -0
  70. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/environment/gis/__init__.py +0 -0
  71. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/environment/gis/base_gis.py +0 -0
  72. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/environment/gis/gis.rs +0 -0
  73. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/environment/gis.rs +0 -0
  74. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/environment/race.py +0 -0
  75. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/__init__.py +0 -0
  76. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/arrays/__init__.py +0 -0
  77. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/arrays/arrays.rs +0 -0
  78. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/arrays/base_array.py +0 -0
  79. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/arrays/basic_array.py +0 -0
  80. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/arrays.rs +0 -0
  81. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/battery/__init__.py +0 -0
  82. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/battery/base_battery.py +0 -0
  83. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/battery/basic_battery.py +0 -0
  84. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/battery/battery.rs +0 -0
  85. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/battery.rs +0 -0
  86. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/constants.py +0 -0
  87. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/lvs/__init__.py +0 -0
  88. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/lvs/basic_lvs.py +0 -0
  89. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/lvs/lvs.rs +0 -0
  90. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/lvs.rs +0 -0
  91. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/motor/__init__.py +0 -0
  92. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/motor/motor.rs +0 -0
  93. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/motor.rs +0 -0
  94. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/regen/__init__.py +0 -0
  95. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/regen/basic_regen.py +0 -0
  96. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/regen/regen.rs +0 -0
  97. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models/regen.rs +0 -0
  98. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/physics/models.rs +0 -0
  99. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/setup.cfg +0 -0
  100. {ubc_solar_physics-0.1.1 → ubc_solar_physics-1.0.5}/ubc_solar_physics.egg-info/dependency_links.txt +0 -0
  101. {ubc_solar_physics-0.1.1 → 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
@@ -0,0 +1,13 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: "ubuntu-22.04"
5
+ tools:
6
+ python: "3.10"
7
+
8
+ python:
9
+ install:
10
+ - requirements: docs/docs_requirements.txt
11
+
12
+ sphinx:
13
+ configuration: docs/source/conf.py
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.1
2
+ Name: ubc-solar-physics
3
+ Version: 1.0.5
4
+ Summary: UBC Solar's Simulation Environment
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
+ Author-email: UBC Solar <strategy@ubcsolar.com>
7
+ Maintainer: Renu Rajamagmesh, Felix Toft, Mack Wilson, Jonah Lee, Tamzeed Quazi
8
+ Maintainer-email: UBC Solar <strategy@ubcsolar.com>, Joshua Riefman <joshuariefman@gmail.com>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2024 UBC Solar
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+
31
+ Project-URL: Homepage, https://ubcsolar.com
32
+ Project-URL: Repository, https://github.com/UBC-Solar/physics
33
+ Project-URL: Documentation, https://ubc-solar-physics.readthedocs.io/en/latest/
34
+ Keywords: car,simulation,solar
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Rust
37
+ Classifier: Natural Language :: English
38
+ Classifier: Topic :: Scientific/Engineering :: Physics
39
+ Requires-Python: >=3.9
40
+ Description-Content-Type: text/markdown
41
+ License-File: LICENSE
42
+ Requires-Dist: backports.tarfile==1.2.0
43
+ Requires-Dist: certifi==2024.7.4
44
+ Requires-Dist: charset-normalizer==3.3.2
45
+ Requires-Dist: dill==0.3.8
46
+ Requires-Dist: haversine==2.8.1
47
+ Requires-Dist: idna==3.7
48
+ Requires-Dist: importlib_metadata==8.2.0
49
+ Requires-Dist: jaraco.classes==3.4.0
50
+ Requires-Dist: jaraco.context==5.3.0
51
+ Requires-Dist: jaraco.functools==4.0.2
52
+ Requires-Dist: keyring==25.3.0
53
+ Requires-Dist: llvmlite==0.43.0
54
+ Requires-Dist: markdown-it-py==3.0.0
55
+ Requires-Dist: mdurl==0.1.2
56
+ Requires-Dist: more-itertools==10.4.0
57
+ Requires-Dist: nh3==0.2.18
58
+ Requires-Dist: numba==0.60.0
59
+ Requires-Dist: numpy==2.0.1
60
+ Requires-Dist: pkginfo==1.10.0
61
+ Requires-Dist: Pygments==2.18.0
62
+ Requires-Dist: readme_renderer==44.0
63
+ Requires-Dist: requests==2.32.3
64
+ Requires-Dist: requests-toolbelt==1.0.0
65
+ Requires-Dist: rfc3986==2.0.0
66
+ Requires-Dist: rich==13.7.1
67
+ Requires-Dist: tqdm==4.66.5
68
+ Requires-Dist: urllib3==2.2.2
69
+ Requires-Dist: zipp==3.20.0
70
+
71
+ # UBC Solar Physics
72
+
73
+ <!-- marker-index-start -->
74
+
75
+ [![Documentation Status](https://readthedocs.org/projects/ubc-solar-physics/badge/?version=latest)](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
+ [![Documentation Status](https://readthedocs.org/projects/ubc-solar-physics/badge/?version=latest)](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,9 @@
1
+ API Reference
2
+ =============
3
+
4
+ .. toctree::
5
+ :maxdepth: 3
6
+ :caption: API Reference
7
+
8
+ environment/index
9
+ models/index
@@ -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,12 @@
1
+ GIS
2
+ ===
3
+
4
+ .. autoclass:: physics.environment.gis.GIS
5
+ :members:
6
+ :undoc-members:
7
+ :show-inheritance:
8
+
9
+ .. autoclass:: physics.environment.gis.BaseGIS
10
+ :members:
11
+ :undoc-members:
12
+ :show-inheritance:
@@ -0,0 +1,9 @@
1
+ Environment
2
+ ============
3
+
4
+ .. toctree::
5
+ :maxdepth: 3
6
+ :caption: Environment
7
+
8
+ gis
9
+ meteorology
@@ -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: