99from xml .etree .ElementTree import ParseError
1010
1111from pvlib .location import Location
12- from pvlib .irradiance import liujordan , get_extra_radiation , disc
12+ from pvlib .irradiance import campbell_norman , get_extra_radiation , disc
13+ from pvlib .irradiance import _liujordan
1314from siphon .catalog import TDSCatalog
1415from siphon .ncss import NCSS
1516
1617import warnings
18+ from pvlib ._deprecation import deprecated
19+
1720
1821warnings .warn (
1922 'The forecast module algorithms and features are highly experimental. '
@@ -526,8 +529,48 @@ def cloud_cover_to_transmittance_linear(self, cloud_cover, offset=0.75,
526529
527530 return transmittance
528531
532+ def cloud_cover_to_irradiance_campbell_norman (self , cloud_cover , ** kwargs ):
533+ """
534+ Estimates irradiance from cloud cover in the following steps:
535+
536+ 1. Determine transmittance using a function of cloud cover e.g.
537+ :py:meth:`~ForecastModel.cloud_cover_to_transmittance_linear`
538+ 2. Calculate GHI, DNI, DHI using the
539+ :py:func:`pvlib.irradiance.campbell_norman` model
540+
541+ Parameters
542+ ----------
543+ cloud_cover : Series
544+
545+ Returns
546+ -------
547+ irradiance : DataFrame
548+ Columns include ghi, dni, dhi
549+ """
550+ # in principle, get_solarposition could use the forecast
551+ # pressure, temp, etc., but the cloud cover forecast is not
552+ # accurate enough to justify using these minor corrections
553+ solar_position = self .location .get_solarposition (cloud_cover .index )
554+ dni_extra = get_extra_radiation (cloud_cover .index )
555+
556+ transmittance = self .cloud_cover_to_transmittance_linear (cloud_cover ,
557+ ** kwargs )
558+
559+ irrads = campbell_norman (solar_position ['apparent_zenith' ],
560+ transmittance , dni_extra = dni_extra )
561+ irrads = irrads .fillna (0 )
562+
563+ return irrads
564+
565+ @deprecated (
566+ '0.8' ,
567+ alternative = 'Forecast.cloud_cover_to_irradiance_campbell_norman' ,
568+ name = 'Forecast.cloud_cover_to_irradiance_liujordan' ,
569+ removal = '0.9' )
529570 def cloud_cover_to_irradiance_liujordan (self , cloud_cover , ** kwargs ):
530571 """
572+ Deprecated. Use cloud_cover_to_irradiance_campbell_norman instead.
573+
531574 Estimates irradiance from cloud cover in the following steps:
532575
533576 1. Determine transmittance using a function of cloud cover e.g.
@@ -554,9 +597,9 @@ def cloud_cover_to_irradiance_liujordan(self, cloud_cover, **kwargs):
554597 transmittance = self .cloud_cover_to_transmittance_linear (cloud_cover ,
555598 ** kwargs )
556599
557- irrads = liujordan (solar_position ['apparent_zenith' ],
558- transmittance , airmass ['airmass_absolute' ],
559- dni_extra = dni_extra )
600+ irrads = _liujordan (solar_position ['apparent_zenith' ],
601+ transmittance , airmass ['airmass_absolute' ],
602+ dni_extra = dni_extra )
560603 irrads = irrads .fillna (0 )
561604
562605 return irrads
@@ -571,7 +614,8 @@ def cloud_cover_to_irradiance(self, cloud_cover, how='clearsky_scaling',
571614 cloud_cover : Series
572615 how : str, default 'clearsky_scaling'
573616 Selects the method for conversion. Can be one of
574- clearsky_scaling or liujordan.
617+ clearsky_scaling or campbell_norman. Method liujordan is
618+ deprecated.
575619 **kwargs
576620 Passed to the selected method.
577621
@@ -585,6 +629,9 @@ def cloud_cover_to_irradiance(self, cloud_cover, how='clearsky_scaling',
585629 if how == 'clearsky_scaling' :
586630 irrads = self .cloud_cover_to_irradiance_clearsky_scaling (
587631 cloud_cover , ** kwargs )
632+ elif how == 'campbell_norman' :
633+ irrads = self .cloud_cover_to_irradiance_campbell_norman (
634+ cloud_cover , ** kwargs )
588635 elif how == 'liujordan' :
589636 irrads = self .cloud_cover_to_irradiance_liujordan (
590637 cloud_cover , ** kwargs )
0 commit comments