SolarUtils 0.2.4__tar.gz → 0.4.8__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 (61) hide show
  1. {SolarUtils-0.2.4 → solarutils-0.4.8}/CHANGES.rst +18 -0
  2. {SolarUtils-0.2.4 → solarutils-0.4.8}/LICENSE +1 -1
  3. {SolarUtils-0.2.4 → solarutils-0.4.8}/MANIFEST.in +0 -0
  4. solarutils-0.4.8/PKG-INFO +106 -0
  5. {SolarUtils-0.2.4 → solarutils-0.4.8}/README.rst +2 -2
  6. solarutils-0.4.8/SolarUtils.egg-info/PKG-INFO +106 -0
  7. {SolarUtils-0.2.4 → solarutils-0.4.8}/SolarUtils.egg-info/SOURCES.txt +0 -4
  8. {SolarUtils-0.2.4 → solarutils-0.4.8}/SolarUtils.egg-info/dependency_links.txt +0 -0
  9. solarutils-0.4.8/SolarUtils.egg-info/requires.txt +4 -0
  10. {SolarUtils-0.2.4 → solarutils-0.4.8}/SolarUtils.egg-info/top_level.txt +0 -0
  11. {SolarUtils-0.2.4 → solarutils-0.4.8}/setup.cfg +1 -1
  12. {SolarUtils-0.2.4 → solarutils-0.4.8}/setup.py +17 -6
  13. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/NREL_DISCLAIMERS-COPYRIGHTS-LICENSES.txt +0 -0
  14. solarutils-0.4.8/solar_utils/__init__.py +15 -0
  15. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/core.py +92 -2
  16. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/darwin.mk +0 -0
  17. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/docs/Makefile +0 -0
  18. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/docs/conf.py +8 -4
  19. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/docs/core.rst +8 -0
  20. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/docs/example.png +0 -0
  21. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/docs/exceptions.rst +0 -0
  22. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/docs/favicon.ico +0 -0
  23. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/docs/index.rst +0 -0
  24. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/docs/make.bat +0 -0
  25. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/docs/sp_2014_logo_black_orange_rgb.png +0 -0
  26. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/dummy.c +0 -0
  27. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/exceptions.py +1 -1
  28. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/linux.mk +0 -0
  29. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/README.rst +0 -0
  30. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/orig/solpos/README.md +0 -0
  31. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/orig/solpos/SOLPOS Documentation.pdf +0 -0
  32. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/orig/solpos/solpos.c +0 -0
  33. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/orig/solpos/solpos00.h +0 -0
  34. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/orig/solpos/stest00.c +0 -0
  35. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/orig/spectrl2/README.md +0 -0
  36. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/orig/spectrl2/SPECTRL2 documentation.pdf +0 -0
  37. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/orig/spectrl2/spectest.c +0 -0
  38. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/orig/spectrl2/spectrl2_2.c +0 -0
  39. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/orig/spectrl2/spectrl2_2.h +0 -0
  40. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/solpos.c +0 -0
  41. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/solpos00.h +0 -0
  42. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/solposAM.c +32 -17
  43. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/spectest.c +0 -0
  44. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/spectrl2.c +1 -3
  45. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/spectrl2_2.c +4 -4
  46. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/spectrl2_2.h +0 -0
  47. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/src/stest00.c +0 -0
  48. solarutils-0.4.8/solar_utils/tests/__init__.py +5 -0
  49. solarutils-0.4.8/solar_utils/tests/test_cdlls.py +225 -0
  50. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/tests/test_spectrl2_data.json +0 -0
  51. {SolarUtils-0.2.4 → solarutils-0.4.8}/solar_utils/win32.mk +0 -0
  52. SolarUtils-0.2.4/PKG-INFO +0 -94
  53. SolarUtils-0.2.4/SolarUtils.egg-info/PKG-INFO +0 -94
  54. SolarUtils-0.2.4/SolarUtils.egg-info/requires.txt +0 -4
  55. SolarUtils-0.2.4/solar_utils/__init__.py +0 -17
  56. SolarUtils-0.2.4/solar_utils/libsolposAM.so +0 -0
  57. SolarUtils-0.2.4/solar_utils/libspectrl2.so +0 -0
  58. SolarUtils-0.2.4/solar_utils/solposAM.dll +0 -0
  59. SolarUtils-0.2.4/solar_utils/spectrl2.dll +0 -0
  60. SolarUtils-0.2.4/solar_utils/tests/__init__.py +0 -7
  61. SolarUtils-0.2.4/solar_utils/tests/test_cdlls.py +0 -138
