dnv-solarfarmer 0.2.0rc1__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 (71) hide show
  1. dnv_solarfarmer-0.2.0rc1/LICENSE +13 -0
  2. dnv_solarfarmer-0.2.0rc1/MANIFEST.in +5 -0
  3. dnv_solarfarmer-0.2.0rc1/PKG-INFO +176 -0
  4. dnv_solarfarmer-0.2.0rc1/README.md +125 -0
  5. dnv_solarfarmer-0.2.0rc1/dnv_solarfarmer.egg-info/PKG-INFO +176 -0
  6. dnv_solarfarmer-0.2.0rc1/dnv_solarfarmer.egg-info/SOURCES.txt +69 -0
  7. dnv_solarfarmer-0.2.0rc1/dnv_solarfarmer.egg-info/dependency_links.txt +1 -0
  8. dnv_solarfarmer-0.2.0rc1/dnv_solarfarmer.egg-info/requires.txt +26 -0
  9. dnv_solarfarmer-0.2.0rc1/dnv_solarfarmer.egg-info/top_level.txt +1 -0
  10. dnv_solarfarmer-0.2.0rc1/docs/404.md +36 -0
  11. dnv_solarfarmer-0.2.0rc1/docs/api.md +208 -0
  12. dnv_solarfarmer-0.2.0rc1/docs/faq.md +37 -0
  13. dnv_solarfarmer-0.2.0rc1/docs/getting-started/end-to-end-examples.md +128 -0
  14. dnv_solarfarmer-0.2.0rc1/docs/getting-started/index.md +109 -0
  15. dnv_solarfarmer-0.2.0rc1/docs/getting-started/quick-start-examples.md +505 -0
  16. dnv_solarfarmer-0.2.0rc1/docs/getting-started/workflow-1-existing-api-files.md +327 -0
  17. dnv_solarfarmer-0.2.0rc1/docs/getting-started/workflow-2-pvplant-builder.md +323 -0
  18. dnv_solarfarmer-0.2.0rc1/docs/getting-started/workflow-3-plantbuilder-advanced.md +424 -0
  19. dnv_solarfarmer-0.2.0rc1/docs/index.md +87 -0
  20. dnv_solarfarmer-0.2.0rc1/docs/license.md +20 -0
  21. dnv_solarfarmer-0.2.0rc1/mkdocs.yml +112 -0
  22. dnv_solarfarmer-0.2.0rc1/pyproject.toml +123 -0
  23. dnv_solarfarmer-0.2.0rc1/setup.cfg +4 -0
  24. dnv_solarfarmer-0.2.0rc1/solarfarmer/__init__.py +113 -0
  25. dnv_solarfarmer-0.2.0rc1/solarfarmer/__version__.py +85 -0
  26. dnv_solarfarmer-0.2.0rc1/solarfarmer/api.py +509 -0
  27. dnv_solarfarmer-0.2.0rc1/solarfarmer/config.py +50 -0
  28. dnv_solarfarmer-0.2.0rc1/solarfarmer/endpoint_about.py +54 -0
  29. dnv_solarfarmer-0.2.0rc1/solarfarmer/endpoint_modelchains.py +766 -0
  30. dnv_solarfarmer-0.2.0rc1/solarfarmer/endpoint_modelchains_utils.py +725 -0
  31. dnv_solarfarmer-0.2.0rc1/solarfarmer/endpoint_service.py +43 -0
  32. dnv_solarfarmer-0.2.0rc1/solarfarmer/endpoint_terminate_async.py +56 -0
  33. dnv_solarfarmer-0.2.0rc1/solarfarmer/logging.py +113 -0
  34. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/__init__.py +63 -0
  35. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/_base.py +13 -0
  36. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/auxiliary_losses.py +37 -0
  37. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/energy_calculation_inputs.py +83 -0
  38. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/energy_calculation_options.py +172 -0
  39. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/energy_calculation_results.py +1945 -0
  40. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/enums.py +70 -0
  41. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/inverter.py +35 -0
  42. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/layout.py +78 -0
  43. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/location.py +21 -0
  44. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/model_chain_response.py +202 -0
  45. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/monthly_albedo.py +60 -0
  46. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/mounting_type_specification.py +79 -0
  47. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/ond_supplements.py +32 -0
  48. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/pan_supplements.py +46 -0
  49. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/pv_plant.py +38 -0
  50. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/pvsystem/__init__.py +7 -0
  51. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/pvsystem/plant_defaults.py +91 -0
  52. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/pvsystem/plant_utils.py +187 -0
  53. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/pvsystem/pvsystem.py +1814 -0
  54. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/pvsystem/validation.py +29 -0
  55. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/tracker_system.py +36 -0
  56. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/transformer.py +27 -0
  57. dnv_solarfarmer-0.2.0rc1/solarfarmer/models/transformer_specification.py +49 -0
  58. dnv_solarfarmer-0.2.0rc1/tests/test_api.py +412 -0
  59. dnv_solarfarmer-0.2.0rc1/tests/test_construct_plant.py +108 -0
  60. dnv_solarfarmer-0.2.0rc1/tests/test_endpoint_about.py +116 -0
  61. dnv_solarfarmer-0.2.0rc1/tests/test_endpoint_modelchain.py +599 -0
  62. dnv_solarfarmer-0.2.0rc1/tests/test_endpoint_modelchains_utils.py +780 -0
  63. dnv_solarfarmer-0.2.0rc1/tests/test_endpoint_service.py +80 -0
  64. dnv_solarfarmer-0.2.0rc1/tests/test_endpoint_terminate_async.py +97 -0
  65. dnv_solarfarmer-0.2.0rc1/tests/test_energy_calculation_results.py +743 -0
  66. dnv_solarfarmer-0.2.0rc1/tests/test_logging.py +75 -0
  67. dnv_solarfarmer-0.2.0rc1/tests/test_model_chain_response.py +155 -0
  68. dnv_solarfarmer-0.2.0rc1/tests/test_plant_utils.py +167 -0
  69. dnv_solarfarmer-0.2.0rc1/tests/test_pvsystem.py +700 -0
  70. dnv_solarfarmer-0.2.0rc1/tests/test_validation_message.py +72 -0
  71. dnv_solarfarmer-0.2.0rc1/tests/test_version.py +15 -0
