Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/NREL/main' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
cdeline committed Oct 7, 2024
2 parents 5190bde + 84e7121 commit 7cd7517
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 7 deletions.
9 changes: 5 additions & 4 deletions bifacial_radiance/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ def cleanResult(resultsDF, matchers=None):

if matchers is None:
matchers = ['sky','pole','tube','bar','ground', '3267', '1540']

resultsDF.loc[resultsDF.mattype.str.contains('|'.join(matchers)),'Wm2Front'] = np.nan
resultsDF.loc[resultsDF.rearMat.str.contains('|'.join(matchers)),'Wm2Back'] = np.nan

if ('mattype' in resultsDF) & ('Wm2Front' in resultsDF) :
resultsDF.loc[resultsDF.mattype.str.contains('|'.join(matchers)),'Wm2Front'] = np.nan
if ('rearMat' in resultsDF) & ('Wm2Back' in resultsDF) :
resultsDF.loc[resultsDF.rearMat.str.contains('|'.join(matchers)),'Wm2Back'] = np.nan

return resultsDF


Expand Down
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew/v0.4.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Bug fixes
* 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`)
* 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`)

Documentation
~~~~~~~~~~~~~~
Expand Down
10 changes: 10 additions & 0 deletions tests/results/test_irr_1axis_2021-06-17_1300_Back.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
x,y,z,rearMat,Wm2Back
0.187,0.324,0.215,a4.1.a0.test-module.2310,122.371
0.140,0.243,0.232,a4.1.a0.test-module.2310,85.541
0.093,0.162,0.248,a4.1.a0.test-module.2310,69.828
0.047,0.081,0.265,a4.1.a0.test-module.2310,55.036
-0.000,-0.000,0.281,a4.1.tube1.16,0.881
-0.047,-0.081,0.298,a4.1.a0.test-module.2310,58.626
-0.094,-0.162,0.314,a4.1.a0.test-module.2310,235.992
-0.140,-0.243,0.331,a4.1.a0.test-module.2310,328.776
-0.187,-0.324,0.347,a4.1.a0.test-module.2310,397.733
9 changes: 9 additions & 0 deletions tests/results/test_irr_1axis_2021-06-17_1300_Front.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
x,y,z,mattype,Wm2Front
0.184,0.318,0.239,a4.1.a0.test-module.6457,893.281
0.132,0.228,0.257,a4.1.a0.test-module.6457,893.723
0.080,0.138,0.275,a4.1.a0.test-module.6457,894.165
0.028,0.048,0.294,a4.1.a0.test-module.6457,897.640
-0.024,-0.042,0.312,a4.1.a0.test-module.6457,897.709
-0.076,-0.132,0.330,a4.1.a0.test-module.6457,897.779
-0.128,-0.222,0.349,a4.1.a0.test-module.6457,897.849
-0.180,-0.312,0.367,a4.1.a0.test-module.6457,899.870
16 changes: 13 additions & 3 deletions tests/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import bifacial_radiance
import os, pytest
import numpy as np

# try navigating to tests directory so tests run from here.
try:
Expand All @@ -22,7 +23,8 @@
TESTDIR = os.path.dirname(__file__) # this folder
MET_FILENAME = 'USA_CO_Boulder.724699_TMY2.epw'
TEST_FILE = os.path.join('results','test_2001-01-01_1000.csv')

TEST_FILE2_FRONT = os.path.join(TESTDIR, 'results', 'test_irr_1axis_2021-06-17_1300_Front.csv')
TEST_FILE2_BACK = os.path.join(TESTDIR, 'results', 'test_irr_1axis_2021-06-17_1300_Back.csv')


# test load function on a dummy csv file in the /tests/ directory
Expand Down Expand Up @@ -53,7 +55,7 @@ def test_load_trackerdict():
def test_cleanResult():
# example of setting NaN's when the scan intersects undesired material
# test_01_01_10.csv has some ground and sky references
import numpy as np

resultsDF = bifacial_radiance.load.read1Result(TEST_FILE)
cleanedDF = bifacial_radiance.load.cleanResult(resultsDF)
assert np.isnan(cleanedDF.Wm2Front.loc[4])
Expand Down Expand Up @@ -123,4 +125,12 @@ def test_celllevel_module():
'xcell': 0.15,
'ycell': 0.15,
'xcellgap': 0.01,
'ycellgap': 0.01}
'ycellgap': 0.01}

def test_GH419_front_and_back_sensors():
resultsDF_front = bifacial_radiance.load.read1Result(TEST_FILE2_FRONT)
cleanedDF_front = bifacial_radiance.load.cleanResult(resultsDF_front)

resultsDF_back = bifacial_radiance.load.read1Result(TEST_FILE2_BACK)
cleanedDF_back = bifacial_radiance.load.cleanResult(resultsDF_back)
assert np.isnan(cleanedDF_back.Wm2Back.loc[4])

0 comments on commit 7cd7517

Please sign in to comment.