Skip to content

Commit

Permalink
Orientation sphinx documentation (#148)
Browse files Browse the repository at this point in the history
* Push up dummy files for the two orientation functions.

* add example for nrel mesa 1axis tracker

* update the routines for tracking and fixed tilt sunny days mask.

* updated the tracking routine to output plot

* added data files.

* fixed pep8 errors in docs.

* added to whatsnew file, docstring cleanup

* removed duplicate in documentation

* recommit bc jobs didn't run

* remove redundant data processing for tracking example

* update docs before branch switch

* Update docs/examples/fixed-nrel.py

Co-authored-by: Kevin Anderson <[email protected]>

* updated with OEDI system ID

* update the name of the serf east file

* Update the routine with the csv name

* pushed up reduced size file + changed wording per @kanderso-nrel's request

* fixed missing index on serf 15-min data file

* update the file to remove nan rows

Co-authored-by: Perry <[email protected]>
Co-authored-by: Kevin Anderson <[email protected]>
Co-authored-by: Perry <kperry>
  • Loading branch information
3 people authored Aug 17, 2022
1 parent 76a8ccc commit 5bac346
Show file tree
Hide file tree
Showing 5 changed files with 1,269 additions and 1 deletion.
55 changes: 55 additions & 0 deletions docs/examples/fixed-nrel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""
Flag Sunny Days for a Fixed-Tilt System
=======================================
Flag sunny days for a fixed-tilt PV system.
"""

# %%
# Identifying and masking sunny days for a fixed-tilt system is important
# when performing future analyses that require filtered sunny day data.
# For this example we will use data from the fixed-tilt NREL SERF East system
# located on the NREL campus in Colorado, USA, and generate a sunny day mask.
# This data set is publicly available via the PVDAQ database in the
# DOE Open Energy Data Initiative (OEDI)
# (https://data.openei.org/submissions/4568), as system ID 50.
# This data is timezone-localized.

import pvanalytics
from pvanalytics.features import daytime as day
from pvanalytics.features.orientation import fixed_nrel
import matplotlib.pyplot as plt
import pandas as pd
import pathlib

# %%
# First, read in data from the NREL SERF East fixed-tilt system. This data
# set contains 15-minute interval AC power data.

pvanalytics_dir = pathlib.Path(pvanalytics.__file__).parent
file = pvanalytics_dir / 'data' / 'serf_east_15min_ac_power.csv'
data = pd.read_csv(file, index_col=0, parse_dates=True)


# %%
# Mask day-night periods using the
# :py:func:`pvanalytics.features.daytime.power_or_irradiance` function.
# Then apply :py:func:`pvanalytics.features.orientation.fixed_nrel`
# to the AC power stream and mask the sunny days in the time series.

daytime_mask = day.power_or_irradiance(data['ac_power'])

fixed_sunny_days = fixed_nrel(data['ac_power'],
daytime_mask)

# %%
# Plot the AC power stream with the sunny day mask applied to it.

data['ac_power'].plot()
data.loc[fixed_sunny_days, 'ac_power'].plot(ls='', marker='.')
plt.legend(labels=["AC Power", "Sunny Day"],
loc="upper left")
plt.xlabel("Date")
plt.ylabel("AC Power (kW)")
plt.tight_layout()
plt.show()
55 changes: 55 additions & 0 deletions docs/examples/tracking-nrel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""
Flag Sunny Days for a Tracking System
=====================================
Flag sunny days for a single-axis tracking PV system.
"""

# %%
# Identifying and masking sunny days for a single-axis tracking system is
# important when performing future analyses that require filtered sunny day
# data. For this example we will use data from the single-axis tracking
# NREL Mesa system located on the NREL campus in Colorado, USA, and generate
# a sunny day mask.
# This data set is publicly available via the PVDAQ database in the
# DOE Open Energy Data Initiative (OEDI)
# (https://data.openei.org/submissions/4568), as system ID 50.
# This data is timezone-localized.

import pvanalytics
from pvanalytics.features import daytime as day
from pvanalytics.features.orientation import tracking_nrel
import matplotlib.pyplot as plt
import pandas as pd
import pathlib

# %%
# First, read in data from the NREL Mesa 1-axis tracking system. This data
# set contains 15-minute interval AC power data.

pvanalytics_dir = pathlib.Path(pvanalytics.__file__).parent
file = pvanalytics_dir / 'data' / 'nrel_1axis_tracker_mesa_ac_power.csv'
data = pd.read_csv(file, index_col=0, parse_dates=True)

# %%
# Mask day-night periods using the
# :py:func:`pvanalytics.features.daytime.power_or_irradiance` function.
# Then apply :py:func:`pvanalytics.features.orientation.tracking_nrel`
# to the AC power stream and mask the sunny days in the time series.

daytime_mask = day.power_or_irradiance(data['ac_power'])

tracking_sunny_days = tracking_nrel(data['ac_power'],
daytime_mask)

# %%
# Plot the AC power stream with the sunny day mask applied to it.

data['ac_power'].plot()
data.loc[tracking_sunny_days, 'ac_power'].plot(ls='', marker='.')
plt.legend(labels=["AC Power", "Sunny Day"],
loc="upper left")
plt.xlabel("Date")
plt.ylabel("AC Power (kW)")
plt.tight_layout()
plt.show()
5 changes: 4 additions & 1 deletion docs/whatsnew/0.1.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ Documentation
:py:func:`pvanalytics.quality.irradiance.check_irradiance_consistency_qcrad`,
and :py:func:`pvanalytics.quality.irradiance.check_irradiance_limits_qcrad`
(:issue:`133`, :pull:`140`)
* Added examples for the pvanalytics.features.orientation module,
including :py:func:`pvanalytics.features.orientation.fixed_nrel`,
and :py:func:`pvanalytics.quality.features.orientation.tracking_nrel`
(:issue:`133`, :pull:`148`)
* Added an example for
:py:func:`pvanalytics.quality.data_shifts` routine (:pull:`131`)


Contributors
~~~~~~~~~~~~

Expand Down
Loading

0 comments on commit 5bac346

Please sign in to comment.