Skip to content

Commit cf5ae46

Browse files
authored
Merge pull request #381 from NREL/369_main_updates
GUI default value bug fix and pandas deprecation errors
2 parents 8470659 + ac790b8 commit cf5ae46

File tree

2 files changed

+35
-28
lines changed

2 files changed

+35
-28
lines changed

bifacial_radiance/gui.py

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,12 @@ def read_valuesfromGUI():
317317
if limitangle is not None: trackingParamsDict['limit_angle'] = limitangle
318318
if angledelta is not None: trackingParamsDict['angle_delta'] = angledelta
319319

320-
if diameter is not None: torquetubeParamsDict['diameter'] = diameter
321-
if tubeType is not None: torquetubeParamsDict['tubetype'] = tubeType
322-
323-
if torqueTubeMaterial is not None: torquetubeParamsDict['material'] = torqueTubeMaterial
324-
if invisible: torquetubeParamsDict['visible'] = False
320+
if torqueTube:
321+
if diameter is not None: torquetubeParamsDict['diameter'] = diameter
322+
if tubeType is not None: torquetubeParamsDict['tubetype'] = tubeType
323+
324+
if torqueTubeMaterial is not None: torquetubeParamsDict['material'] = torqueTubeMaterial
325+
if invisible: torquetubeParamsDict['visible'] = False
325326

326327
if sensorsy is not None: analysisParamsDict['sensorsy'] = sensorsy
327328
if modWanted is not None: analysisParamsDict['modWanted'] = modWanted
@@ -403,11 +404,7 @@ def setDefaultValues():
403404
entry_angledelta.insert(0,"5")
404405
entry_axis_azimuth.insert(0,"180")
405406
entry_azimuth.insert(0,"180")
406-
#A="" # TEST OF EMPTY INPUT
407-
#entry_azimuth.insert(0,A)
408-
entry_bifi.insert(0,"0.9")
409407
entry_clearanceheight.insert(0,"0.8")
410-
entry_diameter.insert(0,"0.1")
411408
entry_endtime.insert(0,"06_21_12")
412409
entry_epwfile.insert(0, r"EPWs\\USA_VA_Richmond.Intl.AP.724010_TMY.epw") #FIX
413410
entry_gcr.insert(0,"0.35")
@@ -416,21 +413,24 @@ def setDefaultValues():
416413
entry_hubheight.insert(0,"0.9")
417414
entry_inputvariablefile.insert(0, "BB") #FIX
418415
entry_limitangle.insert(0,"60")
419-
entry_moduletype.insert(0,"Prism Solar Bi60")
420416
entry_modWanted.insert(0,"") #was 10
421417
entry_nMods.insert(0,"20")
422418
entry_nRows.insert(0,"7")
423-
entry_numberofPanels.insert(0,"2")
424-
entry_numcellsx.insert(0,"12")
425-
entry_numcellsy.insert(0,"6")
426419
entry_pitch.insert(0,"10")
427420
entry_rowWanted.insert(0,"") #was 3
428-
entry_sensorsy.insert(0,"9")
421+
entry_sensorsy.insert(0,"10")
429422
entry_simulation.insert(0,"Demo1")
430423
entry_starttime.insert(0,"06_21_12")
431-
#entry_testfolder.insert(0, os.getcwd())
432424
entry_testfolder.insert(0, TEMP_PATH)
433425
entry_tilt.insert(0,"10")
426+
427+
# Module parameters - populate by loading first module in module.json
428+
"""
429+
entry_bifi.insert(0,"0.9")
430+
entry_numberofPanels.insert(0,"2")
431+
entry_numcellsx.insert(0,"12")
432+
entry_numcellsy.insert(0,"6")
433+
entry_diameter.insert(0,"0.1")
434434
entry_x.insert(0,"0.98")
435435
entry_xcell.insert(0,"0.15")
436436
entry_xcellgap.insert(0,"0.01")
@@ -440,6 +440,9 @@ def setDefaultValues():
440440
entry_xgap.insert(0,"0.05")
441441
entry_ygap.insert(0,"0.15")
442442
entry_zgap.insert(0,"0.10")
443+
"""
444+
445+
443446

444447
def activateAllEntries():
445448
entry_albedo.config(state='normal')
@@ -1293,7 +1296,7 @@ def showModule(noprint=False):
12931296
print('Empty module dictionary - returning')
12941297
return
12951298

