diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 1a202f81..81b11bf0 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -10,11 +10,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.7' + python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip @@ -26,7 +26,7 @@ jobs: run: | python setup.py sdist bdist_wheel twine upload dist/* - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: dist path: | diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 36248555..9dbc5f78 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -18,6 +18,10 @@ jobs: '-r requirements.txt .[all]', '--upgrade --upgrade-strategy=eager .[all]' ] + include: + - python-version: "3.12" + env: '--upgrade --upgrade-strategy=eager .[all]' + steps: - uses: actions/checkout@v4 diff --git a/bifacial_radiance/gui.py b/bifacial_radiance/gui.py index ece84e4f..3cf2a3e6 100644 --- a/bifacial_radiance/gui.py +++ b/bifacial_radiance/gui.py @@ -371,7 +371,11 @@ def save_inputfile(savetitle=None): if savetitle is None: savetitle = inputvariablefile - bifacial_radiance.load.savedictionariestoConfigurationIniFile(simulationParamsDict, sceneParamsDict, timeControlParamsDict, moduleParamsDict, trackingParamsDict, torquetubeParamsDict, analysisParamsDict, cellModuleDict, inifilename=savetitle) + bifacial_radiance.load.savedictionariestoConfigurationIniFile(simulationParamsDict, sceneParamsDict, + timeControlParamsDict, moduleParamsDict, + trackingParamsDict, torquetubeParamsDict, + analysisParamsDict, cellModuleDict, + inifilename=savetitle) print("Saved all Values to %s " % savetitle) diff --git a/bifacial_radiance/load.py b/bifacial_radiance/load.py index 97321c28..848de612 100644 --- a/bifacial_radiance/load.py +++ b/bifacial_radiance/load.py @@ -660,8 +660,8 @@ def boolConvert(d): else: print("Load Warning: no valid time to restrict weather data passed" "Simulating default day 06/21 at noon") - timeControlParamsDict['starttime']='06_21_12_00' - timeControlParamsDict['endtime']='06_21_12_00' + timeControlParamsDict['starttime']='06_21_12' + timeControlParamsDict['endtime']='06_21_12' #NEEDED sceneParamsDict parameters sceneParamsDict={} @@ -751,11 +751,11 @@ def boolConvert(d): if config.has_section("analysisParamsDict"): analysisParamsDict = boolConvert(confdict['analysisParamsDict']) try: - analysisParamsDict['sensorsy']=ast.literal_eval(analysisParamsDict['sensorsy']) - except: + analysisParamsDict['sensorsy']=ast.literal_eval(str(analysisParamsDict['sensorsy'])) + except ValueError: + print("Load Warning: improper analysisParamsDict['sensorsy']" + " passed: %s, setting to default value: 9" % analysisParamsDict['sensorsy'] ) analysisParamsDict['sensorsy'] = 9 #Default - print("Load Warning: improper or no analysisParamsDict['sensorsy']" - " passed, setting to default value: %s" % analysisParamsDict['sensorsy'] ) try: analysisParamsDict['modWanted']=int(analysisParamsDict['modWanted']) except: @@ -794,13 +794,13 @@ def boolConvert(d): try: cellModuleDict except: cellModuleDict = None - #returnParams = Params(simulationParamsDict, sceneParamsDict, timeControlParamsDict, moduleParamsDict, trackingParamsDict, torquetubeParamsDict, analysisParamsDict, cellModuleDict) - #return returnParams + # end readconfigurationinputfile return (simulationParamsDict, sceneParamsDict, timeControlParamsDict, moduleParamsDict, trackingParamsDict, torquetubeParamsDict, analysisParamsDict, cellModuleDict, frameParamsDict, omegaParamsDict) + def savedictionariestoConfigurationIniFile(simulationParamsDict, sceneParamsDict, timeControlParamsDict=None, moduleParamsDict=None, trackingParamsDict=None, torquetubeParamsDict=None, diff --git a/bifacial_radiance/main.py b/bifacial_radiance/main.py index 5ae244c6..7d40d4a0 100644 --- a/bifacial_radiance/main.py +++ b/bifacial_radiance/main.py @@ -283,8 +283,8 @@ def _subhourlydatatoGencumskyformat(gencumskydata, label='right'): tzinfo = gencumskydata.index.tzinfo padstart = pd.to_datetime('%s-%s-%s %s:%s' % (gencumskydata.index.year[0],1,1,1,0 ) ).tz_localize(tzinfo) padend = pd.to_datetime('%s-%s-%s %s:%s' % (gencumskydata.index.year[0]+1,1,1,0,0) ).tz_localize(tzinfo) - gencumskydata.iloc[0] = 0 # set first datapt to zero to forward fill w zeros - gencumskydata.iloc[-1] = 0 # set last datapt to zero to forward fill w zeros + #gencumskydata.iloc[0] = 0 # set first datapt to zero to forward fill w zeros + #gencumskydata.iloc[-1] = 0 # set last datapt to zero to forward fill w zeros # check if index exists. I'm sure there is a way to do this backwards. if any(gencumskydata.index.isin([padstart])): print("Data starts on Jan. 01") @@ -2747,8 +2747,8 @@ def __init__(self, materialOrAlbedo=None, material_file=None, silent=False): f'{self._nonzeromean(self.ReflAvg):0.3f} avg\n' f'{self.ReflAvg[self.ReflAvg != 0].__len__()} nonzero albedo values.') except IndexError as e: - print('albedo.shape should be 3 column (N x 3)') - raise e + raise Exception('albedo.shape needs to be 3 column (N x 3)') + def printGroundMaterials(self, materialString=None): """ @@ -3529,7 +3529,7 @@ def _getTrackingAngles(self, azimuth=180, limit_angle=45, def _roundArbitrary(x, base=angledelta): # round to nearest 'base' value. # mask NaN's to avoid rounding error message - return base * (x/float(base)).round() + return base * (x/float(base)).round() + 0 #remove negative zeros if angledelta == 0: raise ZeroDivisionError('Angledelta = 0. Use None instead') @@ -4151,11 +4151,12 @@ def _checkSensors(sensors): else: print ("Module's z not set on sceneDict internal dictionary. Setting to default") modulez = 0.02 - - if frontsurfaceoffset is None: - frontsurfaceoffset = 0.001 - if backsurfaceoffset is None: - backsurfaceoffset = 0.001 + + # cdeline 20241014 remove this check - extraneous + #if frontsurfaceoffset is None: + # frontsurfaceoffset = 0.001 + #if backsurfaceoffset is None: + # backsurfaceoffset = 0.001 # The Sensor routine below needs a "hub-height", not a clearance height. # The below complicated check checks to see if height (deprecated) is passed, @@ -4228,7 +4229,7 @@ def _checkSensors(sensors): xstartfront = x1 + x2 + x3 + originx xstartback = x1 + x2 + x4 + originx - + ystartfront = y1 + y2 + y3 + originy ystartback = y1 + y2 + y4 + originy @@ -4291,10 +4292,22 @@ def _checkSensors(sensors): firstsensorxstartfront = xstartfront+xinc_front firstsensorxstartback = xstartback+xinc_back - firstsensorystartfront = ystartfront+yinc_front - firstsensorystartback = ystartback+yinc_back - firstsensorzstartfront = zstartfront + zinc_front - firstsensorzstartback = zstartback + zinc_back + # check to make sure sensorsy don't line up with gaps in between cellModule + if ((getattr(scene.module, 'cellModule', None)) and + (sensorsy_front == scene.module.cellModule.numcellsy-1)): + firstsensorystartfront = ystartfront+yinc_front/2 + firstsensorzstartfront = zstartfront + zinc_front/2 + else: + firstsensorystartfront = ystartfront+yinc_front + firstsensorzstartfront = zstartfront + zinc_front + if ((getattr(scene.module, 'cellModule', None)) and + (sensorsy_back == scene.module.cellModule.numcellsy-1)): + firstsensorystartback = ystartback+yinc_back/2 + firstsensorzstartback = zstartback + zinc_back/2 + else: + firstsensorystartback = ystartback+yinc_back + firstsensorzstartback = zstartback + zinc_back + ## Correct positions for sensorsx other than 1 # TODO: At some point, this equations can include the case where diff --git a/bifacial_radiance/modelchain.py b/bifacial_radiance/modelchain.py index 407a065a..e05d9517 100644 --- a/bifacial_radiance/modelchain.py +++ b/bifacial_radiance/modelchain.py @@ -113,6 +113,7 @@ def runModelChain(simulationParamsDict, sceneParamsDict, timeControlParamsDict=N 'axisofrotationTorqueTube'] """ kwargs = moduleParamsDict + kwargs['rewriteModulefile'] = simulationParamsDict['rewriteModule'] if torquetubeParamsDict: if not 'visible' in torquetubeParamsDict: torquetubeParamsDict['visible'] = simulationParamsDict['torqueTube'] @@ -120,13 +121,9 @@ def runModelChain(simulationParamsDict, sceneParamsDict, timeControlParamsDict=N torquetubeParamsDict['axisofrotation'] = simulationParamsDict[ 'axisofrotationTorqueTube'] - if simulationParamsDict['moduletype'] in A: - if simulationParamsDict['rewriteModule'] is True: - - module = demo.makeModule(name=simulationParamsDict['moduletype'], - tubeParams=torquetubeParamsDict, - cellModule=cellModule, **kwargs) + if (simulationParamsDict['moduletype'] in A) and not (kwargs['rewriteModulefile']): + module = simulationParamsDict['moduletype'] print("\nUsing Pre-determined Module Type: %s " % simulationParamsDict['moduletype']) else: @@ -142,14 +139,14 @@ def runModelChain(simulationParamsDict, sceneParamsDict, timeControlParamsDict=N if simulationParamsDict['tracking'] == False and simulationParamsDict['cumulativeSky'] == True: # Fixed gencumsky condition - scene = demo.makeScene(module=simulationParamsDict['moduletype'], + scene = demo.makeScene(module=module, sceneDict=sceneParamsDict) demo.genCumSky(demo.gencumsky_metfile) octfile = demo.makeOct(demo.getfilelist()) analysis = bifacial_radiance.AnalysisObj(octfile, demo.name) - frontscan, backscan = analysis.moduleAnalysis(scene, analysisParamsDict['modWanted'], - analysisParamsDict['rowWanted'], - analysisParamsDict['sensorsy']) + frontscan, backscan = analysis.moduleAnalysis(scene, modWanted=analysisParamsDict['modWanted'], + rowWanted=analysisParamsDict['rowWanted'], + sensorsy=analysisParamsDict['sensorsy']) analysis.analysis(octfile, demo.name, frontscan, backscan) print('Bifacial ratio yearly average: %0.3f' % (np.mean(analysis.Wm2Back) / np.mean(analysis.Wm2Front))) @@ -182,7 +179,7 @@ def runModelChain(simulationParamsDict, sceneParamsDict, timeControlParamsDict=N trackerdict = demo.gendaylit1axis() trackerdict = demo.makeScene1axis(trackerdict=trackerdict, - module=simulationParamsDict['moduletype'], + module=module, sceneDict=sceneParamsDict, cumulativesky=simulationParamsDict['cumulativeSky']) diff --git a/docs/sphinx/source/conf.py b/docs/sphinx/source/conf.py index 03adb108..9a0318d5 100644 --- a/docs/sphinx/source/conf.py +++ b/docs/sphinx/source/conf.py @@ -112,7 +112,7 @@ def __getattr__(cls, name): # General information about the project. project = u'bifacial_radiance' -copyright = u'2019, NREL' +copyright = u'2024, NREL' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -145,10 +145,7 @@ def __getattr__(cls, name): # https://pydata-sphinx-theme.rtfd.io/en/latest/user_guide/configuring.html html_theme_options = { "github_url": "https://github.com/NREL/bifacial_radiance", - "sphinx-favicon": [ - {"rel": "icon", "sizes": "16x16", "href": "favicon-16x16.png"}, - {"rel": "icon", "sizes": "32x32", "href": "favicon-32x32.png"}, - ], + "icon_links": [ { "name": "StackOverflow", @@ -163,9 +160,15 @@ def __getattr__(cls, name): ], #"use_edit_page_button": True, "show_toc_level": 1, - "footer_start": ["copyright", "sphinx-version", "sidebar-ethical-ads"], - #"left_sidebar_end": [], + #"footer_start": ["copyright"], + #"footer_center": ["sphinx-version"], } +# Add favicons from extension sphinx_favicon +favicons = [ + {"rel": "icon", "sizes": "16x16", "href": "favicon-16x16.png"}, + {"rel": "icon", "sizes": "32x32", "href": "favicon-32x32.png"}, +] + # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -196,7 +199,7 @@ def __getattr__(cls, name): 'tutorials/6 - Exploring Trackerdict Structure': '_images/bifacial_radiance.png', 'tutorials/7 - Multiple Scene Objects':'_images/MultipleSceneObject_AnalysingSceneObj2_Row1_Module4.PNG', 'tutorials/8 - Electrical Mismatch Method':'_images/Mismatch_Definition_Example.PNG', - 'tutorials/9 - Torquetube Shading':'_images/tutorials_9_-_Torquetube_Shading_23_1.png', + 'tutorials/9 - Torquetube Shading':'_images/tutorials_9_-_Torquetube_Shading_24_1.png', 'tutorials/11 - AgriPV Systems': '_images/AgriPV_2.PNG', 'tutorials/13 - Modeling Modules with Glass': '_images/Glass_tilted_reflection.PNG', 'tutorials/14 - Cement Racking Albedo Improvements': '_images/Pavers.PNG', diff --git a/docs/sphinx/source/manualapi.rst b/docs/sphinx/source/manualapi.rst index ff11ff57..49e29d13 100644 --- a/docs/sphinx/source/manualapi.rst +++ b/docs/sphinx/source/manualapi.rst @@ -129,6 +129,8 @@ Mismatch :toctree: generated/ :caption: Mismatch Analysis + mismatch.mad_fn + mismatch.mismatch_fit2 mismatch.analysisIrradianceandPowerMismatch Support diff --git a/docs/sphinx/source/user_guide/installation.rst b/docs/sphinx/source/user_guide/installation.rst index d1c11045..f6dcf5d3 100644 --- a/docs/sphinx/source/user_guide/installation.rst +++ b/docs/sphinx/source/user_guide/installation.rst @@ -116,7 +116,7 @@ Alternative Installation: Windows Subsystem for Linux: PYTHON ------- -You will need python installed to run bifacial_radiance. We suggest using the latest release of `Anaconda with Python 3.9 `_ (Python 3.7 is still supported but in the process of being deprecated). Anaconda will install ``Spyder`` to work with the python scripts, and also it will install ``Jupyter``, which is the tool we use for our `tutorial trainings `_ +You will need python installed to run bifacial_radiance. We suggest using the latest release of `Anaconda with Python 3.11 `_ . Anaconda will install ``Spyder`` to work with the python scripts, and also it will install ``Jupyter``, which is the tool we use for our `tutorial trainings `_ Alternative Installation: Windows Subsystem for Linux: diff --git a/docs/sphinx/source/whatsnew/v0.4.3.rst b/docs/sphinx/source/whatsnew/v0.4.3.rst index 2d497647..b2084f60 100644 --- a/docs/sphinx/source/whatsnew/v0.4.3.rst +++ b/docs/sphinx/source/whatsnew/v0.4.3.rst @@ -2,34 +2,34 @@ v0.4.3 (Aug 27 2024) ------------------------ -Bugfix Release ... +Bugfix Release API Changes ~~~~~~~~~~~~ -* A new function can now be called to compile results and report out final irradiance and performance data: :func:`bifacial_radiance.RadianceObj.compileResults`. (This is a temporary function soon to be deprecated) +* A new function can now be called to compile results and report out final irradiance and performance data: ``RadianceObj.compileResults``. (This is a temporary function soon to be deprecated) * Multiple modules and rows can now be selected in a single analysis scan. ``modWanted`` and ``rowWanted`` inputs in :py:class:`~bifacial_radiance.RadianceObj.analysis1axis` can now be a list, to select multiple rows and modules for scans. (:issue:`405`)(:pull:`408`) -* To support multiple modules and row scans for 1axis simulations, outputs like Wm2Front are now stored in ``trackerdict``.``Results`` (:issue:`405`)(:pull:`408`) -* :func:`.mismatch.mad_fn` has new functionality and input parameter `axis`. If a 2D matrix or dataframe is passed in as data, MAD is calculated along the row (default) or along the columns by passing 'axis=1' -* :func:`bifacial_radiance.mismatch.mismatch_fit3` has been deprecated in favour of :func:`bifacial_radiance.mismatch.mismatch_fit2` which has a greater agreement with anual energy yield data (:issue:`520`) +* To support multiple modules and row scans for 1axis simulations, outputs like Wm2Front are now stored in ``trackerdict.Results`` (:issue:`405`)(:pull:`408`) +* ``mismatch.mismatch.mad_fn`` has new functionality and input parameter ``axis``. If a 2D matrix or dataframe is passed in as data, MAD is calculated along the row (default) or along the columns by passing 'axis=1' +* ``mismatch.mismatch_fit3`` has been deprecated in favour of ``mismatch.mismatch_fit2`` which has a greater agreement with anual energy yield data (:issue:`520`) Enhancements ~~~~~~~~~~~~ -* Added :func:`bifacial_radiance.mismatch.mismatch_fit2`, similar to :func:`bifacial_radiance.mismatch.mismatch_fit3`, with the recommended coefficients of the original publication. (:pull:`520`) +* Added ``mismatch.mismatch_fit2``, similar to ``mismatch.mismatch_fit3``, with the recommended coefficients of the original publication. (:pull:`520`) * Including `pyRadiance` as a requirement to help streamline RADIANCE installation and calls in a future release. (:pull:`532`) Bug fixes ~~~~~~~~~ -* Fixed error passing all of `sceneDict` into :func:`~bifacial_radiance.RadianceObj.makeScene1axis`. (:issue:`502`) -* Fixed Pandas 2.0 errors by re-factoring :func:`.mismatch.mad_fn` (:issue:`449`) +* Fixed error passing all of ``sceneDict`` into py:class:`~bifacial_radiance.RadianceObj.makeScene1axis`. (:issue:`502`) +* Fixed Pandas 2.0 errors by re-factoring py:class:`bifacial_radiance.mismatch.mad_fn` (:issue:`449`) * Switch from un-supported Versioneer to setuptools_scm (:issue:`519`) * Numpy 2.0 compatibility bug (:issue:`521`) -* Fixed bug in :func:`bifacial_radiance.mismatch.mismatch_fit3` where the function was not returning the correct values. It has also been deprecated in favour of :func:`bifacial_radiance.mismatch.mismatch_fit2` which has a greater agreement with anual energy yield data (:issue:`520`) +* Fixed bug in ``mismatch.mismatch_fit3`` where the function was not returning the correct values. It has also been deprecated in favour of ``mismatch.mismatch_fit2`` which has a greater agreement with anual energy yield data (:issue:`520`) * Updated Github Actions to use Node20: checkout@v4, setup-python@v5, coactions/setup-xvfb, setup-buildx-action@v3 (:pull:`517`) * Updated Github Actions to make Coveralls fail silently if it has an internal server error (:pull:`517`) * Fix PerformanceWarning and SettingWithCopyWarning (:issue:`515`) * Switch from Versioneer to setuptools_scm (:pull:`522`) -* Enable `coerce_year`=None if the TMYfile is all the same year (:issue:`526`) +* Enable ``coerce_year=None`` if the TMYfile is all the same year (:issue:`526`) Documentation ~~~~~~~~~~~~~~ @@ -37,7 +37,7 @@ Documentation * Updates to example notebooks * Reduce number of digits in makeScene .rad file titles. (:pull:`503`) * Reduce number of digits saved to files in \results (:pull:`534`) -* In the sceneDict reported in the trackerdict, save both `clearance_height` and `hub_height` parameters. (:pull:`503`) +* In the sceneDict reported in the trackerdict, save both ``clearance_height`` and ``hub_height`` parameters. (:pull:`503`) Contributors ~~~~~~~~~~~~ diff --git a/docs/sphinx/source/whatsnew/pending.rst b/docs/sphinx/source/whatsnew/v0.4.4.rst similarity index 52% rename from docs/sphinx/source/whatsnew/pending.rst rename to docs/sphinx/source/whatsnew/v0.4.4.rst index 32ba541e..4ba8d80b 100644 --- a/docs/sphinx/source/whatsnew/pending.rst +++ b/docs/sphinx/source/whatsnew/v0.4.4.rst @@ -1,14 +1,14 @@ .. _whatsnew_0440: -v0.4.4 (XX / XX / 2024) ------------------------- -Bugfix Release ... +v0.4.4 (October / 14 / 2024) +---------------------------- +Bugfix Release with important updates to correct the indexing of trackerdict and gendaylit1axis API Changes ~~~~~~~~~~~~ -* New input parameter to :py:class:`~bifacial_radiance.ModuleObj and :py:func:`~bifacial_radiance.RadianceObj.makeModule`: `glassEdge`. If :py:class:`~bifacial_radiance.RadianceObj.makeModule` `glass` = True, then this extends the glass past the absorber edge by this total amount (half in each x and y direction). Default 10mm. -* Module glass thickness can be changed. In :py:func:`~bifacial_radiance.RadianceObj.makeModule`, if `glass` = True, then setting the `z` parameter will indicate the total (front + back) glass thickness with the 1mm absorber in the middle. The default is z = 10mm. +* New input parameter to :py:class:`~bifacial_radiance.ModuleObj and :py:func:`~bifacial_radiance.RadianceObj.makeModule`: ``glassEdge``. If :py:class:`~bifacial_radiance.RadianceObj.makeModule` ``glass`` = True, then this extends the glass past the absorber edge by this total amount (half in each x and y direction). Default 10mm. +* Module glass thickness can be changed. In :py:func:`~bifacial_radiance.RadianceObj.makeModule`, if ``glass`` = True, then setting the ``z`` parameter will indicate the total (front + back) glass thickness with the 1mm absorber in the middle. The default is z = 10mm. Enhancements ~~~~~~~~~~~~ @@ -17,22 +17,24 @@ Enhancements Deprecations ~~~~~~~~~~~~~~ -* .ini files loaded with :py:func:`bifacial_radiance.load.readconfigurationinputfile` use `azimuth` key instead of `axis_azimuth` (:issue:`438`)(:pull:`551`) -* :py:func:`bifacial_radiance.load.deepcleanResult` is now deprecated in favor of :py:func:`~bifacial_radiance.load.cleanResult` (:issue:`556`) +* .ini files loaded with :py:func:`bifacial_radiance.load.readconfigurationinputfile` use ``azimuth`` key instead of ``axis_azimuth`` (:issue:`438`)(:pull:`551`) +* :py:func:`bifacial_radiance.load.deepcleanResult` is now deprecated in favor of :py:func:`~bifacial_radiance.load.cleanResult` and will be removed to its own example notebook in a future release (:issue:`556`) * :py:func:`bifacial_radiance.mismatch.analysisIrradianceandPowerMismatch` is being removed to its own example notebook in a future release. (:issue:`556`) Bug fixes ~~~~~~~~~ * Fixed a major error with indexing the irradiance conditions with :py:func:`~bifacial_radiance.RadianceObj.gendaylit1axis`. This could result in the trackerdict entry being mismatched from the metdata resource. (:issue:`441`) * versioning with setuptools_scm- set fallback_version to bifirad v0.4.3 to prevent crashes if git is not present (:issue:`535`)(:pull:`539`) -* :py:func:`bifacial_radiance.load.readconfigurationinputfile` now properly handles loading moduleObj parameters from .ini files: `glass`, `glassEdge`, `frameParamsDict`, `omegaParamsDict` (:pull:`551`) +* :py:func:`bifacial_radiance.load.readconfigurationinputfile` now properly handles loading moduleObj parameters from .ini files: ``glass``, ``glassEdge``, ``frameParamsDict``, ``omegaParamsDict`` (:pull:`551`) * Fixed a leap year bug in :py:func:`~bifacial_radiance.RadianceObj.readWeatherFile` that crashed if epwfiles are loaded that include leap year data (like Feb. 28 2020). (:issue:`552`) * Bug fix in :py:func:`bifacial_radiance.load.cleanResult` that wouldn't work with files created when front and rear scan are different lengths. (:issue:`419`) +* GUI bug fixes where the sensorsy was not loading correctly, module .rad file was not being re-written, and an invalid default timestamp is used. +* Bug fix in :py:func:`bifacial_radiance.AnalysisObj.moduleAnalysis` when sensorsY equals numCellsy-1 and the scan lines up in the gaps between cells. shift scan by half a cell. Documentation ~~~~~~~~~~~~~~ -* No longer provide a warning message when both `hub_height` and `clearance_height` are passed to :py:func:`~bifacial_radiance.AnalysisObj.moduleAnalysis` (:pull:`540`) -* More useful __repr__ output in :py:class:`~bifacial_radiance.AnalysisObj and :py:class:`~bifacial_radiance.MetObj (:issue:`471`) +* No longer provide a warning message when both ``hub_height`` and ``clearance_height`` are passed to :py:func:`~bifacial_radiance.AnalysisObj.moduleAnalysis` (:pull:`540`) +* More useful ``__repr__`` output in :py:class:`~bifacial_radiance.AnalysisObj` and :py:class:`~bifacial_radiance.MetObj` (:issue:`471`) Contributors ~~~~~~~~~~~~ diff --git a/docs/tutorials/1 - Fixed Tilt Yearly Results.ipynb b/docs/tutorials/1 - Fixed Tilt Yearly Results.ipynb index 1c950d97..b2adf4e8 100644 --- a/docs/tutorials/1 - Fixed Tilt Yearly Results.ipynb +++ b/docs/tutorials/1 - Fixed Tilt Yearly Results.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -10,9 +10,9 @@ "output_type": "stream", "text": [ "Working on a Windows 10\n", - "Python version 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023, 18:05:47) [MSC v.1916 64 bit (AMD64)]\n", - "Pandas version 2.1.4\n", - "bifacial_radiance version 0+untagged.1553.g23d2640.dirty\n" + "Python version 3.9.13 (main, Aug 25 2022, 23:51:50) [MSC v.1916 64 bit (AMD64)]\n", + "Pandas version 1.5.3\n", + "bifacial_radiance version 0.4.4.dev\n" ] } ], @@ -95,14 +95,14 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Your simulation will be stored in C:\\Users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\TEMP\\Tutorial_01\n" + "Your simulation will be stored in C:\\Users\\cdeline\\Documents\\Python Scripts\\Bifacial_Radiance\\bifacial_radiance\\TEMP\\Tutorial_01\n" ] } ], @@ -130,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -158,20 +158,14 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "path = C:\\Users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\TEMP\\Tutorial_01\n", - "Making path: images\n", - "Making path: objects\n", - "Making path: results\n", - "Making path: skies\n", - "Making path: EPWs\n", - "Making path: materials\n" + "path = C:\\Users\\cdeline\\Documents\\Python Scripts\\Bifacial_Radiance\\bifacial_radiance\\TEMP\\Tutorial_01\n" ] } ], @@ -213,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -240,7 +234,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -275,7 +269,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -303,7 +297,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -341,7 +335,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -400,7 +394,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -410,7 +404,9 @@ "\n", "Module Name: test-module\n", "Module test-module updated in module.json\n", - "{'x': 1.695, 'y': 0.984, 'z': 0.02, 'modulematerial': 'black', 'scenex': 1.705, 'sceney': 0.984, 'scenez': 0.1, 'numpanels': 1, 'bifi': 1, 'text': '! genbox black test-module 1.695 0.984 0.02 | xform -t -0.8475 -0.492 0 -a 1 -t 0 0.984 0', 'modulefile': 'objects\\\\test-module.rad', 'glass': False, 'offsetfromaxis': 0, 'xgap': 0.01, 'ygap': 0.0, 'zgap': 0.1}\n" + "Pre-existing .rad file objects\\test-module.rad will be overwritten\n", + "\n", + " : {'x': 1.695, 'y': 0.984, 'z': 0.02, 'modulematerial': 'black', 'scenex': 1.705, 'sceney': 0.984, 'scenez': 0.1, 'numpanels': 1, 'bifi': 1, 'text': '! genbox black test-module 1.695 0.984 0.02 | xform -t -0.8475 -0.492 0 -a 1 -t 0 0.984 0', 'modulefile': 'objects\\\\test-module.rad', 'glass': False, 'glassEdge': 0.01, 'offsetfromaxis': 0, 'xgap': 0.01, 'ygap': 0.0, 'zgap': 0.1}\n" ] } ], @@ -430,7 +426,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -466,7 +462,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -483,7 +479,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -510,7 +506,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -535,7 +531,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -543,10 +539,10 @@ "text/plain": [ "['materials\\\\ground.rad',\n", " 'skies\\\\cumulative.rad',\n", - " 'objects\\\\test-module_C_0.20000_rtr_3.00000_tilt_10.00000_20modsx7rows_origin0,0.rad']" + " 'objects\\\\test-module_C_0.20_rtr_3.00_tilt_10_20modsx7rows_origin0,0.rad']" ] }, - "execution_count": 14, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -581,7 +577,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -598,7 +594,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -618,7 +614,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -645,7 +641,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -683,141 +679,141 @@ " \n", " \n", " 0\n", - " 4.791638e-17\n", - " -0.391267\n", - " 0.237768\n", - " 0.216102\n", + " 0.0\n", + " -0.391\n", + " 0.238\n", + " 0.216\n", " a9.3.a0.test-module.6457\n", " a9.3.a0.test-module.2310\n", - " 1630504.0\n", - " 458830.5\n", - " 0.281404\n", + " 1630394.0\n", + " 435239.3\n", + " 0.267\n", " \n", " \n", " 1\n", - " 3.604893e-17\n", - " -0.294362\n", - " 0.254855\n", - " 0.233189\n", + " 0.0\n", + " -0.294\n", + " 0.255\n", + " 0.233\n", " a9.3.a0.test-module.6457\n", " a9.3.a0.test-module.2310\n", - " 1630508.0\n", - " 333521.6\n", - " 0.204551\n", + " 1630987.0\n", + " 330362.8\n", + " 0.203\n", " \n", " \n", " 2\n", - " 2.418148e-17\n", - " -0.197457\n", - " 0.271942\n", - " 0.250276\n", + " 0.0\n", + " -0.197\n", + " 0.272\n", + " 0.250\n", " a9.3.a0.test-module.6457\n", " a9.3.a0.test-module.2310\n", - " 1630530.0\n", - " 257268.7\n", - " 0.157782\n", + " 1631598.0\n", + " 260892.0\n", + " 0.160\n", " \n", " \n", " 3\n", - " 1.231403e-17\n", - " -0.100552\n", - " 0.289029\n", - " 0.267363\n", + " 0.0\n", + " -0.101\n", + " 0.289\n", + " 0.267\n", " a9.3.a0.test-module.6457\n", " a9.3.a0.test-module.2310\n", - " 1630552.0\n", - " 214210.7\n", - " 0.131373\n", + " 1632208.0\n", + " 218605.1\n", + " 0.134\n", " \n", " \n", " 4\n", - " 4.465811e-19\n", - " -0.003647\n", - " 0.306116\n", - " 0.284450\n", + " 0.0\n", + " -0.004\n", + " 0.306\n", + " 0.284\n", " a9.3.a0.test-module.6457\n", " a9.3.a0.test-module.2310\n", - " 1630574.0\n", - " 201831.5\n", - " 0.123779\n", + " 1632819.0\n", + " 206471.0\n", + " 0.126\n", " \n", " \n", " 5\n", - " -1.142087e-17\n", - " 0.093258\n", - " 0.323203\n", - " 0.301537\n", + " -0.0\n", + " 0.093\n", + " 0.323\n", + " 0.302\n", " a9.3.a0.test-module.6457\n", " a9.3.a0.test-module.2310\n", - " 1630597.0\n", - " 207844.9\n", - " 0.127466\n", + " 1633430.0\n", + " 212833.6\n", + " 0.130\n", " \n", " \n", " 6\n", - " -2.328832e-17\n", - " 0.190164\n", - " 0.340290\n", - " 0.318624\n", + " -0.0\n", + " 0.190\n", + " 0.340\n", + " 0.319\n", " a9.3.a0.test-module.6457\n", " a9.3.a0.test-module.2310\n", - " 1630619.0\n", - " 229892.0\n", - " 0.140984\n", + " 1634041.0\n", + " 233727.4\n", + " 0.143\n", " \n", " \n", " 7\n", - " -3.515577e-17\n", - " 0.287069\n", - " 0.357377\n", - " 0.335711\n", + " -0.0\n", + " 0.287\n", + " 0.357\n", + " 0.336\n", " a9.3.a0.test-module.6457\n", " a9.3.a0.test-module.2310\n", - " 1630641.0\n", - " 273866.3\n", - " 0.167950\n", + " 1635704.0\n", + " 277579.4\n", + " 0.170\n", " \n", " \n", " 8\n", - " -4.702322e-17\n", - " 0.383974\n", - " 0.374464\n", - " 0.352798\n", + " -0.0\n", + " 0.384\n", + " 0.374\n", + " 0.353\n", " a9.3.a0.test-module.6457\n", " a9.3.a0.test-module.2310\n", - " 1639338.0\n", - " 328478.5\n", - " 0.200373\n", + " 1635450.0\n", + " 327750.6\n", + " 0.200\n", " \n", " \n", "\n", "" ], "text/plain": [ - " x y z rearZ mattype \\\n", - "0 4.791638e-17 -0.391267 0.237768 0.216102 a9.3.a0.test-module.6457 \n", - "1 3.604893e-17 -0.294362 0.254855 0.233189 a9.3.a0.test-module.6457 \n", - "2 2.418148e-17 -0.197457 0.271942 0.250276 a9.3.a0.test-module.6457 \n", - "3 1.231403e-17 -0.100552 0.289029 0.267363 a9.3.a0.test-module.6457 \n", - "4 4.465811e-19 -0.003647 0.306116 0.284450 a9.3.a0.test-module.6457 \n", - "5 -1.142087e-17 0.093258 0.323203 0.301537 a9.3.a0.test-module.6457 \n", - "6 -2.328832e-17 0.190164 0.340290 0.318624 a9.3.a0.test-module.6457 \n", - "7 -3.515577e-17 0.287069 0.357377 0.335711 a9.3.a0.test-module.6457 \n", - "8 -4.702322e-17 0.383974 0.374464 0.352798 a9.3.a0.test-module.6457 \n", + " x y z rearZ mattype \\\n", + "0 0.0 -0.391 0.238 0.216 a9.3.a0.test-module.6457 \n", + "1 0.0 -0.294 0.255 0.233 a9.3.a0.test-module.6457 \n", + "2 0.0 -0.197 0.272 0.250 a9.3.a0.test-module.6457 \n", + "3 0.0 -0.101 0.289 0.267 a9.3.a0.test-module.6457 \n", + "4 0.0 -0.004 0.306 0.284 a9.3.a0.test-module.6457 \n", + "5 -0.0 0.093 0.323 0.302 a9.3.a0.test-module.6457 \n", + "6 -0.0 0.190 0.340 0.319 a9.3.a0.test-module.6457 \n", + "7 -0.0 0.287 0.357 0.336 a9.3.a0.test-module.6457 \n", + "8 -0.0 0.384 0.374 0.353 a9.3.a0.test-module.6457 \n", "\n", " rearMat Wm2Front Wm2Back Back/FrontRatio \n", - "0 a9.3.a0.test-module.2310 1630504.0 458830.5 0.281404 \n", - "1 a9.3.a0.test-module.2310 1630508.0 333521.6 0.204551 \n", - "2 a9.3.a0.test-module.2310 1630530.0 257268.7 0.157782 \n", - "3 a9.3.a0.test-module.2310 1630552.0 214210.7 0.131373 \n", - "4 a9.3.a0.test-module.2310 1630574.0 201831.5 0.123779 \n", - "5 a9.3.a0.test-module.2310 1630597.0 207844.9 0.127466 \n", - "6 a9.3.a0.test-module.2310 1630619.0 229892.0 0.140984 \n", - "7 a9.3.a0.test-module.2310 1630641.0 273866.3 0.167950 \n", - "8 a9.3.a0.test-module.2310 1639338.0 328478.5 0.200373 " + "0 a9.3.a0.test-module.2310 1630394.0 435239.3 0.267 \n", + "1 a9.3.a0.test-module.2310 1630987.0 330362.8 0.203 \n", + "2 a9.3.a0.test-module.2310 1631598.0 260892.0 0.160 \n", + "3 a9.3.a0.test-module.2310 1632208.0 218605.1 0.134 \n", + "4 a9.3.a0.test-module.2310 1632819.0 206471.0 0.126 \n", + "5 a9.3.a0.test-module.2310 1633430.0 212833.6 0.130 \n", + "6 a9.3.a0.test-module.2310 1634041.0 233727.4 0.143 \n", + "7 a9.3.a0.test-module.2310 1635704.0 277579.4 0.170 \n", + "8 a9.3.a0.test-module.2310 1635450.0 327750.6 0.200 " ] }, - "execution_count": 18, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -840,7 +836,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -983,7 +979,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.7" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/docs/tutorials/1 - Fixed Tilt Yearly Results.py b/docs/tutorials/1 - Fixed Tilt Yearly Results.py index 779404da..f1524af8 100644 --- a/docs/tutorials/1 - Fixed Tilt Yearly Results.py +++ b/docs/tutorials/1 - Fixed Tilt Yearly Results.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # coding: utf-8 -# In[2]: +# In[1]: # This information helps with debugging and getting support :) @@ -67,7 +67,7 @@ # # -# In[1]: +# In[2]: import os @@ -86,7 +86,7 @@ # This will load bifacial_radiance and other libraries from python that will be useful for this Jupyter Journal: -# In[2]: +# In[3]: try: @@ -101,7 +101,7 @@ # ## 2. Create a Radiance Object -# In[3]: +# In[4]: # Create a RadianceObj 'object' named bifacial_example. no whitespace allowed @@ -119,7 +119,7 @@ # To see more options of ground materials available (located on ground.rad), run this function without any input. -# In[4]: +# In[5]: # Input albedo number or material name like 'concrete'. @@ -128,7 +128,7 @@ # If a number between 0 and 1 is passed, it assumes it's an albedo value. For this example, we want a high-reflectivity rooftop albedo surface, so we will set the albedo to 0.62 -# In[5]: +# In[6]: albedo = 0.62 @@ -141,7 +141,7 @@ # # There are various options provided in bifacial_radiance to load weatherfiles. getEPW is useful because you just set the latitude and longitude of the location and it donwloads the meteorologicla data for any location. -# In[6]: +# In[7]: # Pull in meteorological data using pyEPW for any global lat/lon @@ -152,7 +152,7 @@ # # To load the data, use readWeatherFile. This reads EPWs, TMY meterological data, or even your own data as long as it follows TMY data format (With any time resoultion). -# In[7]: +# In[8]: # Read in the weather data pulled in above. @@ -167,7 +167,7 @@ # or using gencumulativesky to generate a cumulativesky for the entire year. # -# In[8]: +# In[9]: fullYear = True @@ -196,7 +196,8 @@ # # -# In[9]: +# In[10]: + module_type = 'test-module' @@ -206,7 +207,8 @@ # In case you want to use a pre-defined module or a module you've created previously, they are stored in a JSON format in data/module.json, and the options available can be called with printModules: -# In[10]: +# In[11]: + availableModules = demo.printModules() @@ -221,7 +223,8 @@ # Azimuth gets measured from N = 0, so for South facing modules azimuth should equal 180 degrees # -# In[11]: +# In[12]: + sceneDict = {'tilt':10,'pitch':3,'clearance_height':0.2,'azimuth':180, 'nMods': 20, 'nRows': 7} @@ -229,7 +232,8 @@ # To make the scene we have to create a Scene Object through the method makeScene. This method will create a .rad file in the objects folder, with the parameters specified in sceneDict and the module created above. You can alternatively pass a string with the name of the `moduletype`. -# In[12]: +# In[13]: + scene = demo.makeScene(module,sceneDict) @@ -242,7 +246,8 @@ # Radiance requires an "Oct" file that combines the ground, sky and the scene object into it. # The method makeOct does this for us. -# In[13]: +# In[14]: + octfile = demo.makeOct(demo.getfilelist()) @@ -250,7 +255,8 @@ # To see what files got merged into the octfile, you can use the helper method getfilelist. This is useful for advanced simulations too, specially when you want to have different Scene objects in the same simulation, or if you want to add other custom elements to your scene (like a building, for example) -# In[14]: +# In[15]: + demo.getfilelist() @@ -265,7 +271,8 @@ # First let's create the Analysis Object -# In[15]: +# In[16]: + analysis = AnalysisObj(octfile, demo.basename) @@ -273,7 +280,8 @@ # Then let's specify the sensor location. If no parameters are passed to moduleAnalysis, it will scan the center module of the center row: -# In[16]: +# In[17]: + frontscan, backscan = analysis.moduleAnalysis(scene) @@ -284,7 +292,8 @@ # ![Simple example for south facing module](../images_wiki/Journal1Pics/frontscan_backscan.png) # Analysis saves the measured irradiances in the front and in the back on the results folder. Prints out the ratio of the average of the rear and front irradiance values along a chord of the module. -# In[17]: +# In[18]: + results = analysis.analysis(octfile, demo.basename, frontscan, backscan) @@ -292,7 +301,8 @@ # The results are also automatically saved in the results folder. Some of our input/output functions can be used to read the results and work with them, for example: -# In[18]: +# In[19]: + load.read1Result('results\irr_tutorial_1.csv') @@ -304,7 +314,8 @@ # # Assuming that our module has a bifaciality factor (rear to front performance) of 90%, our bifacial gain is of: -# In[19]: +# In[20]: + bifacialityfactor = 0.9 @@ -323,6 +334,7 @@ # In[20]: + ## Comment the ! line below to run rvu from the Jupyter notebook instead of your terminal. ## Simulation will stop until you close the rvu window @@ -338,6 +350,7 @@ # In[21]: + ## Comment the line below to run rvu from the Jupyter notebook instead of your terminal. ## Simulation will stop until you close the rvu window diff --git a/docs/tutorials/11 - AgriPV Systems.py b/docs/tutorials/11 - AgriPV Systems.py index 050585f2..18d18359 100644 --- a/docs/tutorials/11 - AgriPV Systems.py +++ b/docs/tutorials/11 - AgriPV Systems.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # coding: utf-8 -# In[ ]: +# In[1]: # This information helps with debugging and getting support :) @@ -56,7 +56,7 @@ # # The magic is that, for doing the carport we see in the figure, we are going to do a 4-up configuration of modules (**numpanels**), and we are going to repeat that 3-UP 6 times (**nMods**) -# In[1]: +# In[2]: import os @@ -70,7 +70,7 @@ print ("Your simulation will be stored in %s" % testfolder) -# In[2]: +# In[3]: from bifacial_radiance import * @@ -78,7 +78,7 @@ import pandas as pd -# In[3]: +# In[4]: simulationname = 'tutorial_11' @@ -147,7 +147,8 @@ # # ***rvu -vf views\front.vp -e .01 tutorial_11.oct*** -# In[4]: +# In[5]: + ## Comment the ! line below to run rvu from the Jupyter notebook instead of your terminal. @@ -168,7 +169,7 @@ # # Positions of the piles could be done more programatically, but they are kinda estimated at the moment. -# In[5]: +# In[7]: torquetubelength = module.scenex*(nMods) @@ -192,7 +193,7 @@ demo.appendtoScene(radfile=scene.radfiles, customObject=customObject, text="!xform -rz 0") -# In[6]: +# In[8]: name='Pile' @@ -220,7 +221,8 @@ # # -# In[7]: +# In[9]: + ## Comment the ! line below to run rvu from the Jupyter notebook instead of your terminal. @@ -240,7 +242,7 @@ # # We are also increasign the number of points sampled accross the collector width, with the variable **sensorsy** passed to **moduleanalysis**. We are also increasing the step between sampling points, to be able to sample in between the rows. -# In[8]: +# In[10]: analysis = AnalysisObj(octfile, demo.name) @@ -248,13 +250,13 @@ frontscan, backscan = analysis.moduleAnalysis(scene, sensorsy=sensorsy) -# In[9]: +# In[11]: groundscan = frontscan -# In[10]: +# In[12]: groundscan['zstart'] = 0.05 # setting it 5 cm from the ground. @@ -263,7 +265,7 @@ groundscan -# In[11]: +# In[13]: analysis.analysis(octfile, simulationname+"_groundscan", groundscan, backscan) # compare the back vs front irradiance @@ -281,13 +283,13 @@ # ![AgriPV modeled step 4](../images_wiki/AdvancedJournals/spacing_between_modules.PNG) -# In[12]: +# In[14]: import seaborn as sns -# In[13]: +# In[ ]: sensorsx = 20 @@ -306,7 +308,7 @@ # Read all the files generated into one dataframe -# In[14]: +# In[ ]: filestarter = "irr_tutorial_11_groundscan_" @@ -347,21 +349,21 @@ # Creating a new dataframe where each element in the front irradiance list is a column. Also transpose and reverse so it looks like a top-down view of the ground. -# In[15]: +# In[ ]: df3 = pd.DataFrame(resultsdf['br_Wm2Front'].to_list()) reversed_df = df3.T.iloc[::-1] -# In[16]: +# In[ ]: sns.set(rc={'figure.figsize':(11.7,8.27)}) print(sns) -# In[17]: +# In[ ]: # Plot @@ -381,7 +383,7 @@ # # -# In[18]: +# In[ ]: name='Center_Grass' diff --git a/docs/tutorials/21 - Weather to Module Performance.ipynb b/docs/tutorials/21 - Weather to Module Performance.ipynb index 906000da..bc961476 100644 --- a/docs/tutorials/21 - Weather to Module Performance.ipynb +++ b/docs/tutorials/21 - Weather to Module Performance.ipynb @@ -11,9 +11,9 @@ "output_type": "stream", "text": [ "Working on a Windows 10\n", - "Python version 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023, 18:05:47) [MSC v.1916 64 bit (AMD64)]\n", - "Pandas version 2.1.4\n", - "bifacial_radiance version 0+untagged.1554.g980a0b9.dirty\n" + "Python version 3.9.13 (main, Aug 25 2022, 23:51:50) [MSC v.1916 64 bit (AMD64)]\n", + "Pandas version 1.5.3\n", + "bifacial_radiance version 0.4.4.dev\n" ] } ], @@ -49,7 +49,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Your simulation will be stored in C:\\Users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\TEMP\\Tutorial_21\n" + "Your simulation will be stored in C:\\Users\\cdeline\\Documents\\Python Scripts\\Bifacial_Radiance\\bifacial_radiance\\TEMP\\Tutorial_21\n" ] } ], @@ -76,7 +76,7 @@ { "data": { "text/plain": [ - "'0+untagged.1554.g980a0b9.dirty'" + "'0.4.4.dev'" ] }, "execution_count": 3, @@ -103,7 +103,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "path = C:\\Users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\TEMP\\Tutorial_21\n", + "path = C:\\Users\\cdeline\\Documents\\Python Scripts\\Bifacial_Radiance\\bifacial_radiance\\TEMP\\Tutorial_21\n", "Getting weather file: USA_VA_Richmond.724010_TMY2.epw\n", " ... OK!\n", "8760 line in WeatherFile. Assuming this is a standard hourly WeatherFile for the year for purposes of saving Gencumulativesky temporary weather files in EPW folder.\n", @@ -131,11 +131,11 @@ "Linescan in process: 1axis_2021-01-13_1100_Front\n", "Linescan in process: 1axis_2021-01-13_1100_Back\n", "Saved: results\\irr_1axis_2021-01-13_1100.csv\n", - "Index: 2021-01-13_1100. Wm2Front: 255.36876666666663. Wm2Back: 45.574796666666664\n", + "Index: 2021-01-13_1100. Wm2Front: 254.41273333333334. Wm2Back: 45.27032666666667\n", "Linescan in process: 1axis_2021-01-13_1200_Front\n", "Linescan in process: 1axis_2021-01-13_1200_Back\n", "Saved: results\\irr_1axis_2021-01-13_1200.csv\n", - "Index: 2021-01-13_1200. Wm2Front: 254.47736666666665. Wm2Back: 43.65842333333333\n", + "Index: 2021-01-13_1200. Wm2Front: 252.79103333333333. Wm2Back: 43.35205333333334\n", "Saving a cumulative-results file in the main simulation folder.This adds up by sensor location the irradiance over all hours or configurations considered.\n", "Warning: This file saving routine does not clean results, so if your setup has ygaps, or 2+modules or torque tubes, doing a deeper cleaning and working with the individual results files in the results folder is highly suggested.\n", "\n", @@ -221,7 +221,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 7, "id": "7bbf6db6", "metadata": {}, "outputs": [ @@ -229,36 +229,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'2021-01-13_1100': {'surf_azm': 90.0, 'surf_tilt': 44.14, 'theta': -44.14, 'ghi': 211, 'dhi': 149, 'temp_air': 4.6, 'wind_speed': 3.8, 'skyfile': 'skies\\\\sky2_37.5_-77.33_2021-01-13_1100.rad', 'radfile': 'objects\\\\1axis2021-01-13_1100__C_0.80359_rtr_5.00000_tilt_44.14000_3modsx2rows_origin0,0.rad', 'scene': {'module': {'x': 1, 'y': 2, 'z': 0.02, 'modulematerial': 'black', 'scenex': 1.01, 'sceney': 2.0, 'scenez': 0.1, 'numpanels': 1, 'bifi': 0.9, 'text': '! genbox black test-module 1 2 0.02 | xform -t -0.5 -1.0 0 -a 1 -t 0 2.0 0', 'modulefile': 'objects\\\\test-module.rad', 'glass': False, 'offsetfromaxis': 0, 'xgap': 0.01, 'ygap': 0.0, 'zgap': 0.1}, 'modulefile': 'objects\\\\test-module.rad', 'hpc': False, 'name': 'Scene0', 'gcr': 0.4, 'text': '!xform -rx 44.14 -t 0 0 1.5 -a 3 -t 1.01 0 0 -a 2 -t 0 5 0 -i 1 -t -1.01 -0.0 0 -rz 90.0 -t 0 0 0 objects\\\\test-module.rad', 'radfiles': 'objects\\\\1axis2021-01-13_1100__C_0.80359_rtr_5.00000_tilt_44.14000_3modsx2rows_origin0,0.rad', 'sceneDict': {'tilt': 0, 'pitch': 5, 'clearance_height': 1.5, 'azimuth': 90.0, 'nMods': 3, 'nRows': 2, 'modulez': 0.02, 'axis_tilt': 0, 'originx': 0, 'originy': 0}}, 'octfile': '1axis_2021-01-13_1100.oct', 'AnalysisObj': {'octfile': '1axis_2021-01-13_1100.oct', 'name': '1axis_2021-01-13_1100', 'hpc': False, 'x': [0.3734448, 0.01462469, -0.3441954], 'y': [2.28669e-17, 8.955042e-19, -2.107589e-17], 'z': [1.166863, 1.51507, 1.863277], 'rearZ': [1.151075, 1.499282, 1.847489], 'mattype': ['a1.0.a0.test-module.6457', 'a1.0.a0.test-module.6457', 'a1.0.a0.test-module.6457'], 'rearMat': ['a1.0.a0.test-module.2310', 'a1.0.a0.test-module.2310', 'a1.0.a0.test-module.2310'], 'Wm2Front': [254.9108, 255.7401, 255.45539999999997], 'Wm2Back': [45.16279, 45.26495, 46.29665], 'Back/FrontRatio': [0.17717026045871553, 0.1769952111725491, 0.1812311220231711], 'backRatio': [0.17717026045871553, 0.1769952111725491, 0.1812311220231711], 'rearX': [0.3581237, -0.000696414, -0.3595166], 'rearY': [2.192875e-17, -4.264306e-20, -2.201404e-17]}, 'Wm2Front': [254.9108, 255.7401, 255.45539999999997], 'Wm2Back': [45.16279, 45.26495, 46.29665], 'backRatio': [0.17717026045871553, 0.1769952111725491, 0.1812311220231711]}, '2021-01-13_1200': {'surf_azm': 90.0, 'surf_tilt': 21.2, 'theta': -21.2, 'ghi': 249, 'dhi': 200, 'temp_air': 6.5, 'wind_speed': 3.9, 'skyfile': 'skies\\\\sky2_37.5_-77.33_2021-01-13_1200.rad', 'radfile': 'objects\\\\1axis2021-01-13_1200__C_1.13838_rtr_5.00000_tilt_21.20000_3modsx2rows_origin0,0.rad', 'scene': {'module': {'x': 1, 'y': 2, 'z': 0.02, 'modulematerial': 'black', 'scenex': 1.01, 'sceney': 2.0, 'scenez': 0.1, 'numpanels': 1, 'bifi': 0.9, 'text': '! genbox black test-module 1 2 0.02 | xform -t -0.5 -1.0 0 -a 1 -t 0 2.0 0', 'modulefile': 'objects\\\\test-module.rad', 'glass': False, 'offsetfromaxis': 0, 'xgap': 0.01, 'ygap': 0.0, 'zgap': 0.1}, 'modulefile': 'objects\\\\test-module.rad', 'hpc': False, 'name': 'Scene0', 'gcr': 0.4, 'text': '!xform -rx 21.2 -t 0 0 1.5 -a 3 -t 1.01 0 0 -a 2 -t 0 5 0 -i 1 -t -1.01 -0.0 0 -rz 90.0 -t 0 0 0 objects\\\\test-module.rad', 'radfiles': 'objects\\\\1axis2021-01-13_1200__C_1.13838_rtr_5.00000_tilt_21.20000_3modsx2rows_origin0,0.rad', 'sceneDict': {'tilt': 21.2, 'pitch': 5, 'clearance_height': 1.1383754299179079, 'azimuth': 90.0, 'nMods': 3, 'nRows': 2, 'modulez': 0.02, 'axis_tilt': 0, 'originx': 0, 'originy': 0}}, 'octfile': '1axis_2021-01-13_1200.oct', 'AnalysisObj': {'octfile': '1axis_2021-01-13_1200.oct', 'name': '1axis_2021-01-13_1200', 'hpc': False, 'x': [0.473756, 0.007594116, -0.4585678], 'y': [2.900919e-17, 4.650055e-19, -2.807918e-17], 'z': [1.338767, 1.519579, 1.700391], 'rearZ': [1.318255, 1.499068, 1.67988], 'mattype': ['a1.0.a0.test-module.6457', 'a1.0.a0.test-module.6457', 'a1.0.a0.test-module.6457'], 'rearMat': ['a1.0.a0.test-module.2310', 'a1.0.a0.test-module.2310', 'a1.0.a0.test-module.2310'], 'Wm2Front': [254.43140000000002, 254.5634, 254.43729999999996], 'Wm2Back': [43.32023999999999, 43.42238, 44.23265], 'Back/FrontRatio': [0.17026227791743498, 0.1705752257581971, 0.17384430724462474], 'backRatio': [0.17026227791743498, 0.1705752257581971, 0.17384430724462474], 'rearX': [0.4658003, -0.0003616246, -0.4665235], 'rearY': [2.852204e-17, -2.214312e-20, -2.856633e-17]}, 'Wm2Front': [254.43140000000002, 254.5634, 254.43729999999996], 'Wm2Back': [43.32023999999999, 43.42238, 44.23265], 'backRatio': [0.17026227791743498, 0.1705752257581971, 0.17384430724462474]}}\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "c:\\users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\performance.py:57: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead\n", - " alpha_sc=float(CECMod.alpha_sc),\n", - "c:\\users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\performance.py:58: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead\n", - " a_ref=float(CECMod.a_ref),\n", - "c:\\users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\performance.py:59: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead\n", - " I_L_ref=float(CECMod.I_L_ref),\n", - "c:\\users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\performance.py:60: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead\n", - " I_o_ref=float(CECMod.I_o_ref),\n", - "c:\\users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\performance.py:61: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead\n", - " R_sh_ref=float(CECMod.R_sh_ref),\n", - "c:\\users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\performance.py:62: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead\n", - " R_s=float(CECMod.R_s),\n", - "c:\\users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\performance.py:63: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead\n", - " Adjust=float(CECMod.Adjust)\n" + "{'2021-01-13_1100': {'surf_azm': 90.0, 'surf_tilt': 44.14, 'theta': -44.14, 'dni': 144, 'ghi': 211, 'dhi': 149, 'temp_air': 4.6, 'wind_speed': 3.8, 'skyfile': 'skies\\\\sky2_37.5_-77.33_2021-01-13_1100.rad', 'radfile': 'objects\\\\1axis2021-01-13_1100__C_0.80_rtr_5.00_tilt_44_3modsx2rows_origin0,0.rad', 'scene': : {'gcr': 0.4, 'hpc': False, 'module': : {'x': 1, 'y': 2, 'z': 0.02, 'modulematerial': 'black', 'scenex': 1.01, 'sceney': 2.0, 'scenez': 0.1, 'numpanels': 1, 'bifi': 0.9, 'text': '! genbox black test-module 1 2 0.02 | xform -t -0.5 -1.0 0 -a 1 -t 0 2.0 0', 'modulefile': 'objects\\\\test-module.rad', 'glass': False, 'glassEdge': 0.01, 'offsetfromaxis': 0, 'xgap': 0.01, 'ygap': 0.0, 'zgap': 0.1}, 'modulefile': 'objects\\\\test-module.rad', 'name': 'Scene0', 'radfiles': 'objects\\\\1axis2021-01-13_1100__C_0.80_rtr_5.00_tilt_44_3modsx2rows_origin0,0.rad', 'sceneDict': {'tilt': 0, 'azimuth': 90.0, 'pitch': 5, 'nMods': 3, 'nRows': 2, 'modulez': 0.02, 'axis_tilt': 0, 'originx': 0, 'originy': 0, 'hub_height': 1.5}, 'text': '!xform -rx 44.14 -t 0 0 1.5 -a 3 -t 1.01 0 0 -a 2 -t 0 5 0 -i 1 -t -1.01 -0.0 0 -rz 90.0 -t 0 0 0 \"objects\\\\test-module.rad\"'}, 'octfile': '1axis_2021-01-13_1100.oct', 'AnalysisObj': : {'Back/FrontRatio': [0.176, 0.177, 0.181], 'Wm2Back': [44.704, 45.111, 45.996], 'Wm2Front': [254.061, 254.997, 254.18], 'backRatio': [0.176, 0.177, 0.181], 'hpc': False, 'mattype': ['a1.0.a0.test-module.6457', 'a1.0.a0.test-module.6457', 'a1.0.a0.test-module.6457'], 'name': '1axis_2021-01-13_1100', 'octfile': '1axis_2021-01-13_1100.oct', 'rearMat': ['a1.0.a0.test-module.2310', 'a1.0.a0.test-module.2310', 'a1.0.a0.test-module.2310'], 'rearX': [0.358, -0.001, -0.36], 'rearY': [0.0, -0.0, -0.0], 'rearZ': [1.151, 1.499, 1.847], 'x': [0.373, 0.015, -0.344], 'y': [0.0, 0.0, -0.0], 'z': [1.167, 1.515, 1.863]}, 'Wm2Front': [254.0611, 254.9967, 254.1804], 'Wm2Back': [44.704460000000005, 45.11092, 45.9956], 'backRatio': [0.1759587911774326, 0.17690716426069725, 0.1809558055782209]}, '2021-01-13_1200': {'surf_azm': 90.0, 'surf_tilt': 21.2, 'theta': -21.2, 'dni': 97, 'ghi': 249, 'dhi': 200, 'temp_air': 6.5, 'wind_speed': 3.9, 'skyfile': 'skies\\\\sky2_37.5_-77.33_2021-01-13_1200.rad', 'radfile': 'objects\\\\1axis2021-01-13_1200__C_1.14_rtr_5.00_tilt_21_3modsx2rows_origin0,0.rad', 'scene': : {'gcr': 0.4, 'hpc': False, 'module': : {'x': 1, 'y': 2, 'z': 0.02, 'modulematerial': 'black', 'scenex': 1.01, 'sceney': 2.0, 'scenez': 0.1, 'numpanels': 1, 'bifi': 0.9, 'text': '! genbox black test-module 1 2 0.02 | xform -t -0.5 -1.0 0 -a 1 -t 0 2.0 0', 'modulefile': 'objects\\\\test-module.rad', 'glass': False, 'glassEdge': 0.01, 'offsetfromaxis': 0, 'xgap': 0.01, 'ygap': 0.0, 'zgap': 0.1}, 'modulefile': 'objects\\\\test-module.rad', 'name': 'Scene0', 'radfiles': 'objects\\\\1axis2021-01-13_1200__C_1.14_rtr_5.00_tilt_21_3modsx2rows_origin0,0.rad', 'sceneDict': {'tilt': 21.2, 'azimuth': 90.0, 'pitch': 5, 'nMods': 3, 'nRows': 2, 'modulez': 0.02, 'axis_tilt': 0, 'originx': 0, 'originy': 0, 'hub_height': 1.5}, 'text': '!xform -rx 21.2 -t 0 0 1.5 -a 3 -t 1.01 0 0 -a 2 -t 0 5 0 -i 1 -t -1.01 -0.0 0 -rz 90.0 -t 0 0 0 \"objects\\\\test-module.rad\"'}, 'octfile': '1axis_2021-01-13_1200.oct', 'AnalysisObj': : {'Back/FrontRatio': [0.171, 0.171, 0.173], 'Wm2Back': [43.126, 43.227, 43.703], 'Wm2Front': [252.608, 252.791, 252.974], 'backRatio': [0.171, 0.171, 0.173], 'hpc': False, 'mattype': ['a1.0.a0.test-module.6457', 'a1.0.a0.test-module.6457', 'a1.0.a0.test-module.6457'], 'name': '1axis_2021-01-13_1200', 'octfile': '1axis_2021-01-13_1200.oct', 'rearMat': ['a1.0.a0.test-module.2310', 'a1.0.a0.test-module.2310', 'a1.0.a0.test-module.2310'], 'rearX': [0.466, -0.0, -0.467], 'rearY': [0.0, -0.0, -0.0], 'rearZ': [1.318, 1.499, 1.68], 'x': [0.474, 0.008, -0.459], 'y': [0.0, 0.0, -0.0], 'z': [1.339, 1.52, 1.7]}, 'Wm2Front': [252.60800000000003, 252.7909, 252.9742], 'Wm2Back': [43.126380000000005, 43.22666, 43.70311999999999], 'backRatio': [0.17072384594373122, 0.17099701374925386, 0.17275653898089613]}}\n" ] }, { "data": { "text/plain": [ - "73.50428000429895" + "73.25703819145978" ] }, - "execution_count": 16, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -273,7 +253,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 8, "id": "fe18ea62", "metadata": {}, "outputs": [ @@ -327,58 +307,62 @@ " 2021-01-13_1100\n", " 149\n", " 211\n", - " [45.16279, 45.26495, 46.29665]\n", - " [254.9108, 255.7401, 255.45539999999997]\n", + " [44.704460000000005, 45.11092, 45.9956]\n", + " [254.0611, 254.9967, 254.1804]\n", " -44.14\n", " 44.14\n", " 90.0\n", " NaN\n", " NaN\n", " NaN\n", - " 45.574797\n", - " 255.368767\n", - " 0.160620\n", + " 45.270327\n", + " 254.412733\n", + " 0.160146\n", " \n", " \n", " 1\n", " 2021-01-13_1200\n", " 200\n", " 249\n", - " [43.32023999999999, 43.42238, 44.23265]\n", - " [254.43140000000002, 254.5634, 254.43729999999...\n", + " [43.126380000000005, 43.22666, 43.70311999999999]\n", + " [252.60800000000003, 252.7909, 252.9742]\n", " -21.20\n", " 21.20\n", " 90.0\n", " NaN\n", " NaN\n", " NaN\n", - " 43.658423\n", - " 254.477367\n", - " 0.154405\n", + " 43.352053\n", + " 252.791033\n", + " 0.154344\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Unnamed: 0 dhi ghi Wm2Back \\\n", - "0 2021-01-13_1100 149 211 [45.16279, 45.26495, 46.29665] \n", - "1 2021-01-13_1200 200 249 [43.32023999999999, 43.42238, 44.23265] \n", + " Unnamed: 0 dhi ghi \\\n", + "0 2021-01-13_1100 149 211 \n", + "1 2021-01-13_1200 200 249 \n", + "\n", + " Wm2Back \\\n", + "0 [44.704460000000005, 45.11092, 45.9956] \n", + "1 [43.126380000000005, 43.22666, 43.70311999999999] \n", "\n", - " Wm2Front theta surf_tilt \\\n", - "0 [254.9108, 255.7401, 255.45539999999997] -44.14 44.14 \n", - "1 [254.43140000000002, 254.5634, 254.43729999999... -21.20 21.20 \n", + " Wm2Front theta surf_tilt surf_azm \\\n", + "0 [254.0611, 254.9967, 254.1804] -44.14 44.14 90.0 \n", + "1 [252.60800000000003, 252.7909, 252.9742] -21.20 21.20 90.0 \n", "\n", - " surf_azm clearance_height effective_irradiance Pout_module Wm2BackAvg \\\n", - "0 90.0 NaN NaN NaN 45.574797 \n", - "1 90.0 NaN NaN NaN 43.658423 \n", + " clearance_height effective_irradiance Pout_module Wm2BackAvg \\\n", + "0 NaN NaN NaN 45.270327 \n", + "1 NaN NaN NaN 43.352053 \n", "\n", " Wm2FrontAvg BifiRatio \n", - "0 255.368767 0.160620 \n", - "1 254.477367 0.154405 " + "0 254.412733 0.160146 \n", + "1 252.791033 0.154344 " ] }, - "execution_count": 17, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -387,6 +371,14 @@ "demo.exportTrackerDict(savefile=os.path.join('results','Final_Results.csv'),reindex=False)\n", "pd.read_csv(os.path.join('results','Final_Results.csv'))" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6c84aef5", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -405,7 +397,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.7" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/docs/tutorials/21 - Weather to Module Performance.py b/docs/tutorials/21 - Weather to Module Performance.py index 0ae93bfc..f8221a76 100644 --- a/docs/tutorials/21 - Weather to Module Performance.py +++ b/docs/tutorials/21 - Weather to Module Performance.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # coding: utf-8 -# In[2]: +# In[1]: # This information helps with debugging and getting support :) @@ -20,7 +20,7 @@ # This tutorial shows how to use the new function on bifacial_radiance calculatePerformanceModule performance, as well as how to find CEC Module parameters. # -# In[3]: +# In[2]: import os @@ -36,7 +36,7 @@ print ("Your simulation will be stored in %s" % testfolder) -# In[4]: +# In[3]: import bifacial_radiance @@ -47,7 +47,7 @@ bifacial_radiance.__version__ -# In[5]: +# In[4]: # Selecting only two times as examples @@ -67,7 +67,7 @@ # ## Geting a CEC Module -# In[ ]: +# In[5]: url = 'https://raw.githubusercontent.com/NREL/SAM/patch/deploy/libraries/CEC%20Modules.csv' @@ -78,7 +78,7 @@ # # Make sure you select only 1 module from the database -- sometimes there are similar names. -# In[ ]: +# In[6]: modfilter2 = db.index.str.startswith('SunPower') & db.index.str.endswith('SPR-E19-310-COM') @@ -89,16 +89,25 @@ # ## Calculating the Performance and Exporting the Results to a CSV -# In[ ]: +# In[7]: -demo.calculateResults(CECMod=CECMod) +print(trackerdict) +tracker_dict_sample = trackerdict['2021-01-13_1100'] +eff_irr = tracker_dict_sample['Wm2Front'] + tracker_dict_sample['Wm2Back'] +bifacial_radiance.performance.calculatePerformance(eff_irr[0],CECMod=CECMod) #calculatePerformanceModule -> calculcateResults() +# In[8]: + + +demo.exportTrackerDict(savefile=os.path.join('results','Final_Results.csv'),reindex=False) +pd.read_csv(os.path.join('results','Final_Results.csv')) + + # In[ ]: -#demo.exportTrackerDict(savefile=os.path.join('results','Final_Results.csv'),reindex=False) -#pd.read_csv(os.path.join('results','Final_Results.csv')) + diff --git a/docs/tutorials/4 - Debugging with Custom Objects.ipynb b/docs/tutorials/4 - Debugging with Custom Objects.ipynb index 66e2f250..93728b97 100644 --- a/docs/tutorials/4 - Debugging with Custom Objects.ipynb +++ b/docs/tutorials/4 - Debugging with Custom Objects.ipynb @@ -857,7 +857,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.7" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/docs/tutorials/4 - Debugging with Custom Objects.py b/docs/tutorials/4 - Debugging with Custom Objects.py index 7e11d24a..224d9435 100644 --- a/docs/tutorials/4 - Debugging with Custom Objects.py +++ b/docs/tutorials/4 - Debugging with Custom Objects.py @@ -188,6 +188,7 @@ # In[6]: + ## Comment the line below to run rvu from the Jupyter notebook instead of your terminal. ## Simulation will stop until you close the rvu window @@ -258,8 +259,7 @@ print('CORRECT Annual bifacial ratio average: %0.3f' %( clean_results['Wm2Back'].sum() / clean_results['Wm2Front'].sum() )) -print ("\n(If we had not done the cleaning routine, the bifacial ratio would have been ", \ - "calculated to %0.3f <-- THIS VALUE IS WRONG)" %( sum(analysis.Wm2Back) / sum(analysis.Wm2Front) )) +print ("\n(If we had not done the cleaning routine, the bifacial ratio would have been ", "calculated to %0.3f <-- THIS VALUE IS WRONG)" %( sum(analysis.Wm2Back) / sum(analysis.Wm2Front) )) # @@ -304,6 +304,7 @@ # In[15]: + ## Comment the line below to run rvu from the Jupyter notebook instead of your terminal. ## Simulation will stop until you close the rvu window diff --git a/docs/tutorials/SAT Reflectors Example.ipynb b/docs/tutorials/SAT Reflectors Example.ipynb index bd489e33..795fff0a 100644 --- a/docs/tutorials/SAT Reflectors Example.ipynb +++ b/docs/tutorials/SAT Reflectors Example.ipynb @@ -2,10 +2,21 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "4e0aa4be-9f97-44a7-bff8-4fedaf4c4179", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Working on a Windows 10\n", + "Python version 3.9.13 (main, Aug 25 2022, 23:51:50) [MSC v.1916 64 bit (AMD64)]\n", + "Pandas version 1.5.3\n", + "bifacial_radiance version 0.4.4.dev\n" + ] + } + ], "source": [ "# This information helps with debugging and getting support :)\n", "import sys, platform\n", @@ -36,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "9e16eef3", "metadata": {}, "outputs": [], @@ -47,6 +58,7 @@ "import os\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", + "from pathlib import Path\n", "\n", "#Import bifacial radiance code \n", "try:\n", @@ -65,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "2e309b9a", "metadata": {}, "outputs": [ @@ -73,6 +85,7 @@ "name": "stdout", "output_type": "stream", "text": [ + "Your simulation will be stored in C:\\Users\\cdeline\\Documents\\Python Scripts\\Bifacial_Radiance\\bifacial_radiance\\TEMP\\SAT_Reflectors_example\n", "1 modules selected. Name of 1st entry: LONGi Green Energy Technology Co. Ltd. LR6-60HIBD-305M\n", "305.52\n" ] @@ -80,12 +93,12 @@ ], "source": [ "# Define locations within file system\n", - "testfolder = Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'SAT_Reflectors_example'\n", + "test_folder = Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'SAT_Reflectors_example'\n", "\n", "# Another option using relative address; for some operative systems you might need '/' instead of '\\'\n", "# testfolder = os.path.abspath(r'..\\..\\bifacial_radiance\\TEMP') \n", "\n", - "print (\"Your simulation will be stored in %s\" % testfolder)\n", + "print (\"Your simulation will be stored in %s\" % test_folder)\n", "\n", "if not os.path.exists(test_folder):\n", " os.makedirs(test_folder) \n", @@ -3888,7 +3901,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.7" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/docs/tutorials/SAT Reflectors Example.py b/docs/tutorials/SAT Reflectors Example.py index 357ef69a..ad0f8c34 100644 --- a/docs/tutorials/SAT Reflectors Example.py +++ b/docs/tutorials/SAT Reflectors Example.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # coding: utf-8 -# In[ ]: +# In[1]: # This information helps with debugging and getting support :) @@ -20,7 +20,7 @@ # # Load packages -# In[1]: +# In[2]: """alewis 2022""" @@ -29,6 +29,7 @@ import os import pandas as pd import matplotlib.pyplot as plt +from pathlib import Path #Import bifacial radiance code try: @@ -39,16 +40,16 @@ # # Inputs for location, PV system, reflectors, etc -# In[3]: +# In[4]: # Define locations within file system -testfolder = Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'SAT_Reflectors_example' +test_folder = Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'SAT_Reflectors_example' # Another option using relative address; for some operative systems you might need '/' instead of '\' # testfolder = os.path.abspath(r'..\..\bifacial_radiance\TEMP') -print ("Your simulation will be stored in %s" % testfolder) +print ("Your simulation will be stored in %s" % test_folder) if not os.path.exists(test_folder): os.makedirs(test_folder) diff --git a/requirements.txt b/requirements.txt index 77b53b66..58a5d8ad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,27 +1,29 @@ -docutils<0.18 -coverage==7.2.1 -cycler==0.11.0 -idna==3.4 -importlib-metadata==6.0.0 +docutils<0.20 +coverage==7.6.1 +cycler==0.12.1 +idna==3.10 +importlib-metadata==8.5.0 ipython==8.13.0 -kiwisolver==1.4.4 -matplotlib==3.5.1 -more-itertools==9.1.0 +kiwisolver==1.4.7 +matplotlib==3.7.5 +more-itertools==10.5.0 numba==0.58.1 -numpy==1.24.2 -pandas==1.4.4 -pluggy==1.0.0 -pvlib==0.9.4 +numpy==1.24.4 +pandas==2.0.3 +pluggy==1.5.0 +pvlib==0.11.0 pvmismatch==4.1 py==1.11.0 -pyparsing==3.0.9 +pyparsing==3.1.4 pysmarts==0.0.1 -pytest==7.2.2 -pytest-cov==4.0.0 -python-dateutil==2.8.2 -pytz==2021.3 +pytest==8.3.3 +pytest-cov==5.0.0 +python-dateutil==2.9.0.post0 +pytz==2024.2 six==1.16.0 -sphinx-autoapi==1.8.4 -sphinx-rtd-theme==1.0.0 +sphinx == 7.1.2 +pydata-sphinx-theme == 0.14.4 +sphinx-autoapi==3.3.2 +sphinx-rtd-theme==3.0.1 requests future diff --git a/setup.py b/setup.py index fda4d1ef..312b5831 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html # version='0.3.4', - use_scm_version={"fallback_version":"0.4.3"}, + use_scm_version={"fallback_version":"0.4.4"}, description='Tools to interface with Radiance for the PV researcher', long_description=long_description, long_description_content_type="text/markdown", @@ -74,6 +74,8 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], # What does your project relate to? @@ -112,11 +114,11 @@ 'ipython', 'sphinx >= 1.8.0', 'sphinx-autoapi>=1.1.0', - 'pydata-sphinx-theme==0.8.1', - 'nbsphinx==0.8.8', + 'pydata-sphinx-theme>=0.14.4', + 'nbsphinx>=0.8.8', # sphinx-gallery is used indirectly for nbsphinx thumbnail galleries; see: # https://nbsphinx.readthedocs.io/en/0.6.0/subdir/gallery.html#Creating-Thumbnail-Galleries - 'sphinx-gallery==0.8.1', + 'sphinx-gallery>=0.8.1', 'tqdm', ], 'all': [ diff --git a/tests/ini_cell_level_module.ini b/tests/ini_cell_level_module.ini index b2265a14..0fa63872 100644 --- a/tests/ini_cell_level_module.ini +++ b/tests/ini_cell_level_module.ini @@ -24,8 +24,8 @@ clearance_height = 0.8 hub_height = 0.9 [timeControlParamsDict] -starttime: 06_21_11_00 -endtime: 06_21_12_00 +starttime: 06_21_11 +endtime: 06_21_12 [moduleParamsDict] numpanels = 2 diff --git a/tests/ini_soltec.ini b/tests/ini_soltec.ini index 63cd00ea..f66cd719 100644 --- a/tests/ini_soltec.ini +++ b/tests/ini_soltec.ini @@ -16,8 +16,8 @@ latitude: 37.5 longitude: -77.6 [timeControlParamsDict] -starttime: 06_21_12_00 -endtime: 06_21_12_00 +starttime: 06_21_12 +endtime: 06_21_12 [sceneParamsDict] gcrorpitch: pitch diff --git a/tests/test_bifacial_radiance.py b/tests/test_bifacial_radiance.py index cfa6e60f..fbcc6944 100644 --- a/tests/test_bifacial_radiance.py +++ b/tests/test_bifacial_radiance.py @@ -356,7 +356,7 @@ def test_SingleModule_HPC(): print(demo.getfilelist()) octfile = demo.makeOct(demo.getfilelist()) # makeOct combines all of the ground, sky and object files into a .oct file. analysis = bifacial_radiance.AnalysisObj(octfile, demo.name, hpc=True) # return an analysis object including the scan dimensions for back irradiance - (frontscan,backscan) = analysis.moduleAnalysis(scene, sensorsy=1) + (frontscan,backscan) = analysis.moduleAnalysis(scene, sensorsy=1, debug=True) analysis.analysis(octfile, demo.name, frontscan, backscan) # compare the back vs front irradiance assert analysis.mattype[0][:12] == 'a0.0.a0.test' assert analysis.rearMat[0][:12] == 'a0.0.a0.test' @@ -605,4 +605,5 @@ def test_raypath(): os.environ['RAYPATH'] = raypath0 + \ No newline at end of file diff --git a/tests/test_groundobj.py b/tests/test_groundobj.py index 88aa5905..99445876 100644 --- a/tests/test_groundobj.py +++ b/tests/test_groundobj.py @@ -63,6 +63,8 @@ def test_RGB_timeseries(): albedo_bad = np.array([[0.2, 0.3, 0.4, 0.5], [0.12, 0.13, 0.26, 0.5]]) # invalid ground = pytest.warns(UserWarning, bifacial_radiance.GroundObj, albedo_bad) np.testing.assert_allclose(_groundtest(ground), testvals_const) + with pytest.raises(Exception): + temp = bifacial_radiance.GroundObj(np.array([[.1,.2],[.1,.2]])) def test_printGroundMaterials(): ground = bifacial_radiance.GroundObj('litesoil') @@ -70,4 +72,10 @@ def test_printGroundMaterials(): def test_albedo_greaterthan_one(): ground = bifacial_radiance.GroundObj(2) - assert ground.ReflAvg[0] == 1 \ No newline at end of file + assert ground.ReflAvg[0] == 1 + +def test_repr_and_normval(): + ground = bifacial_radiance.GroundObj() + groundstr = ground.__repr__() + ground = bifacial_radiance.GroundObj([0.1, 0.2]) + assert ground.normval == pytest.approx([0.10034, 0.20068])