improver.generate_ancillaries.generate_derived_solar_fields module

Module for generating derived solar fields.

class GenerateClearskySolarRadiation[source]

Bases: BasePlugin

A plugin to evaluate clearsky solar radiation.

_abc_impl = <_abc_data object>
_calc_clearsky_ineichen(zenith_angle, day_of_year, surface_altitude, linke_turbidity)[source]

Calculate the clearsky global horizontal irradiance using the Perez & Ineichen (2002) [1, 2] formulation.

Note

#. The formulation here neglects the Perez enhancement that can be found in some instances of the literature; see PvLib issue (https://github.com/pvlib/pvlib-python/issues/435) for details. #. This method produces values that exceed the incoming extra-terrestrial irradiance for large altitude values (> 5000m). Here we limit the the value to not exceed the incoming irradiance. Caution should be used for irradiance values at large altitudes as they are likely to over-estimate.

Parameters:
  • zenith_angle (ndarray) – zenith_angle angle in degrees.

  • day_of_year (int) – Day of the year.

  • surface_altitude (Union[ndarray, float]) – Grid box elevation in metres.

  • linke_turbidity (Union[ndarray, float]) – Linke_turbidity value is a dimensionless value that characterises the atmospheres ability to scatter incoming radiation relative to a dry atmosphere.

Return type:

ndarray

Returns:

Clearsky global horizontal irradiance values, specified in W m-2.

References

[1] INEICHEN, Pierre, PEREZ, R. “A new airmass independent formulation for the Linke turbidity coefficient”, Solar Energy, vol. 73, p. 151-157, 2002. [2] M. Reno, C. Hansen, and J. Stein, “Global Horizontal Irradiance Clear Sky Models: Implementation and Analysis”, Sandia National Laboratories, SAND2012-2389, 2012.

_calc_clearsky_solar_radiation_data(target_grid, irradiance_times, surface_altitude, linke_turbidity, temporal_spacing)[source]

Evaluate the gridded clearsky solar radiation data over the specified period, calculated on the same spatial grid points as target_grid.

Parameters:
  • target_grid (Cube) – Cube containing the target spatial grid on which to evaluate irradiance.

  • irradiance_times (List[datetime]) – Datetimes at which to evaluate the irradiance data.

  • surface_altitude (ndarray) – Surface altitude data, specified in metres.

  • linke_turbidity (ndarray) – Linke turbidity data.

  • temporal_spacing (int) – The time stepping, specified in mins, used in the integration of solar irradiance to produce the accumulated solar radiation.

Return type:

ndarray

Returns:

Gridded irradiance values evaluated over the specified times.

_calc_optical_air_mass(zenith)[source]

Calculate the relative optical air mass using the Kasten & Young (1989) [1, 2] parameterization.

The relative optical air mass is a dimensionless quantity representing the relative path length through the atmosphere required to produce an equivalent mass of air compared to the shortest possible path through the full depth of the atmosphere corresponding to zenith = 0.

Note: For angles with zenith > 90, the optical_air_mass is ill-defined. Here we acknowledge that these values will result in invalid values in the power calculation and so map all such values to zero.

Parameters:

zenith (ndarray) – Zenith angle in degrees.

Return type:

ndarray

Returns:

Relative air mass for given zenith angle.

References: [1] F. Kasten and A. T. Young, “Revised Optical Air-Mass Tables and Approximation Formula”, Applied Optics, vol. 28, p. 4735-4738, 1989. [2] M. Reno, C. Hansen, and J. Stein, “Global Horizontal Irradiance Clear Sky Models: Implementation and Analysis”, Sandia National Laboratories, SAND2012-2389, 2012.

_create_solar_radiation_cube(solar_radiation_data, target_grid, time, accumulation_period, at_mean_sea_level, new_title)[source]

Create a cube of accumulated clearsky solar radiation.

Parameters:
  • solar_radiation_data (ndarray) – Solar radiation data.

  • target_grid (Cube) – Cube containing spatial grid over which the solar radiation has been calculated.

  • time (datetime) – Time corresponding to the solar radiation accumulation.

  • accumulation_period (int) – Time window over which solar radiation has been accumulated, specified in hours.

  • at_mean_sea_level (bool) – Flag denoting whether solar radiation is defined at mean-sea-level or at the Earth’s surface. The appropriate vertical coordinate will be assigned accordingly.

  • new_title (Optional[str]) – New title for the output cube attributes. If None, this attribute is left out since it has no prescribed standard.