@@ -1,6 +1,24 @@
1
1
  Changes
2
2
  =======
3
3
 
4
+ For more recent changes, please see
5
+ `GitHub Releases <https://github.com/mikofski/SolarUtils/releases>`_.
6
+
7
+ v0.4.8 - Dentists (2026-10-22)
8
+ ------------------------------
9
+ * use pytest
10
+ * publish to PyPI
11
+ * publish docs
12
+
13
+ v0.4 - Doctors (2026-10-08)
14
+ ---------------------------
15
+ * apply conda-forge patches
16
+ * create github actions
17
+
18
+ v0.3 - Carpenters (2019-05-22)
19
+ ------------------------------
20
+ * adds ``get_solposAM`` and ``get_solpos8760``
21
+
4
22
  v0.2.1 - Bartenders (2016-07-11)
5
23
  --------------------------------
6
24
  * add documentation
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016, SunPower Corp.
1
+ Copyright (c) 2026, Mark Mikofski Corp.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
File without changes
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: SolarUtils
3
+ Version: 0.4.8
4
+ Summary: Python wrappers around NREL SOLPOS and SPECTRL2
5
+ Home-page: https://github.com/mikofski/SolarUtils
6
+ Author: Mark Mikofski
7
+ Author-email: bwana.marko@yahoo.com
8
+ License: BSD 3-Clause
9
+ Platform: win32
10
+ Platform: linux
11
+ Platform: linux2
12
+ Platform: darwin
13
+ License-File: LICENSE
14
+ Provides-Extra: test
15
+ Requires-Dist: numpy; extra == "test"
16
+ Requires-Dist: pytest; extra == "test"
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: description
20
+ Dynamic: home-page
21
+ Dynamic: license
22
+ Dynamic: license-file
23
+ Dynamic: platform
24
+ Dynamic: provides-extra
25
+ Dynamic: summary
26
+
27
+ .. image:: https://github.com/mikofski/SolarUtils/actions/workflows/python-test.yml/badge.svg
28
+ :target: https://github.com/mikofski/SolarUtils/actions/workflows/python-test.yml
29
+
30
+ SolarUtils is set of Python wrappers around the publicly available
31
+ `NREL <http://www.nrel.gov/>`_
32
+ `SOLPOS <http://rredc.nrel.gov/solar/codesandalgorithms/solpos/>`_ and
33
+ `SPECTRL2 <http://rredc.nrel.gov/solar/models/spectral/>`_ C-language computer
34
+ programs that calculate solar position and spectral decomposition. Please read
35
+ the `NREL disclaimer and license <http://www.nrel.gov/disclaimer.html>`_. Usage
36
+ of this software implies acceptance of the terms.
37
+
38
+ Installation
39
+ ============
40
+ Use ``pip`` to install
41
+ `SolarUtils from the PyPI <https://pypi.python.org/pypi/SolarUtils>`_::
42
+
43
+ pip install SolarUtils
44
+
45
+ You can also download a source distribution from PyPI or clone the repository
46
+ and use Python ``distutils``::
47
+
48
+ python setup.py install
49
+
50
+ Requirements
51
+ ============
52
+ SolarUtils has no requirements for usage however for installation, testing and
53
+ to build the documentaiton you will need the following pacakges:
54
+
55
+ * NumPy
56
+ * PyTest
57
+ * Sphinx
58
+
59
+ Usage
60
+ =====
61
+ See `SOLPOS Documentation <http://rredc.nrel.gov/solar/codesandalgorithms/solpos/aboutsolpos.html>`_
62
+ and
63
+ `SPECTRL2 Documentation <http://rredc.nrel.gov/solar/models/spectral/spectrl2/documentation.html>`_
64
+ for more detail.
65
+
66
+ Examples
67
+ --------
68
+
69
+ >>> from solar_utils import *
70
+ >>> import pandas as pd
71
+ >>> location = [35.56836, -119.2022, -8.0]
72
+ >>> datetime = [2013, 6, 5, 12, 31, 0]
73
+ >>> weather = [1015.62055, 40.0]
74
+ >>> (angles, airmass) = solposAM(location, datetime, weather)
75
+ >>> zenith, azimuth = angles
76
+ >>> zenith
77
+ 15.074043273925781
78
+ >>> azimuth
79
+ 213.29042053222656]
80
+ >>> am, amp = airmass
81
+ >>> am
82
+ 1.0352272987365723
83
+ >>> amp
84
+ 1.0379053354263306]
85
+
86
+ >>> units = 1
87
+ >>> location = [33.65, -84.43, -5.0]
88
+ >>> datetime = [1999, 7, 22, 9, 45, 37]
89
+ >>> weather = [1006.0, 27.0]
90
+ >>> orientation = [33.65, 135.0]
91
+ >>> atmospheric_conditions = [1.14, 0.65, -1.0, 0.2, 1.36]
92
+ >>> albedo = [0.3, 0.7, 0.8, 1.3, 2.5, 4.0] + ([0.2] * 6)
93
+ >>> specdif, specdir, specetr, specglo, specx = spectrl2(
94
+ ... units, location, datetime, weather, orientation,
95
+ ... atmospheric_conditions, albedo
96
+ ... )
97
+ >>> spec = pd.DataFrame(
98
+ ... {'DIF': specdif, 'DIR': specdir, 'ETR': specetr, 'GLO': specglo},
99
+ ... index=specx
100
+ ... )
101
+ >>> f = spec.plot()
102
+ >>> f.set_title('Solar Spectrum Example')
103
+ >>> f.set_xlabel('Wavelength, $\lambda [\mu m]$')
104
+ >>> f.set_ylabel('Spectral Irradiance, $I_{\lambda} [W/m^2/\mu m]$')
105
+ >>> f.grid(True)
106
+ >>> f.figure.show()
@@ -1,5 +1,5 @@
1
- .. image:: https://travis-ci.org/SunPower/SolarUtils.svg?branch=master
2
- :target: https://travis-ci.org/SunPower/SolarUtils
1
+ .. image:: https://github.com/mikofski/SolarUtils/actions/workflows/python-test.yml/badge.svg
2
+ :target: https://github.com/mikofski/SolarUtils/actions/workflows/python-test.yml
3
3
 
