[
https://issues.apache.org/jira/browse/CLIMATE-786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15264099#comment-15264099
]
Ibrahim Jarif commented on CLIMATE-786:
---------------------------------------
Thanks [~lewismc]
> Update rcmed.py and test_rcmed.py
> ---------------------------------
>
> Key: CLIMATE-786
> URL: https://issues.apache.org/jira/browse/CLIMATE-786
> Project: Apache Open Climate Workbench
> Issue Type: Bug
> Components: data sources, tests
> Reporter: Ibrahim Jarif
> Assignee: Ibrahim Jarif
> Priority: Critical
> Labels: test
> Fix For: 1.1
>
>
> There are multiple issues here
> 1. The {code}if time.day != last_day_of_month:{code} on line 3 is incorrect.
> It should be{code}if time_step == 'monthly':{code} . Fixing this creates
> another bug. Read 2.
> {code}
> def _end_of_date(time, time_step):
> last_day_of_month = calendar.monthrange(time.year, time.month)[1]
> if time.day != last_day_of_month:
> end_time_string = time.strftime('%Y%m%d')
> end_time_string = end_time_string[:6] + str(last_day_of_month)
> time = datetime.strptime(end_time_string, '%Y%m%d')
> ##TODO: Change the 3 lines above with this line:
> ##time = datetime(time.year, time.month, lastDayOfMonth)
> elif time_step.lower() == 'daily':
> end_time_string = time.strftime('%Y%m%d%H%M%S')
> end_time_string = end_time_string[:8] + '235959'
> time = datetime.strptime(end_time_string, '%Y%m%d%H%M%S')
> ##TODO: Change the 3 lines above with this line:
> ##time = datetime(time.year, time.month, end_time.day, 23, 59, 5
> {code}
> 2. Multiple tests in test_rcmed.py start failing when 1. is fixed. The bug is
> on this line {code}def return_text(self, url):
> if url == self.url +
> "datasetId={0}¶meterId={1}&latMin={2}&latMax={3}&lonMin={4}&lonMax={5}&timeStart=20020801T0000Z&timeEnd=20021031T0000Z"\
> .format(self.dataset_id, self.parameter_id, self.min_lat,
> self.max_lat, self.min_lon, self.max_lon, self.start_time_for_url,
> self.end_time_for_url):{code} This line expects the
> {code}timeEnd=20021031T0000Z{code} but the actual value is
> {code}timeEnd=20021001T2359Z{code}. The value of timeEnd depends on
> {code}time_step{code} variable that is passed on from function to function.
> In the rcmed_test the value of {code}time_step='daily'{code} and hence the
> value of {code}timeEnd{code} should be {code}20021001T2359Z{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)