Skip to content
Merged
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
7 changes: 4 additions & 3 deletions pvanalytics/features/shading.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from skimage import morphology, measure
import pvlib
from pvanalytics import util

from skimage.morphology import footprint_rectangle
Comment thread
cwhanse marked this conversation as resolved.
Outdated
from skimage.morphology import rectangle as footprint_rectangle

def _to_image(data, width):
"""Convert data to an image.
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
Loading