4
4
  SolarUtils is set of Python wrappers around the publicly available
5
5
  `NREL <http://www.nrel.gov/>`_
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: SolarUtils
3
+ Version: 0.4.8
4
+ Summary: Python wrappers around NREL SOLPOS and SPECTRL2
5
+ Home-page: https://github.com/mikofski/SolarUtils
6
+ Author: Mark Mikofski
7
+ Author-email: bwana.marko@yahoo.com
8
+ License: BSD 3-Clause
9
+ Platform: win32
10
+ Platform: linux
11
+ Platform: linux2
12
+ Platform: darwin
13
+ License-File: LICENSE
14
+ Provides-Extra: test
15
+ Requires-Dist: numpy; extra == "test"
16
+ Requires-Dist: pytest; extra == "test"
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: description
20
+ Dynamic: home-page
21
+ Dynamic: license
22
+ Dynamic: license-file
23
+ Dynamic: platform
24
+ Dynamic: provides-extra
25
+ Dynamic: summary
26
+
27
+ .. image:: https://github.com/mikofski/SolarUtils/actions/workflows/python-test.yml/badge.svg
28
+ :target: https://github.com/mikofski/SolarUtils/actions/workflows/python-test.yml
29
+
30
+ SolarUtils is set of Python wrappers around the publicly available
31
+ `NREL <http://www.nrel.gov/>`_
32
+ `SOLPOS <http://rredc.nrel.gov/solar/codesandalgorithms/solpos/>`_ and
33
+ `SPECTRL2 <http://rredc.nrel.gov/solar/models/spectral/>`_ C-language computer
34
+ programs that calculate solar position and spectral decomposition. Please read
35
+ the `NREL disclaimer and license <http://www.nrel.gov/disclaimer.html>`_. Usage
36
+ of this software implies acceptance of the terms.
37
+
38
+ Installation
39
+ ============
40
+ Use ``pip`` to install
41
+ `SolarUtils from the PyPI <https://pypi.python.org/pypi/SolarUtils>`_::
42
+
43
+ pip install SolarUtils
44
+
45
+ You can also download a source distribution from PyPI or clone the repository
46
+ and use Python ``distutils``::
47
+
48
+ python setup.py install
49
+
50
+ Requirements
51
+ ============
52
+ SolarUtils has no requirements for usage however for installation, testing and
53
+ to build the documentaiton you will need the following pacakges:
54
+
55
+ * NumPy
56
+ * PyTest
57
+ * Sphinx
58
+
59
+ Usage
60
+ =====
61
+ See `SOLPOS Documentation <http://rredc.nrel.gov/solar/codesandalgorithms/solpos/aboutsolpos.html>`_
62
+ and
63
+ `SPECTRL2 Documentation <http://rredc.nrel.gov/solar/models/spectral/spectrl2/documentation.html>`_
64
+ for more detail.
65
+
66
+ Examples
67
+ --------
68
+
69
+ >>> from solar_utils import *
70
+ >>> import pandas as pd
71
+ >>> location = [35.56836, -119.2022, -8.0]
72
+ >>> datetime = [2013, 6, 5, 12, 31, 0]
73
+ >>> weather = [1015.62055, 40.0]
74
+ >>> (angles, airmass) = solposAM(location, datetime, weather)
75
+ >>> zenith, azimuth = angles
76
+ >>> zenith
77
+ 15.074043273925781
78
+ >>> azimuth
79
+ 213.29042053222656]
80
+ >>> am, amp = airmass
81
+ >>> am
82
+ 1.0352272987365723
83
+ >>> amp
84
+ 1.0379053354263306]
85
+
86
+ >>> units = 1
87
+ >>> location = [33.65, -84.43, -5.0]
88
+ >>> datetime = [1999, 7, 22, 9, 45, 37]
89
+ >>> weather = [1006.0, 27.0]
90
+ >>> orientation = [33.65, 135.0]
91
+ >>> atmospheric_conditions = [1.14, 0.65, -1.0, 0.2, 1.36]
92
+ >>> albedo = [0.3, 0.7, 0.8, 1.3, 2.5, 4.0] + ([0.2] * 6)
93
+ >>> specdif, specdir, specetr, specglo, specx = spectrl2(
94
+ ... units, location, datetime, weather, orientation,
95
+ ... atmospheric_conditions, albedo
96
+ ... )
97
+ >>> spec = pd.DataFrame(
98
+ ... {'DIF': specdif, 'DIR': specdir, 'ETR': specetr, 'GLO': specglo},
99
+ ... index=specx
100
+ ... )
101
+ >>> f = spec.plot()
102
+ >>> f.set_title('Solar Spectrum Example')
103
+ >>> f.set_xlabel('Wavelength, $\lambda [\mu m]$')
104
+ >>> f.set_ylabel('Spectral Irradiance, $I_{\lambda} [W/m^2/\mu m]$')
105
+ >>> f.grid(True)
106
+ >>> f.figure.show()
@@ -15,11 +15,7 @@ solar_utils/core.py
15
15
  solar_utils/darwin.mk
