Skip to content

Get solpos8760 - and version 0.3 (Carpenters)#14

Merged
anomam merged 7 commits intoSunPower:masterfrom
mikofski:get_solpos8760
May 23, 2019
Merged

Get solpos8760 - and version 0.3 (Carpenters)#14
anomam merged 7 commits intoSunPower:masterfrom
mikofski:get_solpos8760

Conversation

@mikofski
Copy link
Contributor

Hi @anomam ,

this add a new function, get_solposAM that does some fast C looping over any arbitrary sequence of datetimes.

It's very fast!

In [1]: from solar_utils import solposAM, get_solposAM
   ...: location = [35.56836, -119.2022, -8.0]
   ...: weather = [1015.62055, 40.0]
   ...: from datetime import datetime, timedelta
   ...: times = [(datetime(2017,1,1,0,0,0)+timedelta(hours=h)).timetuple()[:6] for h in range(1000)]

In [2]: %timeit get_solposAM(location, times, weather)
1.82 ms ± 16.5 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

Can you please merge this, and then push the v0.3 ("Carpenters") tag? Then I can upload the latest to PyPI, then if you don't mind you can download the wheels and upload them to GitHub releases.

In addition this also adds a convenience function to get an hourly 8760 solarposition dataset for an arbitrary year:

In [3]: from solar_utils import get_solpos8760

In [4]: %timeit get_solpos8760(location, 2013, weather)
35.5 ms ± 231 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

Both functions return a tuple: (angles, airmass) in which the angles are size [count, 2] with (zenith, azimuth) and the airmass is also size [count, 2] with (relative airmass, absolute airmass).

thanks!

@mikofski
Copy link
Contributor Author

I also updated the docs, so you can rebuild and push that, I think it's in a ghpages branch, not quite sure I remember how to do that, but hopefully won't be to hard?

@mikofski
Copy link
Contributor Author

closes #6 remove confidentiality clauses

@anomam
Copy link
Contributor

anomam commented May 22, 2019

Do the tests pass on your end? I get the following using your branch

AttributeError: .../solar_utils/libsolposAM.so: undefined symbol: get_solposAM

... :(

@mikofski
Copy link
Contributor Author

mikofski commented May 22, 2019

Hi @anomam , thanks for checking. Yes, it does pass, and it also passed on Travis CI not sure why it doesn't show up automatically anymore, perhaps our github-travis configs are out of date?

Can you please check if you are testing in a fresh environment or a your existing development environment?

  • if you are in your existing development environment:
    This happens because when installing, setup.py checks to see if you've already built the SOLPOS and SPECTRL2 libraries separately, and only builds them if they are absent. So you need to delete the existing Linux .so, Windows .dll, and Mac OSX .dylib files from solar_utils first before rebuilding, then you can run the tests, other wise core.py will try to import get_solposAM from the older existing library which doesn't have that symbol yet.

To delete the old libraries, you can just run:

$ python setup.py clean

Then you need to rebuild the libraries by running pip in developer mode

$ pip install --no-deps -e .

This assumes that you created and activated a virtual environment with the requirments.txt first

$ virtualenv -p python3 venv
$ . venv/bin/activate  # <- bin might be Scripts depending on OS
$ pip install -r requirements.txt
$ pip install pytest ipython  # <- original tests were built with nose
  • if in a fresh, new, clean environment:
    then this is a legit bug, I guess.

this should all probably be in a developer doc somewhere, along with how to update the documentation and push releases. I vaguely looked at uploading manylinuxes (pep 513 and pep571) but it was too confusing :(

@anomam anomam merged commit 6ea5aca into SunPower:master May 23, 2019
@mikofski mikofski deleted the get_solpos8760 branch May 23, 2019 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants