Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tracking keyword support for cutout.irradiation #340

Merged
merged 5 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ Release Notes
#############


Upcoming Release
================

.. Upcoming Release
.. ================
* Added solar tracking support for irradiation; e.g. ``cutout.irradiation(tracking='horizontal')``.


Version 0.2.12
Expand Down
37 changes: 26 additions & 11 deletions atlite/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,23 +539,34 @@ def wind(cutout, turbine, smooth=False, add_cutout_windspeed=False, **params):

# irradiation
def convert_irradiation(
ds, orientation, irradiation="total", trigon_model="simple", clearsky_model=None
ds,
orientation,
tracking,
Tasqu marked this conversation as resolved.
Show resolved Hide resolved
irradiation="total",
trigon_model="simple",
clearsky_model="simple",
):
solar_position = SolarPosition(ds)
surface_orientation = SurfaceOrientation(ds, solar_position, orientation)
surface_orientation = SurfaceOrientation(ds, solar_position, orientation, tracking)
irradiation = TiltedIrradiation(
ds,
solar_position,
surface_orientation,
trigon_model=trigon_model,
clearsky_model=clearsky_model,
tracking=tracking,
irradiation=irradiation,
)
return irradiation


def irradiation(
cutout, orientation, irradiation="total", clearsky_model=None, **params
cutout,
orientation,
irradiation="total",
tracking=None,
clearsky_model=None,
**params,
):
"""
Calculate the total, direct, diffuse, or ground irradiation on a tilted
Expand All @@ -564,26 +575,29 @@ def irradiation(
Parameters
----------
orientation : str, dict or callback
Surface orientation, e.g. a constant orientation {'slope': 0.0,
'azimuth': 0.0}. However, 'latitude_optimal' or a callback function
with the same signature as the callbacks generated by the
'atlite.pv.orientation.make_*' functions are also supported,
similar to the PV functions, although don't make much sense in this
context.
Panel orientation can be chosen from either
'latitude_optimal', a constant orientation {'slope': 0.0,
'azimuth': 0.0} or a callback function with the same signature
as the callbacks generated by the
'atlite.pv.orientation.make_*' functions.
irradiation : str
The irradiation quantity to be returned. Defaults to "total" for total
combined irradiation. Other options include "direct" for direct irradiation,
"diffuse" for diffuse irradation, and "ground" for irradiation reflected
by the ground via albedo. NOTE: "ground" irradiation is not calculated
by all `trigon_model` options in the `convert_irradiation` method,
so use with caution!
tracking : None or str:
None for no tracking, default
'horizontal' for 1-axis horizontal tracking
'tilted_horizontal' for 1-axis horizontal tracking with tilted axis
'vertical' for 1-axis vertical tracking
'dual' for 2-axis tracking
clearsky_model : str or None
Either the 'simple' or the 'enhanced' Reindl clearsky
model. The default choice of None will choose dependending on
data availability, since the 'enhanced' model also
incorporates ambient air temperature and relative humidity.
NOTE: this option is only used if the used climate dataset
doesn't provide direct and diffuse irradiation separately!

Returns
-------
Expand All @@ -607,6 +621,7 @@ def irradiation(
return cutout.convert_and_aggregate(
convert_func=convert_irradiation,
orientation=orientation,
tracking=tracking,
irradiation=irradiation,
clearsky_model=clearsky_model,
**params,
Expand Down