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

start_date/end_date matched to timestamp #44

wants to merge 1 commit into
base: wouellette-patch-2
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+2 −2
Diff settings


Just for now

start_date/end_date matched to timestamp

If start_date and/or end_date defined for the resampling range are beyond the range of the eopatch.timestamp, match them to the first and/or last eopatch.timestamp. This will avoid empty arrays at the beginning and end of the resampled eopatch.
  • Loading branch information...
wouellette committed Dec 18, 2018
commit bb430e4233b64832413fdcccfbf2c9c86fe3c9dc
@@ -307,8 +307,8 @@ def get_resampled_timestamp(self, timestamp):
raise ValueError('Invalid resample_range {}, expected tuple'.format(self.resample_range))

if tuple(map(type, self.resample_range)) == (str, str, int):
start_date = parser.parse(self.resample_range[0])
end_date = parser.parse(self.resample_range[1])
start_date = parser.parse(self.resample_range[0]) if parser.parse(self.resample_range[0]) > timestamp[0] else timestamp[0]
end_date = parser.parse(self.resample_range[1]) if parser.parse(self.resample_range[1]) < timestamp[-1] else timestamp[-1]
step = timedelta(days=self.resample_range[2])
days = [start_date]
while days[-1] + step < end_date:
ProTip! Use n and p to navigate between commits in a pull request.