diff --git a/sup3r/preprocessing/data_handlers/nc_cc.py b/sup3r/preprocessing/data_handlers/nc_cc.py index d9d54e238..907b3d935 100644 --- a/sup3r/preprocessing/data_handlers/nc_cc.py +++ b/sup3r/preprocessing/data_handlers/nc_cc.py @@ -216,20 +216,15 @@ def get_clearsky_ghi(self): Dimension.FLATTENED_SPATIAL ) + # reindex to target time index using only months/days + # (year-independent), this will handle multiple years and leap days + cs_ghi['time'] = pd.to_datetime(cs_ghi['time']).strftime('%m.%d') + reindex = {'time': self.rasterizer.time_index.strftime('%m.%d')} + cs_ghi = cs_ghi.reindex(reindex) + cs_ghi = cs_ghi.transpose(*Dimension.dims_3d()) cs_ghi = cs_ghi['clearsky_ghi'].data - # concatenate multiple years, need to consider leap years explicitly - # so decadal timeseries dont get shifted - if cs_ghi.shape[-1] < len(self.rasterizer.time_index): - multi_year = [] - for year in self.rasterizer.time_index.year.unique(): - n = (self.rasterizer.time_index.year == year).sum() - multi_year.append(cs_ghi[..., :n]) - cs_ghi = da.concatenate(multi_year, axis=-1) - - cs_ghi = cs_ghi[..., :len(self.rasterizer.time_index)] - self.run_wrap_checks(cs_ghi) return cs_ghi