Skip to content

spa license fixes #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 13, 2015
Merged

spa license fixes #19

merged 13 commits into from
Mar 13, 2015

Conversation

wholmgren
Copy link
Member

As discussed in #9, this PR:

  • Removes NRELS's spa.c, spa.h, and spatester.c files.
  • Updates setup.py so that it works with or without the spa files. I tested this, but see below.
  • Updates test_solarposition.py to skip the spa tests if the files are missing. @bmu probably won't like the copy/paste test code, but I think that it can be fixed in 0.2.

(Now resolved) Major issue: NREL made a few minor changes to the SPA code that will require modifying the cython code. From the most recent spa.c file:

// Revised 10-JUL-2014 Andreas
// Change second in spa_data structure from an integer to double to allow fractional second
// Revised 08-SEP-2014 Andreas
// Corrected description of azm_rotation in header file
// Limited azimuth180 to range of 0 to 360 deg (instead of -180 to 180) for tech report consistency
// Changed all variables names from azimuth180 to azimuth_astro
// Renamed 2 "utility" function names for consistency

This PR currently works with the 01-APR-2013 version of the spa code. It should probably be updated to work with the latest version. I'm guessing that it would be a hassle to make it work with both versions.

This PR currently works with the 08-SEP-2014 version of the spa code. It does not work with the older code.

@wholmgren
Copy link
Member Author

I think this is ready, but it should definitely be tested in full by somebody else.

pvlib/spa_c_files/spa.c
pvlib/spa_c_files/spa.h
pvlib/spa_c_files/spa_tester.c

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think pvlib/spa_c_files/spa_py.so should be removed from the repo and also be added to the ignore file (also because the SPA tests are passing before SPA is installed!)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'll fix this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, on second thought I already removed the file and line 10 of .gitignore is *.so. You may be seeing the file because of some git oddity when switching between branches.

$ git ls-files pvlib/spa_c_files/
pvlib/spa_c_files/README.md
pvlib/spa_c_files/SPA_NOTICE.md
pvlib/spa_c_files/__init__.py
pvlib/spa_c_files/cspa_py.pxd
pvlib/spa_c_files/setup.py
pvlib/spa_c_files/spa_py.c
pvlib/spa_c_files/spa_py.pyx

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I see. Sorry that I was causing this confusion. The problem that the so will stay in the file structure exists, because it is ignored and will stay at its place, if you switch branches.

@bmu
Copy link
Contributor

bmu commented Mar 11, 2015

I checked out your branch locally and tested it. Everything seems to be ok (the only difference to your install instructions was the use of python setup.py install --inplace instead of pip install . (see my comment above). All tests were ok.

However I'm not sure about a Windows install, which could be a problem in gereneral because of the compilation of the c code (but this is not a problem introduced by this pull request).

@bmu bmu added the license label Mar 12, 2015
@bmu bmu added this to the 0.1 milestone Mar 12, 2015
@robwandrews
Copy link
Contributor

I did testing on @wholmgren's branch. I think the confusion is coming from running the install from the local pvlib-python folder vs site-packages. When doing a pip install, the spa_c_files directory isn't created in site-packages when installing, so it isn't possible to go back and do a python setup.py install --inplace and have it apply globally. That will only work on the pvlib-python folder (the one that isn't in the site-packages directory).

So, I think the only way to propagate this into the site-packages directory properly is using pip, and so I'd reccomend updating the README.md with this:

To use the NREL SPA algorithm, a pip install from the web cannot be used. Instead: 

1. Download the pvlib repository from https://github.com/pvlib/pvlib-python.git
2. Download the SPA files from [NREL](http://www.nrel.gov/midc/spa/)
3. Copy the SPA files into ``pvlib-python/pvlib/spa_c_files`` 
3. From the ``pvlib-python`` directory, run ``pip uninstall pvlib`` followed by ``pip install . ``

@wholmgren
Copy link
Member Author

I updated the readme with @Calama-Consulting's suggestion and rebased on the numerous master changes.

robwandrews added a commit that referenced this pull request Mar 13, 2015
@robwandrews robwandrews merged commit 4186b75 into pvlib:master Mar 13, 2015
@wholmgren wholmgren deleted the spalicense branch October 28, 2015 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants