@@ -122,7 +122,10 @@ def __init__(self, model_type, model_name, set_type):
122
122
try :
123
123
self .model = TDSCatalog (model_url )
124
124
except HTTPError :
125
- raise HTTPError (self .model_name + ' model may be unavailable.' )
125
+ try :
126
+ self .model = TDSCatalog (model_url )
127
+ except HTTPError :
128
+ raise HTTPError (self .model_name + ' model may be unavailable.' )
126
129
127
130
self .datasets_list = list (self .model .datasets .keys ())
128
131
self .set_dataset ()
@@ -346,7 +349,8 @@ def set_time(self, time):
346
349
times = num2date (time [:].squeeze (), time .units )
347
350
self .time = pd .DatetimeIndex (pd .Series (times ), tz = self .location .tz )
348
351
349
- def cloud_cover_to_ghi_linear (self , cloud_cover , ghi_clear , offset = 20 ):
352
+ def cloud_cover_to_ghi_linear (self , cloud_cover , ghi_clear , offset = 20 ,
353
+ ** kwargs ):
350
354
"""
351
355
Convert cloud cover to GHI using a linear relationship.
352
356
@@ -362,6 +366,8 @@ def cloud_cover_to_ghi_linear(self, cloud_cover, ghi_clear, offset=20):
362
366
GHI under clear sky conditions.
363
367
offset: numeric
364
368
Determines the minimum GHI.
369
+ kwargs
370
+ Not used.
365
371
366
372
Returns
367
373
-------
@@ -420,7 +426,8 @@ def cloud_cover_to_irradiance_clearsky_scaling(self, cloud_cover,
420
426
irrads = pd .DataFrame ({'ghi' : ghi , 'dni' : dni , 'dhi' : dhi }).fillna (0 )
421
427
return irrads
422
428
423
- def cloud_cover_to_transmittance_linear (self , cloud_cover , offset = 0.75 ):
429
+ def cloud_cover_to_transmittance_linear (self , cloud_cover , offset = 0.75 ,
430
+ ** kwargs ):
424
431
"""
425
432
Convert cloud cover to atmospheric transmittance using a linear
426
433
model.
@@ -435,6 +442,8 @@ def cloud_cover_to_transmittance_linear(self, cloud_cover, offset=0.75):
435
442
Cloud cover in %.
436
443
offset : numeric
437
444
Determines the maximum transmittance.
445
+ kwargs
446
+ Not used.
438
447
439
448
Returns
440
449
-------
@@ -445,7 +454,7 @@ def cloud_cover_to_transmittance_linear(self, cloud_cover, offset=0.75):
445
454
446
455
return transmittance
447
456
448
- def cloud_cover_to_irradiance_liujordan (self , cloud_cover ):
457
+ def cloud_cover_to_irradiance_liujordan (self , cloud_cover , ** kwargs ):
449
458
"""
450
459
Estimates irradiance from cloud cover in the following steps:
451
460
@@ -466,14 +475,14 @@ def cloud_cover_to_irradiance_liujordan(self, cloud_cover):
466
475
# in principle, get_solarposition could use the forecast
467
476
# pressure, temp, etc., but the cloud cover forecast is not
468
477
# accurate enough to justify using these minor corrections
469
- solar_position = self .location .get_solarposition (self . time )
470
- dni_extra = extraradiation (self . time . dayofyear )
471
- airmass = self .location .get_airmass (self . time )
478
+ solar_position = self .location .get_solarposition (cloud_cover . index )
479
+ dni_extra = extraradiation (cloud_cover . index )
480
+ airmass = self .location .get_airmass (cloud_cover . index )
472
481
473
482
transmittance = self .cloud_cover_to_transmittance_linear (cloud_cover ,
474
483
** kwargs )
475
484
476
- irrads = liujordan (self . solar_position ['apparent_zenith' ],
485
+ irrads = liujordan (solar_position ['apparent_zenith' ],
477
486
transmittance , airmass ['airmass_absolute' ],
478
487
dni_extra = dni_extra )
479
488
irrads = irrads .fillna (0 )
@@ -679,8 +688,8 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
679
688
data = super (GFS , self ).process_data (data , ** kwargs )
680
689
data ['temp_air' ] = self .kelvin_to_celsius (data ['temp_air' ])
681
690
data ['wind_speed' ] = self .uv_to_speed (data )
682
- data = data . join ( self .cloud_cover_to_irradiance (data [cloud_cover ]),
683
- how = 'outer' )
691
+ irrads = self .cloud_cover_to_irradiance (data [cloud_cover ], ** kwargs )
692
+ data = data . join ( irrads , how = 'outer' )
684
693
return data .ix [:, self .output_variables ]
685
694
686
695
@@ -765,8 +774,8 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
765
774
data = super (HRRR_ESRL , self ).process_data (data , ** kwargs )
766
775
data ['temp_air' ] = self .kelvin_to_celsius (data ['temp_air' ])
767
776
data ['wind_speed' ] = self .gust_to_speed (data )
768
- data = data . join ( self .cloud_cover_to_irradiance (data [cloud_cover ]),
769
- how = 'outer' )
777
+ irrads = self .cloud_cover_to_irradiance (data [cloud_cover ], ** kwargs )
778
+ data = data . join ( irrads , how = 'outer' )
770
779
return data .ix [:, self .output_variables ]
771
780
772
781
@@ -846,8 +855,8 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
846
855
data = super (NAM , self ).process_data (data , ** kwargs )
847
856
data ['temp_air' ] = self .kelvin_to_celsius (data ['temp_air' ])
848
857
data ['wind_speed' ] = self .gust_to_speed (data )
849
- data = data . join ( self .cloud_cover_to_irradiance (data [cloud_cover ]),
850
- how = 'outer' )
858
+ irrads = self .cloud_cover_to_irradiance (data [cloud_cover ], ** kwargs )
859
+ data = data . join ( irrads , how = 'outer' )
851
860
return data .ix [:, self .output_variables ]
852
861
853
862
@@ -930,8 +939,8 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
930
939
data ['temp_air' ] = self .isobaric_to_ambient_temperature (data )
931
940
data ['temp_air' ] = self .kelvin_to_celsius (data ['temp_air' ])
932
941
data ['wind_speed' ] = self .gust_to_speed (data )
933
- data = data . join ( self .cloud_cover_to_irradiance (data [cloud_cover ]),
934
- how = 'outer' )
942
+ irrads = self .cloud_cover_to_irradiance (data [cloud_cover ], ** kwargs )
943
+ data = data . join ( irrads , how = 'outer' )
935
944
return data .ix [:, self .output_variables ]
936
945
937
946
@@ -999,8 +1008,8 @@ def process_data(self, data, **kwargs):
999
1008
cloud_cover = 'total_clouds'
1000
1009
data = super (NDFD , self ).process_data (data , ** kwargs )
1001
1010
data ['temp_air' ] = self .kelvin_to_celsius (data ['temp_air' ])
1002
- data = data . join ( self .cloud_cover_to_irradiance (data [cloud_cover ]),
1003
- how = 'outer' )
1011
+ irrads = self .cloud_cover_to_irradiance (data [cloud_cover ], ** kwargs )
1012
+ data = data . join ( irrads , how = 'outer' )
1004
1013
return data .ix [:, self .output_variables ]
1005
1014
1006
1015
@@ -1084,6 +1093,6 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
1084
1093
data = super (RAP , self ).process_data (data , ** kwargs )
1085
1094
data ['temp_air' ] = self .kelvin_to_celsius (data ['temp_air' ])
1086
1095
data ['wind_speed' ] = self .gust_to_speed (data )
1087
- data = data . join ( self .cloud_cover_to_irradiance (data [cloud_cover ]),
1088
- how = 'outer' )
1096
+ irrads = self .cloud_cover_to_irradiance (data [cloud_cover ], ** kwargs )
1097
+ data = data . join ( irrads , how = 'outer' )
1089
1098
return data .ix [:, self .output_variables ]
0 commit comments