16
16
  solar_utils/dummy.c
17
17
  solar_utils/exceptions.py
18
- solar_utils/libsolposAM.so
19
- solar_utils/libspectrl2.so
20
18
  solar_utils/linux.mk
21
- solar_utils/solposAM.dll
22
- solar_utils/spectrl2.dll
23
19
  solar_utils/win32.mk
24
20
  solar_utils/docs/Makefile
25
21
  solar_utils/docs/conf.py
@@ -0,0 +1,4 @@
1
+
2
+ [test]
3
+ numpy
4
+ pytest
@@ -1,4 +1,4 @@
1
- [pytest]
1
+ [tool:pytest]
2
2
  norecursedirs = .git build dist venv
3
3
 
4
4
  [egg_info]
@@ -1,14 +1,14 @@
1
1
  """
2
2
  SolarUtils Package Setup
3
- Copyright (c) 2016 SunPower Corp.
4
- Confidential & Proprietary
5
- Do Not Distribute
3
+ Copyright (c) 2026 Mark Mikofski
4
+ forked from SunPower/SolarUtils
6
5
  """
7
6
 
8
7
  import sys
9
8
  import os
10
9
  import shutil
11
10
  from distutils import unixccompiler
11
+ from distutils.sysconfig import customize_compiler
12
12
  try:
