This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
[Easy] Calculate one year of clear-sky irradiance at a location of your choosing. #6
kandersolar
started this conversation in
Project Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Clear-sky irradiance can be modeled at a selected location using one of pvlib's clear-sky models.
Step 1. - Import some libraries:
pvlib
,pandas
,pytz
, andmatplotlib
.pandas
provides date time functions andpytz
helps to localize the date times to a timezone.Step 2. - Choose a location and define a
Location
object usingpvlib.location.Location
. Hint: usepytz.all_timezones
to list available timezones.Step 3. - Set up one year of time stamps as a
pandas
DateTimeindex
, usingpandas
date_range
. Be sure to localize the time stamps to the correct timezone.Step 4. - Calculate a year of clear-sky irradiance using the Haurwitz model. We'll use Haurwitz's model here because it requires the fewest inputs. Do the calculation two different ways:
Location
methodget_clearsky
. Be sure to specify'haurwitz'
.pvlib.clearsky.haurwitz
. To prepare the inputs forhaurwitz
, you will need to first calculate solar position (use either theLocation
methodget_solarposition
or the functionpvlib.solarposition.get_solarposition
).Use
matplotlib
to visualize the results. Did you get the same answer from both approaches?In what season is clear-sky irradiance greatest? Least?
Step 5. - pvlib provides several clear-sky models. The default is a model of P. Ineichen's. Use the
Location
methodget_clearsky
to calculate clear-sky irradiance by the Ineichen model. Plot the Haurwitz and Ineichen clear-sky results. How are they the same? How are they different?For a deeper understanding: Look at the source code for the
Location
methodget_clearsky
. How does the calculation know what solar position to use?Bonus challenge: the Ineichen model can adjust clear-sky irradiance for the atmospheric depth at the selected location. If you use the
Location
methodget_clearsky
, the adjustment uses thealtitude
value on theLocation
object. Vary the altitude and see how much GHI changes with different altitude values.Beta Was this translation helpful? Give feedback.
All reactions