Return type:

Cube

Returns:

Cube containing clearsky solar radiation.

_initialise_input_cubes(target_grid, surface_altitude, linke_turbidity)[source]

Assign default values to input cubes where none have been passed, and ensure that all cubes are defined over consistent spatial grid.

Parameters:
  • target_grid (Cube) – A cube containing the desired spatial grid.

  • surface_altitude (Cube) – Input surface altitude value.

  • linke_turbidity (Cube) – Input linke-turbidity value.

Return type:

Tuple[Cube, Cube]

Returns:

  • Cube containing surface altitude, defined on the same grid as target_grid.

  • Cube containing linke-turbidity, defined on the same grid as target_grid.

Raises:

ValueError – If surface_altitude or linke_turbidity have inconsistent spatial coords relative to target_grid.

_irradiance_times(time, accumulation_period, temporal_spacing)[source]

Get evenly-spaced times over the specied time period at which to evaluate irradiance values which will later be integrated to give accumulated solar-radiation values.

Parameters:
  • time (datetime) – Datetime specifying the end of the accumulation period.

  • accumulation_period (int) – Time window over which solar radiation is to be accumulated, specified in hours.

  • temporal_spacing (int) – Spacing between irradiance times used in the evaluation of the accumulated solar radiation, specified in minutes.

Return type:

List[datetime]

Returns:

A list of datetimes.

process(target_grid, time, accumulation_period, surface_altitude=None, linke_turbidity=None, temporal_spacing=30, new_title=None)[source]

Calculate the gridded clearsky solar radiation by integrating clearsky solar irradiance values over the specified time-period, and on the specified grid.

Parameters:
  • target_grid (Cube) – A cube containing the desired spatial grid.

  • time (datetime) – The valid time at which to evaluate the accumulated clearsky solar radiation. This time is taken to be the end of the accumulation period.

  • accumulation_period (int) – The number of hours over which the solar radiation accumulation is defined.

  • surface_altitude (Optional[Cube]) – Surface altitude data, specified in metres, used in the evaluation of the clearsky solar irradiance values.

  • linke_turbidity (Optional[Cube]) – Linke turbidity data used in the evaluation of the clearsky solar irradiance values. Linke turbidity is a dimensionless quantity that accounts for the atmospheric scattering of radiation due to aerosols and water vapour, relative to a dry atmosphere.

  • temporal_spacing (int) – The time stepping, specified in mins, used in the integration of solar irradiance to produce the accumulated solar radiation.

  • new_title (Optional[str]) – New title for the output cube attributes. If None, this attribute is left out since it has no prescribed standard.

Return type:

Cube

Returns:

A cube containing the clearsky solar radiation accumulated over the specified period, on the same spatial grid as target_grid.

class GenerateSolarTime[source]

Bases: BasePlugin

A plugin to evaluate local solar time.

_abc_impl = <_abc_data object>
_create_solar_time_cube(solar_time_data, target_grid, time, new_title)[source]

Create solar time cube for the specified valid time.

Parameters:
  • solar_time_data (ndarray) – Solar time data.

  • target_grid (Cube) – Cube containing spatial grid over which the solar time has been calculated.

  • time (datetime) – Time associated with the local solar time.

  • new_title (Optional[str]) – New title for the output cube attributes. If None, this attribute is left out since it has no prescribed standard.

Return type:

Cube

Returns:

Solar time data as an iris cube.

process(target_grid, time, new_title=None)[source]

Calculate the local solar time over the specified grid.

Parameters:
  • target_grid (Cube) – A cube containing the desired spatial grid.

  • time (datetime) – The valid time at which to evaluate the local solar time.

  • new_title (Optional[str]) – New title for the output cube attributes. If None, this attribute is left out since it has no prescribed standard.

Return type:

Cube

Returns:

A cube containing local solar time, on the same spatial grid as target_grid.