13
13
  from setuptools import setup, distutils, Extension
14
14
  except ImportError:
@@ -42,7 +42,8 @@ elif PLATFORM == 'darwin':
42
42
  LIB_FILE = 'lib%s.dylib'
43
43
  RPATH = "-Wl,-rpath,@loader_path/"
44
44
  INSTALL_NAME = "@rpath/" + LIB_FILE
45
- CCFLAGS = LDFLAGS = ['-fPIC']
45
+ CCFLAGS = ['-fPIC']
46
+ LDFLAGS = ['-fPIC', '-dynamiclib']
46
47
  elif PLATFORM in ['linux', 'linux2']:
47
48
  PLATFORM = 'linux'
48
49
  LIB_FILE = 'lib%s.so'
@@ -148,6 +149,16 @@ elif not LIB_FILES_EXIST:
148
149
  CC = OSXCCOMPILER(verbose=3)
149
150
  else:
150
151
  CC = distutils.ccompiler.new_compiler() # initialize compiler object
152
+ customize_compiler(CC)
153
+ # this must come after customize_compiler(CC)
154
+ if PLATFORM == 'darwin':
155
+ # on mac osx remove '-bundle' & '-shared' from linker flags
156
+ # so it doesn't clash with -dynamiclib & -install_name
157
+ CC.set_executables(
158
+ linker_so=[
159
+ flag for flag in CC.linker_so
160
+ if flag not in ('-bundle', '-shared')
161
+ ])
151
162
  CC.add_include_dir(SRC_DIR) # set includes directory
152
163
  # compile solpos and solposAM objects into build directory
