Skip to content

Commit f2458d0

Browse files
committed
updated spa readme
1 parent 75d8f5d commit f2458d0

File tree

1 file changed

+22
-33
lines changed

1 file changed

+22
-33
lines changed

pvlib/spa_c_files/README

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,35 @@
11
README
22
------
33

4-
This folder contains the files required to wrap the NREL SPA algorithm using the Cython package.
4+
NREL provides a fast C implementation of the solar position algorithm
5+
described in
6+
(Reda, I.; Andreas, A. (2003). Solar Position Algorithm for Solar Radiation Applications. 55 pp.; NREL Report No. TP-560-34302)
7+
[http://www.nrel.gov/docs/fy08osti/34302.pdf].
58

6-
**There are 5 files needed for this, described below:**
9+
This folder contains the files required to make NREL's C code accessible
10+
to the pvlib-python package. We use the Cython package to wrap the NREL SPA
11+
algorithm.
712

8-
spa.c : Original C code from NREL
9-
spa.h : header file for spa.c
13+
** Due to license issues, you must download the NREL C files from their
14+
(website)[http://www.nrel.gov/midc/spa/#register] **
1015

11-
cspa_py.pxd: a cython header file- essentially tells cython which parts of the main header file to pay attention to
16+
Download the ``spa.c`` and ``spa.h`` files from NREL,
17+
and copy them into the ``pvlib/spa_c_files`` directory.
1218

13-
spa_py.pyx : the cython code used to define both functions in the python namespace. NOTE: It is possible to provide user access to other paramters of the SPA algorithm through modifying this file
19+
There are a total of 5 files needed to compile the C code, described below:
1420

15-
setup.py: a distutils file which performs the compiling of the cython code
21+
* ``spa.c``: original C code from NREL
22+
* ``spa.h``: header file for spa.c
23+
* ``cspa_py.pxd``: a cython header file- essentially tells cython which parts of the main header file to pay attention to
24+
* ``spa_py.pyx``: the cython code used to define both functions in the python namespace. NOTE: It is possible to provide user access to other paramters of the SPA algorithm through modifying this file
25+
* ``setup.py``: a distutils file which performs the compiling of the cython code
1626

17-
**the process produces two files**
18-
19-
c_adder.c: an intermediate cython c file
20-
c_adder.so: the python module which can be imported into a namespace
21-
22-
in order to process the orignial 5 files, use the following bash command inside this folder
27+
The cython compilation process produces two files:
28+
* ``spa_py.c``: an intermediate cython c file
29+
* ``spa_py.so``: the python module which can be imported into a namespace
2330

31+
To process the original 5 files,
32+
use the following shell command inside this folder
2433

2534
$ python setup.py build_ext --inplace
2635

27-
This folder also contains the original test files from the NREL C code. This can be run to check the underlying code using the following shell commands:
28-
29-
$ gcc spatester.c
30-
$ ./a.out
31-
32-
and should produce the following:
33-
34-
Julian Day: 2452930.312847
35-
L: 2.401826e+01 degrees
36-
B: -1.011219e-04 degrees
37-
R: 0.996542 AU
38-
H: 11.105902 degrees
39-
Delta Psi: -3.998404e-03 degrees
40-
Delta Epsilon: 1.666568e-03 degrees
41-
Epsilon: 23.440465 degrees
42-
Zenith: 50.111622 degrees
43-
Azimuth: 194.340241 degrees
44-
Incidence: 25.187000 degrees
45-
Sunrise: 06:12:43 Local Time
46-
Sunset: 17:20:19 Local Time

0 commit comments

Comments
 (0)