Skip to content

SMARTS wrapper function #857

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

Open
shirubana opened this issue Jan 15, 2020 · 9 comments · May be fixed by #858
Open

SMARTS wrapper function #857

shirubana opened this issue Jan 15, 2020 · 9 comments · May be fixed by #858
Milestone

Comments

@shirubana
Copy link

Back in 2018 I sent @cwhanse a Matlab wrapper for SMARTS we used on our UofA laboratory, with permission to publish, but got sidetracked and never documented. I just ported the code to Python and it seems to be working good.

I'll be ding a pull request for the python wrapper.

This is the ` original matlab code_<(https://www.dropbox.com/s/qqmht1vdkq79l8p/SMARTS_MatlabWrapper.rar?dl=0)>

This where some of the highlights from the emails in 2018:

  • Basically [PVlib] can publish the Matlab code and put the responsibility to obtain SMARTS on the user.
  • We need to have a separate license for the UofAz Matlab code. (BSD-3 License included in the dropbox folder)
  • Users will be responsible to obtain a copy of SMARTS Fortran from NREL, honor it’s license, and build their own MEX file (they have to compile the Fortran code using a Matlab compatible compiler, a list and instructions are at https://www.mathworks.com/support/compilers.html).

Couple notes:
-Not sure how the license extends to the Python code
-Right now the functions assume that the SMARTS executable ("smarts295bat.exe") is on the same folder as the function (pvlib folder). This should change depending on how the above wants to be handled, I'd appreciate support for that based on what we decide.

This is kinda related to #71 , but PyRTM had other functionalities as well.

@shirubana shirubana linked a pull request Jan 15, 2020 that will close this issue
7 tasks
@cwhanse
Copy link
Member

cwhanse commented Jan 15, 2020

Thanks @shirubana for this initiative.

Would the python code you are preparing need a license separate from pvlib-python? If yes, can you post the license conditions? I suppose the license could be communicated by putting the conditions as comments in the python file, and adding a statement to the pvlib-python license. I'm not sure what conventional practice would be.

Perhaps the wrapper function can require the path to the SMARTS executable as an input.

@cwhanse
Copy link
Member

cwhanse commented Jan 15, 2020

The license in the Dropbox (for the MATLAB wrapper, not for SMARTS) is the same as for pvlib-python, except for the copyright statement. I think we could put the copyright statement in your python code, and acknowledge the different copyright in pvlib-python's license file.

The SMARTS wrapper is pretty long (line count) with all the comments (which I would retain). I'd put it in it's own file smarts.py rather than adding to irradiance.py

@shirubana
Copy link
Author

Thanks for looking into this :) That sounds good to me. I'll make the changes.

@mikofski
Copy link
Member

super excited about this, thanks Silvana! I wonder if someone will take up spectrl2 now?

@shirubana
Copy link
Author

Hmm... I haven't used that, should look into it. I have a process to go from the SMARTS spectra to spectrally resolved radiance for the cumulative sky for raytrace. That's the motivation behind making this more streamlined.

@mikofski
Copy link
Member

Ah, IMO spectrl2 is much easier and faster to use than SMARTS, although it may not be as accurate? It's especially useful for inline spectral calculations, because it's limited only to 120 bands that matter, so you can accurately calculate spectral mismatch in real time instead of using a correlation or polynomial fit. There's already a python wrapper by SunPower called SolarUtils but we've talked frequently about porting it to pure python to accelerate it using numba.

@CameronTStark CameronTStark added this to the Someday milestone Jan 28, 2020
@kandersolar
Copy link
Member

@mikofski or anyone else: Just curious, do you know if there are any restrictions on the spectrl2 implementations listed at that link? I don't see a license anywhere on that webpage or in the cited technical report, which also includes a code implementation. Mostly I'm interested in whether the method needs to be implemented de novo or if we could just port one of those implementations.

PS I am aware of the irony of me asking you about NREL's licensing, no need to point it out...

@shirubana
Copy link
Author

shirubana commented Jun 12, 2020 via email

@mikofski
Copy link
Member

mikofski commented Jun 12, 2020

I have been distributing a Python extension of SOLPOS and SPECTRL2 for years. My view is if it's on the internet then it's public, but they specifically mention the license & disclaimer, so I distribute it with the package here:

SPECTRL2

image

SOLPOS

image

In a nutshell the license and disclaimers say:

  1. anyone can use the software freely
  2. you may be subject to US laws
  3. usage doesn't imply endorsement
  4. there is no warranty or liability

IMO it's similar to a bsd-2 license

Silvana, AFAIK, this liberal license would allow your port to be a completely license free work. There's no restrictive cop-yright or attribution, in fact the license literally says you can use it anyway you want for free.

paid-up [ie: free] nonexclusive, irrevocable world-wide license to reproduce, prepare derivative works, distribute copies to the public, and perform publicly and display publicly

Therefore it would be awesome if we could pull your port into pvlib. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants