Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 pvanalytics/features/shading.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from skimage import morphology, measure
import pvlib
from pvanalytics import util
from skimage.morphology import rectangle as footprint_rectangle


def _to_image(data, width):
Expand Down Expand Up @@ -113,7 +114,7 @@ def _prepare_images(ghi, clearsky, daytime, interval):
ghi_image = pd.DataFrame(cloudless_image).interpolate(
axis=0,
limit_direction='both'
).to_numpy()
).to_numpy().copy()
# set night to nan
ghi_image[~_to_image(daytime.to_numpy(), image_width)] = np.nan
return (
Expand Down Expand Up @@ -365,7 +366,7 @@ def fixed(ghi, daytime, clearsky, interval=None, min_gradient=2):
threshold = gradient > min_gradient # binary image of wire candidates

# From here we CAN use skimage because we are working with binary images.
three_minute_mask = morphology.rectangle(1, 3)
three_minute_mask = footprint_rectangle(1, 3)
wires = morphology.remove_small_objects(
morphology.binary_closing(threshold, three_minute_mask),
min_size=200,
Expand Down
2 changes: 1 addition & 1 deletion pvanalytics/quality/gaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def completeness_score(series, keep_index=True):
(fraction of the day for which `series` has data).

"""
seconds_per_sample = series.index.diff().total_seconds()[1]
seconds_per_sample = (series.index[1] - series.index[0]).total_seconds()
daily_counts = series.resample('D').count()
daily_completeness = (daily_counts * seconds_per_sample) / (1440*60)
if keep_index:
Expand Down
Loading