Open AdamRJensen opened 1 year ago
The current implementation manually corrects midnight to be included in the day before/after corresponding to whether the data is right or left labeled, and then passes the adjusted time series to .groupby
:
grouping_category = irradiance.index.date
if label == 'right':
grouping_category[irradiance.index.time == dt.time(0)] += -dt.timedelta(days=1)
nighttime_offset = nighttime_irradiance.groupby(grouping_category).transform(aggregation_method)
However, this could automatically be handled by the .resample
function which natively supports the label
parameter:
nighttime_offset = nighttime_irradiance.resample('1d', label=label, closed=label).transform(aggregation_method)
If reviewers agree, I prefer the latter implementation as it's a lot cleaner and easier to read.
docs/api.rst
.docs/whatsnew
for all changes. Includes link to the GitHub Issue with:issue:`num`
or this Pull Request with:pull:`num`
. Includes contributor name and/or GitHub username (link with:ghuser:`user`
).This PR proposes one method for calculating the nighttime offsets discussed in #170. It is by no means a suggestion for this specific implementation to be the way forward, but making a PR simple makes it more efficient to discuss this particular implementation.