@@ -0,0 +1,13 @@
1
+ Copyright [2026] [DNV AS]
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ include LICENSE
2
+ include README.md
3
+ include mkdocs.yml
4
+ recursive-include docs *.md
5
+ recursive-include examples *.py
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.4
2
+ Name: dnv-solarfarmer
3
+ Version: 0.2.0rc1
4
+ Summary: SDK for SolarFarmer software, bankable solar PV calculation engine developed by DNV.
5
+ Author-email: "DNV Green Power Monitor, Green Data Products" <solarfarmer@dnv.com>
6
+ Maintainer-email: Green Data Products <solarfarmer@dnv.com>
7
+ License: Apache-2.0
8
+ Project-URL: Homepage, https://www.dnv.com/software/services/solarfarmer/
9
+ Project-URL: Repository, https://github.com/dnv-opensource/solarfarmer-python-sdk
10
+ Project-URL: Issues, https://github.com/dnv-opensource/solarfarmer-python-sdk/issues
11
+ Keywords: sdk,api,solarfarmer,dnv,python
12
+ Classifier: Intended Audience :: Information Technology
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: License :: OSI Approved :: Apache Software License
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Topic :: Internet
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Software Development :: Libraries
24
+ Classifier: Topic :: Software Development
25
+ Classifier: Topic :: Scientific/Engineering
26
+ Requires-Python: >=3.10
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: pydantic>=2.0
30
+ Requires-Dist: requests>=2.28
31
+ Requires-Dist: tabulate>=0.9.0
32
+ Provides-Extra: docs
33
+ Requires-Dist: zensical>=0.0.20; extra == "docs"
34
+ Requires-Dist: mkdocstrings[python]>=0.26.1; extra == "docs"
35
+ Requires-Dist: mkdocs-jupyter>=0.24; extra == "docs"
36
+ Provides-Extra: test
37
+ Requires-Dist: pytest>=7.0; extra == "test"
38
+ Provides-Extra: dev
39
+ Requires-Dist: dnv-solarfarmer[test]; extra == "dev"
40
+ Requires-Dist: pre-commit>=3.0; extra == "dev"
41
+ Requires-Dist: ruff>=0.5; extra == "dev"
42
+ Provides-Extra: notebooks
43
+ Requires-Dist: ipykernel<8,>=6.29; extra == "notebooks"
44
+ Requires-Dist: jupyterlab<6,>=4.0; extra == "notebooks"
45
+ Requires-Dist: notebook<9,>=7.0; extra == "notebooks"
46
+ Provides-Extra: all
47
+ Requires-Dist: dnv-solarfarmer[dev,docs,notebooks]; extra == "all"
48
+ Requires-Dist: pandas>=2.0; extra == "all"
49
+ Requires-Dist: matplotlib>=3.5; extra == "all"
50
+ Dynamic: license-file
51
+
52
+ # SolarFarmer Python SDK
53
+
54
+ [![PyPI version](https://img.shields.io/pypi/v/dnv-solarfarmer)](https://pypi.org/project/dnv-solarfarmer/)
55
+ [![Python versions](https://img.shields.io/pypi/pyversions/dnv-solarfarmer)](https://pypi.org/project/dnv-solarfarmer/)
56
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
57
+ [![CI](https://github.com/dnv-opensource/solarfarmer-python-sdk/actions/workflows/test.yml/badge.svg)](https://github.com/dnv-opensource/solarfarmer-python-sdk/actions/workflows/test.yml)
58
+ [![Documentation](https://img.shields.io/badge/docs-online-teal)](https://dnv-opensource.github.io/solarfarmer-python-sdk/)
59
+
60
+ The official Python SDK for [DNV SolarFarmer](https://www.dnv.com/software/services/solarfarmer/), a bankable solar PV calculation engine. Use it to build validated API payloads, run cloud-based 2D and 3D energy calculations, and analyse simulation results — all from Python.
61
+
62
+ ## Key Features
63
+
64
+ - **API-faithful data models** that closely mirror the SolarFarmer API schema, with serialization conveniences (snake_case Python fields serialized to the correct camelCase JSON automatically) to reduce integration friction
65
+ - **Two plant-building approaches:** a bottom-up route using `EnergyCalculationInputs`, `PVPlant`, and component classes (`Inverter`, `Layout`, `Transformer`, etc.) for full control over the plant topology; and a `PVSystem` convenience class that accepts high-level parameters (capacity, tilt, GCR, equipment files) and constructs the payload automatically, suited to indicative simulations where exhaustive detail is not required
66
+ - **`CalculationResults` encapsulation** — the API response is wrapped in a `CalculationResults` object that provides structured access to annual and monthly energy metrics, loss trees, PVsyst-format time-series, and detailed time-series output without manual JSON parsing
67
+ - **ModelChain and ModelChainAsync endpoint support** — the SDK dispatches to the synchronous `ModelChain` endpoint or the asynchronous `ModelChainAsync` endpoint as appropriate, and handles polling automatically for long-running jobs
68
+ - **Async job management** — poll, monitor, and terminate async calculations via `terminate_calculation()`
69
+
70
+ ## Requirements
71
+
72
+ - Python >= 3.10 (tested on 3.10, 3.11, 3.12, 3.13)
73
+ - A SolarFarmer API key (commercial licence required) — see [API Key](#api-key)
74
+
75
+ ## Installation
76
+
77
+ Install from PyPI:
78
+
79
+ ```bash
80
+ pip install dnv-solarfarmer
81
+ ```
82
+
83
+ The package is imported as `solarfarmer` regardless of the distribution name:
84
+
85
+ ```python
86
+ import solarfarmer as sf
87
+ ```
88
+
89
+ Install with optional extras:
90
+
91
+ ```bash
92
+ pip install "dnv-solarfarmer[notebooks]" # JupyterLab and notebook support
93
+ pip install "dnv-solarfarmer[all]" # full installation including pandas and matplotlib
94
+ pip install "dnv-solarfarmer[dev]" # linting and testing tools (for contributors)
95
+ ```
96
+
97
+ Install from source:
98
+
99
+ ```bash
100
+ git clone https://github.com/dnv-opensource/solarfarmer-python-sdk
101
+ cd solarfarmer-python-sdk
102
+ pip install -e .
103
+ ```
104
+
105
+ ## API Key
106
+
107
+ A SolarFarmer API key is required to run energy calculations. Obtain one from the [SolarFarmer portal](https://solarfarmer.dnv.com/). For setup instructions, see the [API key documentation](https://mysoftware.dnv.com/download/public/renewables/solarfarmer/manuals/latest/WebApi/Introduction/ApiKey.html).
108
+
109
+ Set your key as an environment variable (recommended):
110
+
111
+ ```bash
112
+ export SF_API_KEY="your_api_key_here"
113
+ ```
114
+
115
+ Alternatively, pass it directly as the `api_key` parameter to any function that calls the API.
116
+
117
+ ## Configuration
118
+
119
+ | Environment Variable | Default | Description |
120
+ |---|---|---|
121
+ | `SF_API_KEY` | *(none — required for calculations)* | API authentication token |
122
+ | `SF_API_URL` | `https://solarfarmer.dnv.com/latest/api` | Override the base API URL for custom deployments |
123
+
124
+ ## Getting Started
125
+
126
+ The SDK is built around three workflows suited to different use cases:
127
+
128
+ | Workflow | Best for | Primary entry point |
129
+ |---|---|---|
130
+ | 1. Load existing files | Users with pre-built API payloads from the SolarFarmer desktop app or a previous export | `sf.run_energy_calculation(inputs_folder_path=...)` |
131
+ | 2. PVSystem builder | Solar engineers designing new plants programmatically with automatic payload generation | `sf.PVSystem(...)` then `plant.run_energy_calculation()` |
132
+ | 3. Custom integration | Developers mapping internal databases or proprietary formats to the SolarFarmer API | `sf.EnergyCalculationInputs(location=..., pv_plant=..., ...)` |
133
+
134
+ See the [Getting Started guide](https://dnv-opensource.github.io/solarfarmer-python-sdk/getting-started/) for full per-workflow walkthroughs, and the [example notebooks](https://dnv-opensource.github.io/solarfarmer-python-sdk/notebooks/Example_EnergyCalculations/) for runnable end-to-end examples.
135
+
136
+ ## Documentation
137
+
138
+ Full documentation including API reference, workflow guides, and notebook tutorials:
139
+
140
+ **https://dnv-opensource.github.io/solarfarmer-python-sdk/**
141
+
142
+ To build and serve the documentation locally:
143
+
144
+ ```bash
145
+ pip install "dnv-solarfarmer[docs]"
146
+ zensical serve -o # build, serve, and open in browser (port 8000)
147
+ zensical serve -o -a localhost:8080 # use a different port
148
+ ```
149
+
150
+ `zensical serve` builds the docs and starts a local server in one step. The `-o` flag opens the page automatically in your default browser.
151
+
152
+ ## Contributing
153
+
154
+ Fork the repository, create a branch, and submit a pull request to `main`. To set up a development environment:
155
+
156
+ ```bash
157
+ git clone https://github.com/dnv-opensource/solarfarmer-python-sdk
158
+ cd solarfarmer-python-sdk
159
+ pip install -e ".[dev]"
160
+ ```
161
+
162
+ - **Linting and formatting:** `ruff check solarfarmer/ tests/` and `ruff format solarfarmer/ tests/`
163
+ - **Tests:** `pytest tests/ -v`
164
+
165
+ All contributions should include tests for new functionality. For feature proposals or questions, contact [solarfarmer@dnv.com](mailto:solarfarmer@dnv.com). See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.
166
+
167
+ ## Getting Technical Support
168
+
169
+ - **SDK documentation:** https://dnv-opensource.github.io/solarfarmer-python-sdk/
170
+ - **SolarFarmer API documentation:** https://mysoftware.dnv.com/download/public/renewables/solarfarmer/manuals/latest/WebApi/Introduction/introduction.html
171
+ - **Issue tracker:** https://github.com/dnv-opensource/solarfarmer-python-sdk/issues
172
+ - **Email:** [solarfarmer@dnv.com](mailto:solarfarmer@dnv.com)
173
+
174
+ ## License
175
+
176
+ Apache License, Version 2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,125 @@
1
+ # SolarFarmer Python SDK
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/dnv-solarfarmer)](https://pypi.org/project/dnv-solarfarmer/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/dnv-solarfarmer)](https://pypi.org/project/dnv-solarfarmer/)
5
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
6
+ [![CI](https://github.com/dnv-opensource/solarfarmer-python-sdk/actions/workflows/test.yml/badge.svg)](https://github.com/dnv-opensource/solarfarmer-python-sdk/actions/workflows/test.yml)
7
+ [![Documentation](https://img.shields.io/badge/docs-online-teal)](https://dnv-opensource.github.io/solarfarmer-python-sdk/)
8
+
9
+ The official Python SDK for [DNV SolarFarmer](https://www.dnv.com/software/services/solarfarmer/), a bankable solar PV calculation engine. Use it to build validated API payloads, run cloud-based 2D and 3D energy calculations, and analyse simulation results — all from Python.
10
+
11
+ ## Key Features
12
+
13
+ - **API-faithful data models** that closely mirror the SolarFarmer API schema, with serialization conveniences (snake_case Python fields serialized to the correct camelCase JSON automatically) to reduce integration friction
14
+ - **Two plant-building approaches:** a bottom-up route using `EnergyCalculationInputs`, `PVPlant`, and component classes (`Inverter`, `Layout`, `Transformer`, etc.) for full control over the plant topology; and a `PVSystem` convenience class that accepts high-level parameters (capacity, tilt, GCR, equipment files) and constructs the payload automatically, suited to indicative simulations where exhaustive detail is not required
15
+ - **`CalculationResults` encapsulation** — the API response is wrapped in a `CalculationResults` object that provides structured access to annual and monthly energy metrics, loss trees, PVsyst-format time-series, and detailed time-series output without manual JSON parsing
16
+ - **ModelChain and ModelChainAsync endpoint support** — the SDK dispatches to the synchronous `ModelChain` endpoint or the asynchronous `ModelChainAsync` endpoint as appropriate, and handles polling automatically for long-running jobs
17
+ - **Async job management** — poll, monitor, and terminate async calculations via `terminate_calculation()`
18
+
19
+ ## Requirements
20
+
21
+ - Python >= 3.10 (tested on 3.10, 3.11, 3.12, 3.13)
22
+ - A SolarFarmer API key (commercial licence required) — see [API Key](#api-key)
23
+
24
+ ## Installation
25
+
26
+ Install from PyPI:
27
+
28
+ ```bash
29
+ pip install dnv-solarfarmer
30
+ ```
31
+
32
+ The package is imported as `solarfarmer` regardless of the distribution name:
33
+
34
+ ```python
35
+ import solarfarmer as sf
36
+ ```
37
+
38
+ Install with optional extras:
39
+
40
+ ```bash
41
+ pip install "dnv-solarfarmer[notebooks]" # JupyterLab and notebook support
42
+ pip install "dnv-solarfarmer[all]" # full installation including pandas and matplotlib
43
+ pip install "dnv-solarfarmer[dev]" # linting and testing tools (for contributors)
44
+ ```
45
+
46
+ Install from source:
47
+
48
+ ```bash
49
+ git clone https://github.com/dnv-opensource/solarfarmer-python-sdk
50
+ cd solarfarmer-python-sdk
51
+ pip install -e .
52
+ ```
53
+
54
+ ## API Key
55
+
56
+ A SolarFarmer API key is required to run energy calculations. Obtain one from the [SolarFarmer portal](https://solarfarmer.dnv.com/). For setup instructions, see the [API key documentation](https://mysoftware.dnv.com/download/public/renewables/solarfarmer/manuals/latest/WebApi/Introduction/ApiKey.html).
57
+
58
+ Set your key as an environment variable (recommended):
59
+
60
+ ```bash
61
+ export SF_API_KEY="your_api_key_here"
62
+ ```
63
+
64
+ Alternatively, pass it directly as the `api_key` parameter to any function that calls the API.
65
+
66
+ ## Configuration
67
+
68
+ | Environment Variable | Default | Description |
69
+ |---|---|---|
70
+ | `SF_API_KEY` | *(none — required for calculations)* | API authentication token |
71
+ | `SF_API_URL` | `https://solarfarmer.dnv.com/latest/api` | Override the base API URL for custom deployments |
72
+
73
+ ## Getting Started
74
+
75
+ The SDK is built around three workflows suited to different use cases:
76
+
77
+ | Workflow | Best for | Primary entry point |
78
+ |---|---|---|
79
+ | 1. Load existing files | Users with pre-built API payloads from the SolarFarmer desktop app or a previous export | `sf.run_energy_calculation(inputs_folder_path=...)` |
80
+ | 2. PVSystem builder | Solar engineers designing new plants programmatically with automatic payload generation | `sf.PVSystem(...)` then `plant.run_energy_calculation()` |
81
+ | 3. Custom integration | Developers mapping internal databases or proprietary formats to the SolarFarmer API | `sf.EnergyCalculationInputs(location=..., pv_plant=..., ...)` |
82
+
83
+ See the [Getting Started guide](https://dnv-opensource.github.io/solarfarmer-python-sdk/getting-started/) for full per-workflow walkthroughs, and the [example notebooks](https://dnv-opensource.github.io/solarfarmer-python-sdk/notebooks/Example_EnergyCalculations/) for runnable end-to-end examples.
84
+
85
+ ## Documentation
86
+
87
+ Full documentation including API reference, workflow guides, and notebook tutorials:
88
+
89
+ **https://dnv-opensource.github.io/solarfarmer-python-sdk/**
90
+
91
+ To build and serve the documentation locally:
92
+
93
+ ```bash
94
+ pip install "dnv-solarfarmer[docs]"
95
+ zensical serve -o # build, serve, and open in browser (port 8000)
96
+ zensical serve -o -a localhost:8080 # use a different port
97
+ ```
98
+
99
+ `zensical serve` builds the docs and starts a local server in one step. The `-o` flag opens the page automatically in your default browser.
100
+
101
+ ## Contributing
102
+
103
+ Fork the repository, create a branch, and submit a pull request to `main`. To set up a development environment:
104
+
105
+ ```bash
106
+ git clone https://github.com/dnv-opensource/solarfarmer-python-sdk
107
+ cd solarfarmer-python-sdk
108
+ pip install -e ".[dev]"
109
+ ```
110
+
111
+ - **Linting and formatting:** `ruff check solarfarmer/ tests/` and `ruff format solarfarmer/ tests/`
112
+ - **Tests:** `pytest tests/ -v`
113
+
114
+ All contributions should include tests for new functionality. For feature proposals or questions, contact [solarfarmer@dnv.com](mailto:solarfarmer@dnv.com). See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.
115
+
116
+ ## Getting Technical Support
117
+
118
+ - **SDK documentation:** https://dnv-opensource.github.io/solarfarmer-python-sdk/
119
+ - **SolarFarmer API documentation:** https://mysoftware.dnv.com/download/public/renewables/solarfarmer/manuals/latest/WebApi/Introduction/introduction.html
120
+ - **Issue tracker:** https://github.com/dnv-opensource/solarfarmer-python-sdk/issues
121
+ - **Email:** [solarfarmer@dnv.com](mailto:solarfarmer@dnv.com)
122
+
123
+ ## License
124
+
125
+ Apache License, Version 2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.4
2
+ Name: dnv-solarfarmer
3
+ Version: 0.2.0rc1
4
+ Summary: SDK for SolarFarmer software, bankable solar PV calculation engine developed by DNV.
5
+ Author-email: "DNV Green Power Monitor, Green Data Products" <solarfarmer@dnv.com>
6
+ Maintainer-email: Green Data Products <solarfarmer@dnv.com>
7
+ License: Apache-2.0
8
+ Project-URL: Homepage, https://www.dnv.com/software/services/solarfarmer/
9
+ Project-URL: Repository, https://github.com/dnv-opensource/solarfarmer-python-sdk
10
+ Project-URL: Issues, https://github.com/dnv-opensource/solarfarmer-python-sdk/issues
11
+ Keywords: sdk,api,solarfarmer,dnv,python
12
+ Classifier: Intended Audience :: Information Technology
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: License :: OSI Approved :: Apache Software License
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Topic :: Internet
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Software Development :: Libraries
24
+ Classifier: Topic :: Software Development
25
+ Classifier: Topic :: Scientific/Engineering
26
+ Requires-Python: >=3.10
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: pydantic>=2.0
30
+ Requires-Dist: requests>=2.28
31
+ Requires-Dist: tabulate>=0.9.0
32
+ Provides-Extra: docs
33
+ Requires-Dist: zensical>=0.0.20; extra == "docs"
34
+ Requires-Dist: mkdocstrings[python]>=0.26.1; extra == "docs"
35
+ Requires-Dist: mkdocs-jupyter>=0.24; extra == "docs"
36
+ Provides-Extra: test
37
+ Requires-Dist: pytest>=7.0; extra == "test"
38
+ Provides-Extra: dev
39
+ Requires-Dist: dnv-solarfarmer[test]; extra == "dev"
40
+ Requires-Dist: pre-commit>=3.0; extra == "dev"
41
+ Requires-Dist: ruff>=0.5; extra == "dev"
42
+ Provides-Extra: notebooks
43
+ Requires-Dist: ipykernel<8,>=6.29; extra == "notebooks"
44
+ Requires-Dist: jupyterlab<6,>=4.0; extra == "notebooks"
45
+ Requires-Dist: notebook<9,>=7.0; extra == "notebooks"
46
+ Provides-Extra: all
47
+ Requires-Dist: dnv-solarfarmer[dev,docs,notebooks]; extra == "all"
48
+ Requires-Dist: pandas>=2.0; extra == "all"
49
+ Requires-Dist: matplotlib>=3.5; extra == "all"
50
+ Dynamic: license-file
51
+
52
+ # SolarFarmer Python SDK
53
+
54
+ [![PyPI version](https://img.shields.io/pypi/v/dnv-solarfarmer)](https://pypi.org/project/dnv-solarfarmer/)
55
+ [![Python versions](https://img.shields.io/pypi/pyversions/dnv-solarfarmer)](https://pypi.org/project/dnv-solarfarmer/)
56
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
57
+ [![CI](https://github.com/dnv-opensource/solarfarmer-python-sdk/actions/workflows/test.yml/badge.svg)](https://github.com/dnv-opensource/solarfarmer-python-sdk/actions/workflows/test.yml)
58
+ [![Documentation](https://img.shields.io/badge/docs-online-teal)](https://dnv-opensource.github.io/solarfarmer-python-sdk/)
59
+
60
+ The official Python SDK for [DNV SolarFarmer](https://www.dnv.com/software/services/solarfarmer/), a bankable solar PV calculation engine. Use it to build validated API payloads, run cloud-based 2D and 3D energy calculations, and analyse simulation results — all from Python.
61
+
62
+ ## Key Features
63
+
64
+ - **API-faithful data models** that closely mirror the SolarFarmer API schema, with serialization conveniences (snake_case Python fields serialized to the correct camelCase JSON automatically) to reduce integration friction
65
+ - **Two plant-building approaches:** a bottom-up route using `EnergyCalculationInputs`, `PVPlant`, and component classes (`Inverter`, `Layout`, `Transformer`, etc.) for full control over the plant topology; and a `PVSystem` convenience class that accepts high-level parameters (capacity, tilt, GCR, equipment files) and constructs the payload automatically, suited to indicative simulations where exhaustive detail is not required
66
+ - **`CalculationResults` encapsulation** — the API response is wrapped in a `CalculationResults` object that provides structured access to annual and monthly energy metrics, loss trees, PVsyst-format time-series, and detailed time-series output without manual JSON parsing
67
+ - **ModelChain and ModelChainAsync endpoint support** — the SDK dispatches to the synchronous `ModelChain` endpoint or the asynchronous `ModelChainAsync` endpoint as appropriate, and handles polling automatically for long-running jobs
68
+ - **Async job management** — poll, monitor, and terminate async calculations via `terminate_calculation()`
69
+
70
+ ## Requirements
71
+
72
+ - Python >= 3.10 (tested on 3.10, 3.11, 3.12, 3.13)
73
+ - A SolarFarmer API key (commercial licence required) — see [API Key](#api-key)
74
+
75
+ ## Installation
76
+
77
+ Install from PyPI:
78
+
79
+ ```bash
80
+ pip install dnv-solarfarmer
81
+ ```
82
+
83
+ The package is imported as `solarfarmer` regardless of the distribution name:
84
+
85
+ ```python
86
+ import solarfarmer as sf
87
+ ```
88
+
89
+ Install with optional extras:
90
+
91
+ ```bash
92
+ pip install "dnv-solarfarmer[notebooks]" # JupyterLab and notebook support
93
+ pip install "dnv-solarfarmer[all]" # full installation including pandas and matplotlib
94
+ pip install "dnv-solarfarmer[dev]" # linting and testing tools (for contributors)
95
+ ```
96
+
97
+ Install from source:
98
+
99
+ ```bash
100
+ git clone https://github.com/dnv-opensource/solarfarmer-python-sdk
101
+ cd solarfarmer-python-sdk
102
+ pip install -e .
103
+ ```
104
+
105
+ ## API Key
106
+
107
+ A SolarFarmer API key is required to run energy calculations. Obtain one from the [SolarFarmer portal](https://solarfarmer.dnv.com/). For setup instructions, see the [API key documentation](https://mysoftware.dnv.com/download/public/renewables/solarfarmer/manuals/latest/WebApi/Introduction/ApiKey.html).
108
+
109
+ Set your key as an environment variable (recommended):
110
+
111
+ ```bash
112
+ export SF_API_KEY="your_api_key_here"
113
+ ```
114
+
115
+ Alternatively, pass it directly as the `api_key` parameter to any function that calls the API.
116
+
117
+ ## Configuration
118
+
119
+ | Environment Variable | Default | Description |
120
+ |---|---|---|
121
+ | `SF_API_KEY` | *(none — required for calculations)* | API authentication token |
122
+ | `SF_API_URL` | `https://solarfarmer.dnv.com/latest/api` | Override the base API URL for custom deployments |
123
+
124
+ ## Getting Started
125
+
126
+ The SDK is built around three workflows suited to different use cases:
127
+
128
+ | Workflow | Best for | Primary entry point |
129
+ |---|---|---|
130
+ | 1. Load existing files | Users with pre-built API payloads from the SolarFarmer desktop app or a previous export | `sf.run_energy_calculation(inputs_folder_path=...)` |
131
+ | 2. PVSystem builder | Solar engineers designing new plants programmatically with automatic payload generation | `sf.PVSystem(...)` then `plant.run_energy_calculation()` |
132
+ | 3. Custom integration | Developers mapping internal databases or proprietary formats to the SolarFarmer API | `sf.EnergyCalculationInputs(location=..., pv_plant=..., ...)` |
133
+
134
+ See the [Getting Started guide](https://dnv-opensource.github.io/solarfarmer-python-sdk/getting-started/) for full per-workflow walkthroughs, and the [example notebooks](https://dnv-opensource.github.io/solarfarmer-python-sdk/notebooks/Example_EnergyCalculations/) for runnable end-to-end examples.
135
+
136
+ ## Documentation
137
+
138
+ Full documentation including API reference, workflow guides, and notebook tutorials:
139
+
140
+ **https://dnv-opensource.github.io/solarfarmer-python-sdk/**
141
+
142
+ To build and serve the documentation locally:
143
+
144
+ ```bash
145
+ pip install "dnv-solarfarmer[docs]"
146
+ zensical serve -o # build, serve, and open in browser (port 8000)
147
+ zensical serve -o -a localhost:8080 # use a different port
148
+ ```
149
+
150
+ `zensical serve` builds the docs and starts a local server in one step. The `-o` flag opens the page automatically in your default browser.
151
+
152
+ ## Contributing
153
+
154
+ Fork the repository, create a branch, and submit a pull request to `main`. To set up a development environment:
155
+
156
+ ```bash
157
+ git clone https://github.com/dnv-opensource/solarfarmer-python-sdk
158
+ cd solarfarmer-python-sdk
159
+ pip install -e ".[dev]"
160
+ ```
161
+
162
+ - **Linting and formatting:** `ruff check solarfarmer/ tests/` and `ruff format solarfarmer/ tests/`
163
+ - **Tests:** `pytest tests/ -v`
164
+
165
+ All contributions should include tests for new functionality. For feature proposals or questions, contact [solarfarmer@dnv.com](mailto:solarfarmer@dnv.com). See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.
166
+
167
+ ## Getting Technical Support
168
+
169
+ - **SDK documentation:** https://dnv-opensource.github.io/solarfarmer-python-sdk/
170
+ - **SolarFarmer API documentation:** https://mysoftware.dnv.com/download/public/renewables/solarfarmer/manuals/latest/WebApi/Introduction/introduction.html
171
+ - **Issue tracker:** https://github.com/dnv-opensource/solarfarmer-python-sdk/issues
172
+ - **Email:** [solarfarmer@dnv.com](mailto:solarfarmer@dnv.com)
173
+
174
+ ## License
175
+
176
+ Apache License, Version 2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,69 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ mkdocs.yml
5
+ pyproject.toml
6
+ dnv_solarfarmer.egg-info/PKG-INFO
7
+ dnv_solarfarmer.egg-info/SOURCES.txt
8
+ dnv_solarfarmer.egg-info/dependency_links.txt
9
+ dnv_solarfarmer.egg-info/requires.txt
10
+ dnv_solarfarmer.egg-info/top_level.txt
11
+ docs/404.md
12
+ docs/api.md
13
+ docs/faq.md
14
+ docs/index.md
15
+ docs/license.md
16
+ docs/getting-started/end-to-end-examples.md
17
+ docs/getting-started/index.md
18
+ docs/getting-started/quick-start-examples.md
19
+ docs/getting-started/workflow-1-existing-api-files.md
20
+ docs/getting-started/workflow-2-pvplant-builder.md
21
+ docs/getting-started/workflow-3-plantbuilder-advanced.md
22
+ solarfarmer/__init__.py
23
+ solarfarmer/__version__.py
24
+ solarfarmer/api.py
25
+ solarfarmer/config.py
26
+ solarfarmer/endpoint_about.py
27
+ solarfarmer/endpoint_modelchains.py
28
+ solarfarmer/endpoint_modelchains_utils.py
29
+ solarfarmer/endpoint_service.py
30
+ solarfarmer/endpoint_terminate_async.py
31
+ solarfarmer/logging.py
32
+ solarfarmer/models/__init__.py
33
+ solarfarmer/models/_base.py
34
+ solarfarmer/models/auxiliary_losses.py
35
+ solarfarmer/models/energy_calculation_inputs.py
36
+ solarfarmer/models/energy_calculation_options.py
37
+ solarfarmer/models/energy_calculation_results.py
38
+ solarfarmer/models/enums.py
39
+ solarfarmer/models/inverter.py
40
+ solarfarmer/models/layout.py
41
+ solarfarmer/models/location.py
42
+ solarfarmer/models/model_chain_response.py
43
+ solarfarmer/models/monthly_albedo.py
44
+ solarfarmer/models/mounting_type_specification.py
45
+ solarfarmer/models/ond_supplements.py
46
+ solarfarmer/models/pan_supplements.py
47
+ solarfarmer/models/pv_plant.py
48
+ solarfarmer/models/tracker_system.py
49
+ solarfarmer/models/transformer.py
50
+ solarfarmer/models/transformer_specification.py
51
+ solarfarmer/models/pvsystem/__init__.py
52
+ solarfarmer/models/pvsystem/plant_defaults.py
53
+ solarfarmer/models/pvsystem/plant_utils.py
54
+ solarfarmer/models/pvsystem/pvsystem.py
55
+ solarfarmer/models/pvsystem/validation.py
56
+ tests/test_api.py
57
+ tests/test_construct_plant.py
58
+ tests/test_endpoint_about.py
59
+ tests/test_endpoint_modelchain.py
60
+ tests/test_endpoint_modelchains_utils.py
61
+ tests/test_endpoint_service.py
62
+ tests/test_endpoint_terminate_async.py
63
+ tests/test_energy_calculation_results.py
64
+ tests/test_logging.py
65
+ tests/test_model_chain_response.py
66
+ tests/test_plant_utils.py
67
+ tests/test_pvsystem.py
68
+ tests/test_validation_message.py
69
+ tests/test_version.py
@@ -0,0 +1,26 @@
1
+ pydantic>=2.0
2
+ requests>=2.28
3
+ tabulate>=0.9.0
4
+
5
+ [all]
6
+ dnv-solarfarmer[dev,docs,notebooks]
7
+ pandas>=2.0
8
+ matplotlib>=3.5
9
+
10
+ [dev]
11
+ dnv-solarfarmer[test]
12
+ pre-commit>=3.0
13
+ ruff>=0.5
14
+
15
+ [docs]
16
+ zensical>=0.0.20
17
+ mkdocstrings[python]>=0.26.1
18
+ mkdocs-jupyter>=0.24
19
+
20
+ [notebooks]
21
+ ipykernel<8,>=6.29
22
+ jupyterlab<6,>=4.0
23
+ notebook<9,>=7.0
24
+
25
+ [test]
26
+ pytest>=7.0
@@ -0,0 +1,36 @@
1
+ # 404 - Page Not Found
2
+
3
+ The page you're looking for cannot be found.
4
+
5
+ ## Quick Links
6
+
7
+ **[← Back to Home](index.md)** | **[Getting Started](getting-started/index.md)** | **[API Reference](api.md)**
8
+
9
+ ## Find What You Need
10
+
11
+ ### Popular Pages
12
+
13
+ - [Quick Start Examples](getting-started/quick-start-examples.md)
14
+ - [Workflow 1: Load Existing API Files](getting-started/workflow-1-existing-api-files.md)
15
+ - [Workflow 2: Design Plants with PVSystem](getting-started/workflow-2-pvplant-builder.md)
16
+ - [Workflow 3: Advanced Integration](getting-started/workflow-3-plantbuilder-advanced.md)
17
+ - [End-to-End Examples](getting-started/end-to-end-examples.md)
18
+
19
+ ### Example Notebooks
20
+
21
+ Browse our [Jupyter notebook examples](getting-started/index.md) for hands-on tutorials covering:
22
+
23
+ - Using the About and Service Endpoints
24
+ - Running 2D and 3D Calculations
25
+ - Creating Plants with PVSystem
26
+ - Terminating Asynchronous Calculations
27
+
28
+ ## Need Help?
29
+
30
+ **Search** - Use the search bar above to find documentation
31
+
32
+ **Report Issues** - [GitHub Issues](https://github.com/dnv-opensource/solarfarmer-api-python-sdk/issues)
33
+
34
+ **Contact** - [solarfarmer@dnv.com](mailto:solarfarmer@dnv.com)
35
+
36
+ **Community** - Follow on [LinkedIn](https://www.linkedin.com/feed/hashtag/solarfarmer/)