153
164
  OBJS = CC.compile([SOLPOS, SOLPOSAM], output_dir=BUILD_DIR,
@@ -173,7 +184,7 @@ if LIB_FILES_EXIST and 'sdist' not in sys.argv:
173
184
  PKG_DATA += [SOLPOSAM_LIB_FILE, SPECTRL2_LIB_FILE]
174
185
 
175
186
  # Tests will require these packages
176
- test_requires = ['numpy', 'nose']
187
+ test_requires = ['numpy', 'pytest']
177
188
 
178
189
  setup(
179
190
  name='SolarUtils',
@@ -188,5 +199,5 @@ setup(
188
199
  packages=[NAME, TESTS],
189
200
  package_data={NAME: PKG_DATA, TESTS: TEST_DATA},
190
201
  ext_modules=[DUMMY],
191
- extras_require={'testing': test_requires}
202
+ extras_require={'test': test_requires}
192
203
  )
@@ -0,0 +1,15 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ This is the solar utilities package.
4
+
5
+ 2026 Mark Mikofski
6
+ """
7
+
8
+ from solar_utils.core import solposAM, spectrl2, get_solpos8760, get_solposAM
9
+
10
+ __version__ = '0.4.8'
11
+ __release__ = 'Dentists'
12
+ __author__ = 'Mark Mikofski'
13
+ __email__ = 'bwana.marko@yahoo.com'
14
+ __url__ = 'https://github.com/mikofski/SolarUtils'
15
+ __all__ = ['solposAM', 'spectrl2', 'get_solpos8760', 'get_solposAM']
@@ -6,10 +6,11 @@ Solar utilities based on `SOLPOS
6
6
  `NREL RREDC Solar Resource Models and Tools
7
7
  <http://www.nrel.gov/rredc/models_tools.html>`_
8
8
 
9
- 2013 SunPower Corp.
9
+ 2026 Mark Mikofski
10
10
  """
11
11
 
12
12
  import ctypes
13
+ import datetime as pydatetime
13
14
  import math
14
15
  import os
15
16
  import sys
@@ -43,6 +44,95 @@ def _int2bits(err_code):
43
44
  return int(math.log(err_code, 2))
44
45
 
45
46
 
47
+ def get_solpos8760(location, year, weather):
48
+ """
49
+ Get SOLPOS hourly calculation for specified non-leap year.
50
+
51
+ :param location: [latitude, longitude, UTC-timezone]
52
+ :type location: float
53
+ :param year: a non-leap year
54
+ :type year: int
55
+ :param weather: [ambient-pressure (mB), ambient-temperature (C)]
56
+ :type weather: float
57
+ :returns: angles [degrees], airmass [atm]
58
+ :rtype: float
59
+ :raises: :exc:`~solar_utils.exceptions.SOLPOS_Error`
60
+
61
+ **Example:**
62
+
63
+ >>> location = [35.56836, -119.2022, -8.0]
64
+ >>> weather = [1015.62055, 40.0]
65
+ >>> angles, airmass = get_solpos8760(location, 2013, weather)
66
+ """
67
+ datetimes = [
68
+ (pydatetime.datetime(year, 1, 1, 0, 0, 0)
69
+ + pydatetime.timedelta(hours=h)).timetuple()[:6]
70
+ for h in range(8760)]
71
+ return get_solposAM(location, datetimes, weather)
72
+
73
+
74
+ def get_solposAM(location, datetimes, weather):
75
+ """
76
+ Get SOLPOS hourly calculation for sequence of datetimes.
77
+
78
+ :param location: [latitude, longitude, UTC-timezone]
79
+ :type location: float
80
+ :param datetimes: [year, month, day, hour, minute, second]
81
+ :type datetimes: int
82
+ :param weather: [ambient-pressure (mB), ambient-temperature (C)]
83
+ :type weather: float
84
+ :returns: angles [degrees], airmass [atm]
85
+ :rtype: float
86
+ :raises: :exc:`~solar_utils.exceptions.SOLPOS_Error`
87
+
88
+ **Example:**
89
+
90
+ >>> location = [35.56836, -119.2022, -8.0]
91
+ >>> datetimes = [
92
+ ... (datetime.datetime(2013, 1, 1, 0, 0, 0)
93
+ ... + datetime.timedelta(hours=h)).timetuple()[:6]
94
+ ... for h in range(1000)]
95
+ >>> weather = [1015.62055, 40.0]
96
+ >>> angles, airmass = get_solposAM(location, datetimes, weather)
97
+ """
98
+ count = len(datetimes)
99
+ # load the DLL
100
+ solposAM_dll = ctypes.cdll.LoadLibrary(SOLPOSAMDLL)
101
+ _get_solposAM = solposAM_dll.get_solposAM
102
+ # cast Python types as ctypes
103
+ _location = (ctypes.c_float * 3)(*location)
104
+ _datetime = ((ctypes.c_int * 6) * count)(*datetimes)
105
+ _weather = (ctypes.c_float * 2)(*weather)
106
+ # allocate space for results
107
+ angles = ((ctypes.c_float * 2) * count)()
108
+ airmass = ((ctypes.c_float * 2) * count)()
109
+ settings = ((ctypes.c_int * 2) * count)()
110
+ orientation = ((ctypes.c_float * 2) * count)()
111
+ shadowband = ((ctypes.c_float * 3) * count)()
112
+ err_code = (ctypes.c_long * count)()
113
+ # call
114
+ retval = _get_solposAM(
115
+ _location, _datetime, _weather, count, angles, airmass, settings,
116
+ orientation, shadowband, err_code)
117
+ if (retval != 0): raise RuntimeError('solposAM did not execute')
118
+ if all(ec == 0 for ec in err_code):
119
+ return angles, airmass
120
+ else:
121
+ for n, ec in enumerate(err_code):
122
+ if ec == 0: continue
123
+ # convert err_code to bits
124
+ _code = _int2bits(ec)
125
+ data = {'location': location,
126
+ 'datetime': datetimes[n],
127
+ 'weather': weather,
128
+ 'angles': angles[n],
129
+ 'airmass': airmass[n],
130
+ 'settings': settings[n],
131
+ 'orientation': orientation[n],
132
+ 'shadowband': shadowband[n]}
133
+ raise SOLPOS_Error(_code, data)
134
+
135
+
46
136
  def solposAM(location, datetime, weather):
47
137
  """
48
138
  Calculate solar position and air mass by calling functions exported by
@@ -111,7 +201,7 @@ def spectrl2(units, location, datetime, weather, orientation,
111
201
  Calculate solar spectrum by calling functions exported by
112
202
  :data:`SPECTRL2DLL`.
113
203
 
114
- :param units: set ``units`` = 1 for W/m\ :sup:`2`/micron
204
+ :param units: set ``units`` = 1 for W/m:sup:`2`/micron
115
205
  :type units: int
116
206
  :param location: latitude, longitude and UTC-timezone
117
207
  :type location: float
@@ -12,9 +12,13 @@
12
12
  # All configuration values have a default; values that are commented out
13
13
  # serve to show the default.
14
14
 
15
+ from __future__ import unicode_literals, absolute_import, division
15
16
  import sys
16
17
  import os
17
18
 
19
+ if sys.version_info[0] >= 3:
20
+ unicode = str
21
+
18
22
  # If extensions (or modules to document with autodoc) are in another directory,
19
23
  # add these directories to sys.path here. If the directory is relative to the
20
24
  # documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -53,7 +57,7 @@ master_doc = 'index'
53
57
 
54
58
  # General information about the project.
55
59
  project = u'SolarUtils'
56
- copyright = u'2016, SunPower'
60
+ copyright = u'2026, Mark Mikofski'
57
61
  author = unicode(__author__)
58
62
 
59
63
  # The version info for the project you're documenting, acts as replacement for
@@ -70,7 +74,7 @@ release = unicode(__release__)
70
74
  #
71
75
  # This is also used if you do content translation via gettext catalogs.
72
76
  # Usually you set "language" from the command line for these cases.
73
- language = None
77
+ language = 'en'
74
78
 
75
79
  # There are two options for replacing |today|: either, you set today to some
76
80
  # non-false value, then it is used:
@@ -120,7 +124,7 @@ html_theme = 'alabaster'
120
124
  # further. For a list of options available for each theme, see the
121
125
  # documentation.
122
126
  html_theme_options = {
123
- 'github_user': 'SunPower',
127
+ 'github_user': 'mikofski',
124
128
  'github_repo': 'SolarUtils',
125
129
  'github_banner': True,
126
130
  'show_related': True
@@ -296,4 +300,4 @@ texinfo_documents = [
296
300
 
297
301
 
298
302
  # Example configuration for intersphinx: refer to the Python standard library.
299
- intersphinx_mapping = {'https://docs.python.org/2': None}
303
+ intersphinx_mapping = {'python': ('https://docs.python.org/3/', None),}
@@ -30,6 +30,14 @@ that imports :data:`SOLPOSAMDLL` and exports functions called by
30
30
 
31
31
  .. data:: SPECTRL2DLL
32
32
 
33
+ get_solpos8760
34
+ --------------
35
+ .. autofunction:: get_solpos8760
36
+
37
+ get_solposAM
38
+ ------------
39
+ .. autofunction:: get_solposAM
40
+
33
41
  solposAM
34
42
  --------
35
43
  .. autofunction:: solposAM
@@ -2,7 +2,7 @@
2
2
  """
3
3
  Exceptions for solar utilities.
4
4
 
5
- 2013 SunPower Corp.
5
+ 2026 Mark Mikofski
6
6
  """
7
7
 
8
8