Skip to content

Commit

Permalink
fixing zone_mask copy issue when zone_mask is None, removing _check_z…
Browse files Browse the repository at this point in the history
…one_mask() and replacing with logic in __init__
  • Loading branch information
mjgleason committed Jan 20, 2025
1 parent 8de4a90 commit ef9db35
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions reV/supply_curve/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,17 @@ def __init__(
assert inclusion_mask.size == len(self._gids), msg
self._incl_mask = inclusion_mask.copy()

self._zone_mask = zone_mask.copy()
self._check_zone_mask()
self._zone_mask = zone_mask
if zone_mask is not None:
msg = (
"Bad zone mask input shape of {} with stated "
"resolution of {}".format(zone_mask.shape, resolution)
)
assert len(zone_mask.shape) == 2, msg
assert zone_mask.shape[0] <= resolution, msg
assert zone_mask.shape[1] <= resolution, msg
assert zone_mask.size == len(self._gids), msg
self._zone_mask = zone_mask.copy()

self._centroid = None
self._excl_area = excl_area
Expand Down Expand Up @@ -578,23 +587,6 @@ def _check_excl(self):
)
raise EmptySupplyCurvePointError(msg)

def _check_zone_mask(self):
"""
Check that the zone mask is the correct size and shape, and that it
contains only values of 0 and 1.
"""
if self._zone_mask is not None:
msg = (
"Bad zone mask input shape of {} with stated "
"resolution of {}".format(
self._zone_mask.shape, self._resolution
)
)
assert len(self._zone_mask.shape) == 2, msg
assert self._zone_mask.shape[0] <= self._resolution, msg
assert self._zone_mask.shape[1] <= self._resolution, msg
assert self._zone_mask.size == len(self._gids), msg

def exclusion_weighted_mean(self, arr, drop_nan=True):
"""
Calc the exclusions-weighted mean value of an array of resource data.
Expand Down

0 comments on commit ef9db35

Please sign in to comment.