Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gb/bc cs ratio #127

Merged
merged 4 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
added fix for data handling with multiyear CC solar and single year n…
…srdb clearsky ghi
  • Loading branch information
grantbuster committed Dec 21, 2022
commit c2583ecc91f686f2af492f51e7cf260822fa4776
6 changes: 3 additions & 3 deletions sup3r/bias/bias_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def get_data_pair(self, coord, knn, daily_reduction='avg'):
-------
base_data : np.ndarray
1D array of base data spatially averaged across the base_gid input
and possibly daily-averaged as well.
and possibly daily-averaged or min/max'd as well.
bias_data : np.ndarray
1D array of temporal data at the requested gid.
base_dist : np.ndarray
Expand Down Expand Up @@ -360,7 +360,7 @@ def get_base_data(cls, base_fps, base_dset, base_gid, base_handler,
-------
out : np.ndarray
1D array of base data spatially averaged across the base_gid input
and possibly daily-averaged as well.
and possibly daily-averaged or min/max'd as well.
out_ti : pd.DatetimeIndex
DatetimeIndex object of datetimes corresponding to the
output data.
Expand Down Expand Up @@ -469,7 +469,7 @@ def _reduce_base_data(base_ti, base_data, base_cs_ghi, base_dset,
-------
base_data : np.ndarray
1D array of base data spatially averaged across the base_gid input
and possibly daily-averaged as well.
and possibly daily-averaged or min/max'd as well.
"""

if daily_reduction is None:
Expand Down
13 changes: 10 additions & 3 deletions sup3r/preprocessing/data_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2371,9 +2371,11 @@ def get_clearsky_ghi(self):
ti_deltas_hours = ti_deltas.total_seconds()[1:-1] / 3600
time_freq = float(mode(ti_deltas_hours).mode[0])
t_start = self.temporal_slice.start or 0
t_end = self.temporal_slice.stop or len(self.raw_time_index)
t_slice = slice(int(t_start * 24 * (1 / time_freq)),
int(t_end * 24 * (1 / time_freq)))
t_end_target = self.temporal_slice.stop or len(self.raw_time_index)
t_start = int(t_start * 24 * (1 / time_freq))
t_end = int(t_end_target * 24 * (1 / time_freq))
t_end = np.minimum(t_end, len(ti_nsrdb))
t_slice = slice(t_start, t_end)

# pylint: disable=E1136
lat = self.lat_lon[:, :, 0].flatten()
Expand Down Expand Up @@ -2414,6 +2416,11 @@ def get_clearsky_ghi(self):
self._nsrdb_smoothing,
mode='nearest')

if cs_ghi.shape[-1] < t_end_target:
n = int(np.ceil(t_end_target / cs_ghi.shape[-1]))
cs_ghi = np.repeat(cs_ghi, n, axis=2)
cs_ghi = cs_ghi[..., :t_end_target]

logger.info('Reshaped clearsky_ghi data to final shape {} to '
'correspond with CC daily average data over source '
'temporal_slice {} with (lat, lon) grid shape of {}'
Expand Down