1296-
moduletype = 'test'
1299+
moduletype = 'test-module'
12971300
print('Creating test module')
12981301

12991302
# need to first create a dummy SceneObj to create the module .rad
@@ -1302,15 +1305,16 @@ def showModule(noprint=False):
13021305

13031306
# create the kwargs for makeModule
13041307
cellModuleParams = (P[7] if P[0]['cellLevelModule'] else None)
1305-
kwargs = {'name':moduletype, 'torquetube':P[0]['torqueTube'],
1306-
'numpanels':P[3]['numpanels'], 'x':P[3]['x'],
1307-
'y':P[3]['y'], 'xgap':P[3]['xgap'], 'ygap':P[3]['ygap'],
1308-
'zgap':P[3]['zgap'], 'diameter':P[5]['diameter'],
1309-
'tubetype':P[5]['tubetype'], 'material':P[5]['torqueTubeMaterial'],
1310-
'cellModule':cellModuleParams}
1308+
kwargs = {'name':moduletype, 'numpanels':P[3]['numpanels'],
1309+
'x':P[3]['x'],'y':P[3]['y'], 'xgap':P[3]['xgap'],
1310+
'ygap':P[3]['ygap'],'zgap':P[3]['zgap']}
13111311

13121312
# Run makeModule with the above kwarg dictionary
13131313
module = demo.makeModule(**kwargs)
1314+
if cellModuleParams: module.addCellModule(**cellModuleParams)
1315+
if P[5]:
1316+
print(f'P5: {P[5]}')
1317+
module.addTorquetube(**P[5])
13141318

13151319
if noprint is False:
13161320
# show module
@@ -1406,7 +1410,7 @@ def enable_cellModule(d):
14061410
entry_ycellgap.insert(0,str(d['cellModule']['ycellgap']))
14071411

14081412

1409-
1413+
14101414
key = entry_modulename_value.get() # what is the value selected?
14111415
#print(key + ' selected')
14121416
if key != '': # '' not a dict key
@@ -1647,10 +1651,10 @@ def clearAllValuesButton():
16471651
buttonImage = Button(imagevariables_frame, image=image_fixed)
16481652
buttonImage.grid(row=0, columnspan=4, sticky=W)
16491653

1650-
#setDefaultValues()
16511654
setDefaults()
1652-
# setDefaultValues()
16531655
setdefaultGray()
1656+
entry_modulename.event_generate('<<ComboboxSelected>>') # populate module params
1657+
16541658

16551659
# root.title("Bifacial_Radiance | v. 0_2_5")
16561660

bifacial_radiance/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,13 @@ def _subhourlydatatoGencumskyformat(gencumskydata, label='right'):
280280
if any(gencumskydata.index.isin([padstart])):
281281
print("Data starts on Jan. 01")
282282
else:
283-
gencumskydata=gencumskydata.append(pd.DataFrame(index=[padstart]))
283+
#gencumskydata=gencumskydata.append(pd.DataFrame(index=[padstart]))
284+
gencumskydata=pd.concat([gencumskydata,pd.DataFrame(index=[padstart])])
284285
if any(gencumskydata.index.isin([padend])):
285286
print("Data ends on Dec. 31st")
286287
else:
287-
gencumskydata=gencumskydata.append(pd.DataFrame(index=[padend]))
288+
#gencumskydata=gencumskydata.append(pd.DataFrame(index=[padend]))
289+
gencumskydata=pd.concat([gencumskydata, pd.DataFrame(index=[padend])])
288290
gencumskydata.loc[padstart]=0
289291
gencumskydata.loc[padend]=0
290292
gencumskydata=gencumskydata.sort_index()
@@ -729,7 +731,8 @@ def _returnEPWnames():
729731
lontemp = location['geometry']['coordinates'][0]
730732
lattemp = location['geometry']['coordinates'][1]
731733
dftemp = pd.DataFrame({'url':[url], 'lat':[lattemp], 'lon':[lontemp], 'name':[name]})
732-
df = df.append(dftemp, ignore_index=True)
734+
#df = df.append(dftemp, ignore_index=True)
735+
df = pd.concat([df, dftemp], ignore_index=True)
733736
return df
734737

735738
def _findClosestEPW(lat, lon, df):

0 commit comments

Comments
 (0)